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?

1
  • 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. Commented Aug 8, 2012 at 2:16

7 Answers 7

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

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/

Comments

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

Comments

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.

1 Comment

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.
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

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.