NodeJS TDD Boilerplate
JavaScript Makefile
Latest commit 2ad8033 Mar 1, 2016 Bryan Donovan various npm bumps


NodeJS TDD Boilerplate

A basic boilerplate for NodeJS REST API applications that emphasizes code consistency and excellent test coverage.


  • mocha test framework.
  • sinon stubbing framework.
  • istanbul test coverage framework.
  • jshint code linting.
  • restify REST framework.
  • choice between make and jake build tool.
  • choice of combined or separate servers for each 'app'.
  • servers can run on multiple ports.


  • Actual model implementation example instead of stubbed model.


Assuming you already have NodeJS 0.8.11 or higher installed:

git clone
cd nodejs-tdd-boilerplate
npm install .

Note: to use jake you need to install it globally:

npm install -g jake

You can view available jake tasks with jake -T.

The jake or make command will run JSHint, all the mocha unit tests, and check the test coverage. To view the test coverage report, open coverage/lcov-report/index.html after running make.

You can also run make test to just run the tests with coverage, make test-cov to run the tests and attempt to open the coverage report in your browser, and make lint to run JSHint.

To run the acceptance tests (which are just mocha tests), first start the server:

bin/start all


make test-acceptance


jake test:acceptance

You can launch the sever on more than one port via bin/launch, for example:

bin/launch users

.. will launch the users app on two ports (specified in config.js).

Then you can run the acceptance tests against either of those ports by specifying the PORT env variable:

PORT=12100 make test-acceptance