Subscribe to the goodies

Email Address

My Current Javascript Stack

Tim–Friday, 28 October 2011

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

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

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.

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.

Controllers

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.

Logging

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.

Development

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.

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.

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

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.