This project uses Bower for managing client-side dependencies, NPM for managing server-side dependencies and Grunt for putting everything together. Tests are run with QUnit.
Make sure that you have installed node.js and redis (there are plenty of tutorials online). Then:
sudo npm install -g bowerwill install the bower package manager (sudo is required for linking the binaries).npm installwill install server-side dependencies (about 100 MB).- If you just want to try it out, run
npm install --productionto avoid installing optimizers and test runners (then, it's only 16 MB).
- If you just want to try it out, run
bower installwill install client-side dependencies (about 30 MB).
redis-serverwill start Redis.node appwill start serving the app. Check the configuration files for fine-tuning.node demos/sourcewill start the fake signal generator.node demos/videowill start the fake video generator.
The app is run by default in development mode (so, the configuration taken is config/development.json). To run it in production mode, set the NODE_ENV variable: NODE_ENV=production node app.
There is a library,
backbone.io, that is downloaded from a fork I made on Github with my account (lemonzi). It contains a lot of custom patches, so the app won't work with the official versions. In the future,backbone.iotogether with some code from this repo (lib/db.js, mostly) should become a project of its own, the generic entities and instances all this relies on. This repository, then, would use that library providing generic entities and would implement sessions, widgets, etc. on top of them.
First of all, app.js is the main source for the server, and it's what should be run to start it.
clientcontains client-side code not ready for production (i.e. not concatenated or minified).client/jscontains all custom javascript codeclient/js/componentscontains all components that can be used to build custom widgetsclient/js/entitiescontains all entities that require processing: widget, session, stream, ...
client/csscontains all stylesheetsclient/vendorcontains all external libraries, that include both javascript and CSS code. It is automatically generated by Bower.
configcontains configuration files, some of them shared between client and server.libcontains the server-side javascript backend, which talks to the database, processes queries, etc.node_modulescontains all npm modules. It is automatically generated when running the install task.publiccontains production-ready client-side assets, such as icons.distcontains compiled client-side assets. It is automatically generated when running the built task by compiling the files underclient, but we add it to version control for convenience. It is only guaranteed to be updated on tagged commits (releases).testcontains unit tests for both client and server code.viewscontains the handlebars templates that the server uses to render HTML.views/partialsare HTML chunks that are appended to the main page. It's useful to have them in separate files to keep the code clean.
.jshintrcfiles configure the JavaScript code linter. They are used basically to declare which global variables are admissible at a given place..bowerrcsays what to do with client-side external libraries..gitignore, as usual, excludes files from the repository.Gruntfile.jsdefines some tasks that can be automated: compile code, pack everything, clean up... It's like a makefile but written in Javascript.bower.jsondeclares the repository as a client-side framework, and defines its dependencies.package.jsondeclares the repository as a server-side JS framework, an defines its dependencies.init.shjust starts the server and all demos with a single command.