
We're spoilt for choice when it comes to modules and tools for developing in NodeJS there's usually plenty of options to choose from when trying to solve an issue. This can be frustrating when you just want to get something done and you end up discovering 3 out of 4 of your options aren't quite production-ready.
This is the setup I've come up with thus far, and it works pretty well for the types of projects I do; your milage may vary. Comments/feedback welcome.
Core
- node 0.4.12 Not using 0.5.x yet, not supported on heroku
- npm Node Package Manager. Essential
- CoffeeScript Light abstraction over javascript making it slightly more like terse languages like ruby or python, and makes it a pleasure to both read and write.
- SugarJS A sanity-returning, time-saving library of helper methods. Particularly useful are the Date tools and Object type detection. I put SugarJS in my core tools because I'm yet to find a project where it wasn't useful, it's that good.
DB
- MongoDB NoSQL data store. Powerful, fast, scalable, integrates seamlessly with javascript.
- Redis A NoSQL 'data structure database'. You can use this for managing sessions, or caching in a similar way one might use MemCached. Redis provides a lot more flexibility than MemCached, and is apparently faster.
Build/Make Tools
- Cake Basic build tool for built into CoffeeScript.
- npm scripts For configuring your application/module on install/uninstall/etc
- Should probably look at Jake and even Make scripts
Server
Models
- Mongoose MongoDB ORM, which makes modelling and persisting your data in MongoDB a breeze. Rails developers will find this similar to ActiveRecord. Also keeping a keen eye on JugglingDB which provides a unified ORM interface for MongoDB, Redis, Neo4j and MySQL, with more coming soon.
Views
Controllers
- express-resource Allows you to write rails-like controllers for NodeJS
- express-mongoose Simplifies your controller responses to Promises/Queries
Events/Flow Control
- Step Prevents the ridiculous nesting that async programming often invokes, and allows for easy serial/parallel flow control. A nice feature is the ability to fire off multiple async requests in parallel, only moving to the next 'step' once all the requests have completed.
- Signals Alternative thinking to the events model found in javascript. Define event 'channels' as object properties, then listen on a channel instead of for some arbitrary string. Inspired by C# events and signals/slots in Qt.
CSS
- Stylus Similar to SASS, but more terse. I'd argue it's better than SASS.
- Nib Similar to Compass, but more terse.
- BlueprintCSS Layout grid + useful defaults.
FrontEnd
- jquery Everyone's favourite JavaScript tool.
- SugarJS Corrects some javascript cross-browser issues and add it's additional native object helper functions. Seriously, use SugarJS.
- underscore Functional programming tools and handy utilities. How did I live without this?
- oCanvas HTML5 canvas drawing and manipulation library. Encapsulates canvas drawing tools in Objects. Flash developers will find this model more familiar than using the bare canvas API.
- Handlebars. Client-side templating. Extends Moustache, with partials and helpers. Really simple, powerful and I definitely find the {{}} delimiters more pleasing than EJS style: <% %>. Petty, I know. This is the default tempting tool in SproutCore.
- Backbone or…
- Spine The jury is out on which one I prefer, Spine has nicer structure, but Backbone has a more active community.
Logging
- Winston Log messages to files, MongoDB, Riak, Loggly Cloud Logging the or some custom scheme, instead of using built-in console.log.
Testing
- Jasmine Client-side BBD-style testing. Sensible matchers, setup/teardowns, spies and mocking. Provides a nicer DSL than nodeunit, with better matchers, and has support on the server-side via jasmine-node. Also has great support in Rails projects. Found the maintainers unresponsive to GitHub issues, which is frustrating, but I really love writing in Jasmine tests syntax so I'll forgive them. There is also a myriad of other 3rd party Jasmine tools.
- Matchers and support for testing the DOM with jQuery
- Sinon Better Spies and Mocking for any testing framework. Also provides a really easy to use fake HTTP server for mocking ajax calls. I've found this better than Jasmine's official ajax plugin
Real-Time
- Socket.IO Sockets for continuous, real-time communications. Excellent for client/server messaging, and apparently also server/server through Hook.IO (though I'm yet to use Hook.IO in production).
Auth
- EveryAuth support for Authentication and authorisation for, OAuth, OAuth2 and LDAP protocols. Twitter, Facebook, Github etc. An alternative is fresh off the press, Passport.
Development
- nodemon Simply restarts your node process when files in your project change, handles crashes.
Collaboration
- Git I quite enjoy using git and I'm learning more about it's power all the time, though I would be interested in looking into Mercurial, since it's risk-free as you can use it transparently with Git.
- GitHub I don't trust open source projects that aren't on GitHub, no other service I know makes it as easy to contribute to projects.
- Codebase Similar to GitHub, but provides a much better pricing model for private repositories.
Collaboration Tools
- GitX experimental fork GitX is an awesome alternative to the git command line tools. Spell-checking your commits, break commits up by line, easily visualise history/branches, etc. The 'experimental fork' makes significant improvements to the UI.
- filemerge Simple built-in tool in OSX for comparing files. Surprising how many developers manually resolve trivial merge conflicts. Filemerge isn't the best mergetool, but it's free and it's usable. I'd prefer Meld, but I'm yet to be able to build it for OSX.
Deployment
- heroku Basic server for hosting your app. If your app doesn't get much traffic you can host it here for free. Makes it really easy to deploy and scale up your application.
- Rackspace Easily create your own virtual servers. Inexpensive and good service.
- EC2 Good for serious deployments, learning curve to setup a server is pretty steep and it's all just a bit of a hassle. I would only use this when I need serious firepower, but it is really powerful.
Editing
- MacVim All the power of Vim with a GUI and mouse
- Janus A vim 'distribution' that makes vim a powerful, modern editor. Includes a project drawer, cmd-T (ala TextMate/Sublime Edit, this feature is epic), tab-completion, syntax support for modern tools like HAML, SASS, MarkDown, etc, over 100 popular vim themes, plus a bunch more features I haven't even started to integrate into my workflow.
- upAndDown vim plugin allows you to move single/or groups of lines up and down with Shift+Up/Down. Sounds trivial, but it's really handy. And while we're at it you should be managing your plugins like this with one of Vundle or Pathogen.
- Pathogen and Vundle make adding plugins to vim a breeze. You may find one works better than the other depending on the plugin. There appears to be no harm in having both installed side-by-side. Unlike Pathogen, Vundle is not installed with Janus.
Other
- HomeBrew Preferred OSX package manager, but doesn't play well with (but has a prettier site than) both MacPorts or Fink
- iTerm2 Excellent tabbed terminal, with ability to create and split windows, which is great when you want to look at code and watch log files at the same time. Previously I used the OSX standard Terminal.app with Visor, so I had a Quake-style terminal available on a hotkey, but iTerm2 now supports hide/show via hotkey, which was the selling point for me.
- Evernote Note-keeping. Every time I learn something I try to log it in Evernote for reference later, which is great tool for keeping track of little snippets of knowledge.
TODOs
- SproutCore I've seen some awesome SproutCore apps recently, most notable being Apple's iCloud. I like the idea of state charts, data binding and prebuilt components. I've had some experience with Sencha, wasn't impressed with it's performance, and I'm wondering how SproutCore's components will compare. I am enjoying these heated discussions of Sproutcore vs. The World.
- Angular, mainly because it's written by Misko Hevery whose blog contains some definitive posts on testability and dependency injection that shaped my thinking on programming and application development.
- Rosie A factory-girl clone, easily generates dynamic Javascript fixtures, mainly for use in testing.
- Knockout is usually mentioned as BackboneJS competition, so I figure I should check it out.
- batman.js First framework I've seen built from scratch with CoffeeScript as the preferred language from the outset.
- RailwayJS Closely mimics Rails in JS, provides an ORM, code generators, and a decent backbone for a typical web application.
- Hook.IO I like the idea of being able to modularise a web application into multiple apps.
Comments
James - Sat, 12/11/2011 - 12:42pm.
Wow, thank you, awesome post!
Add new comment