Coffeebone

yeoman generators for rapid prototyping

Coffeebone

Coffeebone is a yeoman generator, and a set of practices for creating backbone apps with an expressjs backend.

The app created will have a backend consisting of

  • expressjs
  • mongoose (mongodb)
  • code written in coffeescript
  • a server.js ready for deploying through forever.js
  • routes will be autoloaded if placed in /routes dir
  • schemas will be autoloaded if placed in /schemas dir

and a frontend consisting of

and of course the yeoman generator that will provide you with

  • a generator to get all boilerplate created for you
  • downloaded all dependencies
  • Sass version of twitter bootstrap
  • a generator to create a backend route
  • a generator to create a backend schema (for mongoose)
  • a generator to create a frontend model (Backbone.model)
  • a generator to create a collection (Backbone.collection)
  • a generator to create a frontend view (Backbone.view)
  • a generator to create a rest end point, which will create a schema, the routes (get, post, put and delete), the frontend model and collection, and have it all mapped
  • a build script to build all js (and handlebars templates) to one file
  • oh, and build all css to another file

To initialize a new app:

1
2
3
4
5
npm install --save yeoman-coffeebone
yeoman init coffeebone
npm install
yeoman build
node server.js

To create a new rest endpoint, ready to use from your backbone app (the collection and model created, and mapped to the created rest endpoint, with code ready to interact with mongoose with the given schema)

Assuming you have initialized the app as above

1
2
3
yeoman init coffeebone:rest Endpointname fieldname1:string fieldname2:string
yeoman build
node server.js