JavaScript skeleton(starter, example) using Express and Chaplin
JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
lib
public
test
.editorconfig
.gitignore
.jshintrc
.travis.yml
Procfile
README.md
data-gen.js
package.json
server.js

README.md

JavaScript skeleton(starter, example) using Express and Chaplin

Build Status Coverage Status Dependency Status Stories in Ready Gittip Total views Built with Grunt Bitdeli Badge

If you want to start a project in pure JavaScript it is one of the options of project structure. I was faced with this problem, considered a lot of projects and collect this one.
The project structure is divided into two parts, the frontend and backend. This two parts are very similar in structure using MVC. The app works on the principle of building ui based on data from the backend as JSON.
Also in this project you can find a few examples (authorization using passport, test coverage on frontend, etc.)
And of course Demo (email@email.com:password) if white screen "Refresh page"

Technologies

Backend (MVC)

  • Express
  • Mongoose
  • Winston
  • Passport

Test

  • Mocha
  • Should
  • Supertest
  • Blanket
  • Casper
  • Benchmark

Frontend (MVC)

  • Yo generator
  • Grunt
  • Bower
  • Require
  • Backbone
  • Chaplin
  • Bootstrap
  • Ejs
  • Stylus
  • YUIDoc

Test

  • Mocha
  • Expect
  • Sinon
  • Blanket
  • Casper
  • Benchmark

Usage

Run Development

npm install
mongod
node server
cd public
grunt server

Run Production

npm install
mongod
node server

Test

mongod
mocha test/spec --recursive -R spec
// Coverage
mocha test/spec --recursive -r blanket -R html-cov > coverage.html
open coverage.html
// Frontend
cd public
grunt test
// html
grunt server
visit http://localhost:9000/test/spec/index.html
visit http://localhost:9000/test/spec/coverage.html

Frontend commands

cd public
grunt (running lint and test)
grunt server (running dev frontend server)
grunt prepare (gather static from bower)
grunt build
grunt lint
grunt docs (build docs)

File structure

-app/
 |--controllers/
 |--models/
 |--views/
 |--helpers/
 |--mailers/
 |--assets/
-config/
 |--locales/
 |--routes.js
 |--environment.js
 |--passport.js
 |--express.js
 |--application.js
 |--frontend.js
 |--mongoose.js
-lib/
 |--log.js
 |--utils.js
-test/
 |--automation
 |--benchmark
 |--spec
    |--controllers/
    |--models/
    |--helpers/
    |--mailers/
    |--factories.js
    |--helper.js
    |--server.js
--server.js
--data-gen.js (generates data to mongo)
--package.json
-public/
 |--src/
    |--app/
       |--controllers/
          |--base/
       |--models/
          |--base/
       |--views/
          |--base/
          |--styles/
          |--templates/
       |--helpers/
       |--config/
          |--locales/
          |--routes.js
          |--environment.js
          |--application.js
          |--backend.js
       |--assets/
       |--lib/
          |--utils.js
          |--error-handler.js
       |--application.js
       |--mediator.js
       |--main.js
       |--initialize.js
    |--test/
       |--automation
       |--benchmark
       |--spec
          |--controllers/
          |--models/
          |--helpers/
          |--lib/
          |--views/
          |--index.html
          |--coverage.html
          |--helper.js
          |--initialize.js
    |--vendor/
       |--scripts/
       |--styles/
    |--index.html
 |--Gruntfile.js
 |--bower.json
 |--yuidoc.json
 |--package.json