Skip to content

repovizz/frontend

Repository files navigation

LabStream Framework

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.

Installing

Make sure that you have installed node.js and redis (there are plenty of tutorials online). Then:

  • sudo npm install -g bower will install the bower package manager (sudo is required for linking the binaries).
  • npm install will install server-side dependencies (about 100 MB).
    • If you just want to try it out, run npm install --production to avoid installing optimizers and test runners (then, it's only 16 MB).
  • bower install will install client-side dependencies (about 30 MB).

Running

  • redis-server will start Redis.
  • node app will start serving the app. Check the configuration files for fine-tuning.
  • node demos/source will start the fake signal generator.
  • node demos/video will 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.io together 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.

Structure

First of all, app.js is the main source for the server, and it's what should be run to start it.

Folders

  • client contains client-side code not ready for production (i.e. not concatenated or minified).
    • client/js contains all custom javascript code
      • client/js/components contains all components that can be used to build custom widgets
      • client/js/entities contains all entities that require processing: widget, session, stream, ...
    • client/css contains all stylesheets
    • client/vendor contains all external libraries, that include both javascript and CSS code. It is automatically generated by Bower.
  • config contains configuration files, some of them shared between client and server.
  • lib contains the server-side javascript backend, which talks to the database, processes queries, etc.
  • node_modules contains all npm modules. It is automatically generated when running the install task.
  • public contains production-ready client-side assets, such as icons.
  • dist contains compiled client-side assets. It is automatically generated when running the built task by compiling the files under client, but we add it to version control for convenience. It is only guaranteed to be updated on tagged commits (releases).
  • test contains unit tests for both client and server code.
  • views contains the handlebars templates that the server uses to render HTML.
    • views/partials are HTML chunks that are appended to the main page. It's useful to have them in separate files to keep the code clean.

Dotfiles and more

  • .jshintrc files configure the JavaScript code linter. They are used basically to declare which global variables are admissible at a given place.
  • .bowerrc says what to do with client-side external libraries.
  • .gitignore, as usual, excludes files from the repository.
  • Gruntfile.js defines some tasks that can be automated: compile code, pack everything, clean up... It's like a makefile but written in Javascript.
  • bower.json declares the repository as a client-side framework, and defines its dependencies.
  • package.json declares the repository as a server-side JS framework, an defines its dependencies.
  • init.sh just starts the server and all demos with a single command.

About

NodeJS server + Javascript client-side libs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published