Home

Awesome

A Node.js skeleton using Express, Mongoose and Coffeescript

Do you find yourself looking around for Node.js conventions and how to structure your Node application? Firstly, this skeleton shows how a Node.js web application can be structured properly. Secondly, it demonstrates how some popular modules that provide basic functionalities for your app can be used.

I haven't been using Node.js for long but here I've gathered some of the good things I have come across on my short journey. Hope this can help you get started.

You can find this demo running on Heroku: http://form5-node-skeleton.herokuapp.com/

Log in using admin/admin to manage users & articles.

Install

Assuming you have Node.js and npm installed, to get started developing using this skeleton, run:

	$ git clone git://github.com/olafurnielsen/form5-node-express-mongoose-coffeescript.git
	$ npm install
	$ bin/devserver

Open http://localhost:3000/ in your browser.

What does this skeleton provide you with?

Screenshot

And much more...

File structure

-app/
  |--controllers/
  |--models/
  |--views/
  |__helpers/ (template helper functions)
-config/
  |--routes.coffee
  |--environment.coffee
  |--passport.coffee (auth config)
  |--express.coffee (express.js config)
  |--middlewares/ (custom middlewares)
-assets/ (Client side assets)
  |--css/ (supports LESS)
  |--js/ (supports Coffescript)
  |--img/
-bin/
  |__devserver (Shell script for firing up node-dev)
--server.js

Inspiration and further reading

This skeleton is heavily based on nodejs-express-mongoose-demo but it uses Coffeescript instead of standard javascript and implements various other modules which I think are really useful when developing an Express.js application.

Madhums - Breaking down app.js file - nodejs, express, mongoose

Stack Overflow - Node.js & Express.js: Breaking up the app.js file