75

As a pet project, I am trying to get familiar with NodeJS and CoffeeScript, and am finding it hard to get the ball rolling.

I've found plenty of examples of single-file super-simple apps like in CoffeeScript's examples folder, however, none of those really show what a full application would look like. I've also scrounged Google to no avail.

Do you have any examples of medium-sized, multi-file CoffeeScript/NodeJS apps I could learn from?

Austin Hyde
  • 26,347
  • 28
  • 96
  • 129
  • nodejs would probably be easier to learn if you went with vanilla JS, do you have a particular reason you're trying to learn it in CS? If you do, this comment doesn't really matter, just trying to make sure you're not unnecessarily adding more work for yourself. – Andy Ray Aug 08 '12 at 02:16

7 Answers7

34

See this gist: https://gist.github.com/652819

Its pretty much an entire NodeJS app using the Express framework, Redis for session storage, Couchdb as the database and written in CoffeeScript. However, you are asking for code organization. That depends from developer to developer. I personally prefer Express. However if you prefer MVC style then see Geddy.

Shripad Krishna
  • 10,463
  • 4
  • 52
  • 65
16

GitHub is your friend:

And if you want even more, take a look at the listing for the Coffee-Script Language. I suppose that 95% of the projects there are related to Node.js at the moment.

Ivo Wetzel
  • 46,459
  • 16
  • 98
  • 112
6

The Zappa framework is a coffeescript layer on top of Express, Socket.IO and more. It's quite comprehensive and the examples might contain what you're looking for? https://github.com/mauricemach/zappa/

RandomEtc
  • 1,976
  • 1
  • 18
  • 17
4

here is a search for github, for everything writtin in coffeescript and description containing the word "node" - returning 300+ entries

https://github.com/search?langOverride=&language=CoffeeScript&q=node&repo=&start_value=1&type=Repositories&x=0&y=0

balupton
  • 47,113
  • 32
  • 131
  • 182
3

By default, it would be the same as a medium-sized, multi-file JavaScript/NodeJS app.

Except you would have source files named *.coffee, and you would invoke the CoffeeScript compiler to build your JavaScript NodeJS app.

yfeldblum
  • 65,165
  • 12
  • 129
  • 169
  • What I mean is that the smaller examples are meant to show off CoffeeScript as a language, not a tool. I am looking for a higher-level view to understand directory/module/code structure, as opposed to standalone snippets. – Austin Hyde Jan 03 '11 at 06:23
2

EDIT July 25 2013

Sails.js has added CoffeeScript support recently. It's a pretty great framework and will make sense to Rails users right off the bat: http://sailsjs.org/


My original answer follows:

Check out https://github.com/pheuter/brunch-socket-soup

Description: Brunch.io skeleton featuring socket.io, includes a coffeescript server file

from the README...

Make sure to have Brunch.io installed.

Prepare the bowl:

brunch new <your-project-name> -s github://pheuter/brunch-socket-soup

Throw in the ingredients:

npm install

Serve and take sips:

coffee server.coffee && brunch watch

Community
  • 1
  • 1
keyvan
  • 2,947
  • 1
  • 18
  • 13
0

I find it helpful to examine existing node modules which were written in coffee-script, of with which I am ALREADY familiar.

Run a quick search of your (globally) installed node modules, eg..

for x in $(echo $NODE_PATH | tr ':' '\n'); { [[ -d $x ]] && ls $x/**/*.coffee; }

On my system, I'd take a peek at the results (usually with the shortest paths, and which yield the modules with which I am most comfortable).. such as

/usr/local/lib/node_modules/ghfm/src/index.coffee

or

/usr/local/lib/node_modules/ipaddr.js/src/ipaddr.coffee

Alex Gray
  • 16,007
  • 9
  • 96
  • 118