node.js boilerplate + best practices

I'm new to node.js, just starting..

i'm after a good node.js boilerplate and best practices such as coding design pattrens (for example Dependency injection, etc.. I've read JS design pattrens by Douglas Crockford not once.. but would like to see the differences for node) name-spacing - with directory structure, etc..

regarding node.js stack as far as i know:

  • express - must
  • async - must (flow control)
  • dnode - ?
  • socket.io - websocket
  • nowjs - would love to use it , but as i understand the scale version won't be free ("we'll soon be licensing a distributed version of NowJS currently under development. Contact us at sales@nowjs.com")
  • underscore + backbone - ?
  • DB layer - ?
  • templating - i use handleBars - jquery is a must
  • require.js - (i don't want to use commonJS... not sure how the integration on the server works)

So what to add/ remove from the libs list?, where can i find a professional boilerplate? and any other tips relating to it.

Thanks in advance!

IMHO, for a project skeleton, more important than which modules to include (those are easy to install with npm, anyway) is how to structure your project, how to use cluster properly and do hot-reloading for dev + process monitoring in production.

You can see some of those tricks at: http://nodebootstrap.com https://github.com/inadarei/nodebootstrap

Edit: dead link as of 12/03/14

I'm a bit late, but hopefully this will help someone else.

One of the shortcomings of nodebootstrap (and almost every other node boilerplate project out there) is that it doesn't provide any boilerplate code for getting started with Backbone.js

Similarly there are great Backbone.js boilerplate projects, some (see Yeoman.io), even include little node development servers, but these are hard to expand into a full on backend/frontend solution for building a webapp.

I therefore started webapp-boilerplate which uses grunt-tasks for compilation and server reloads on code changes. It's still a work in progress, but should get you started quickly.

I've been looking for a node boilerplate project, and came across this, it's seems to be the most favourited on GitHub with almost 10x the stars of any of the others

https://github.com/sahat/hackathon-starter

I think the Backbone-Require-Boilerplate is pretty impressive.

https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate

Includes Backbone, Lodash, Require.js, Almond.js, jQuery, jQueryUI, jQuery Mobile, Twitter Bootstrap, Jasmine, and Grunt. I was up and running in minutes and it's made with an appreciation for the differences in prod vs dev environments.