Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Build Status

This is an example node.js app using:

  • "express" (duh) with jade templates (easily changeable)
  • "passport" for various authentication possibilities (we cover facebook and twitter)
  • "mongoose" for mongodb connectivity
  • "connect-mongo" for persistent sessions

The project tries to include a complete setup including things like:

  • environment differences (development, testing, production)
  • jshint setup (but its setup really depends on your preferences)
  • mocha tests using supertest (which is based on super-agent)
  • grunt for running jshint, tests etc.
  • travis-ci setup (see the build status image above)


  • extensive inline documentation trying to make clear whats going on
  • clean and simple structure with config, controllers, models and views
  • facebook and twitter authentication via passport
  • users are stored to mongodb
  • persistent sessions in mongodb (you're still logged in after server reboots)
  • express config examples for development and production modes
  • express access logger (just like regular web server logs)
  • CSRF protection, see express API docs and
  • custom middleware example
  • loading of static assets
  • custom favicon
  • stylus styles

Getting started

If you want to use my existing node-base-apps on facebook and twitter to login using their OAuth mechanism, please make sure you serve the app through your localhost accessible via ""!

You need to make an /etc/hosts entry for like this:    localhost

Other necessary steps

  • initially do a "npm install" or "npm update" within this directory to load dependencies to ./node_modules/
  • add hosts entry: (then you can use provided OAuth keys)
  • make sure mongodb is running on (change in config/index.js): run mongod & to start the daemon
  • maybe set NODE_ENV environment var, see server.js source (falls back to "development")
  • start the node-base app with node server.js
    • even better install nodemon: npm install -g nodemon, then run nodemon server.js
  • navigate to (or whatever your localhost points to)

Underpinnings and optional goodies

If not done before install these npm packages (globally):

  • Grunt: npm install -g grunt-cli
  • JSHint: npm install -g jshint


  • nodemon: npm install -g nodemon, then run nodemon server.js instead of node server.js to avoid restarting your server.js when editing files
  • if you use Sublime Text install "EditorConfig" from the package manager: Shift-Cmd-P, enter "pac[...]" -> [Enter] -> "edito[...]" -> [Enter]

Inspired by and hacked together using

MIT License (see LICENSE file)


node.js boilerplate ft. express, passport, mongoose, bootstrap. clean structure to use as a starting point, good for hackathons too







No releases published


No packages published