Node.js frameworks review

This is a strongly-opinioned fly-by review of the evolving web framework ecosystem for Node.js.

I'm a big fan of Javascript, and write a lot of it for browsers.  So I've been excited about the prospects of server-side javascript which opens up a lot of possibilities for sharing code on the client and server side.

Node.js seems to have exploded server-side javascript development, as it was fast, easy to setup, and provided a niche-advantage in handling requests asynchronously.

But Node.js is a low-level runtime which brings a good standard library and scripting environment for deployment. We don't want to re-write cookie and session handling for every project.  For web development we need a framework that organizes code and brings the old lessons that Rails brought to projects like Turbogears and Django in python.

I have some biases. I'll just list them up front:
  1. I'm coming from Django and these days do most server-side development in python. In most things, the more django-y the better.
  2. However, I'd like to keep Node.js's cool asynchronous structure, and I'd rather idiomatic Javascript than forcing it to look like another language.
  3. I hate polluting global namespaces. This is a deal-breaker for me.
  4. I want some help setting up sessions, but we'll be developing our own login plugin (Wind for use at Columbia), so I'm paying special attention to that and how plugins integrate.

Terminology--like in Django, I'm going to refer to a Controller as the route-handling parts, and a View as the page handling code (separate from templates). It seems like most Node.js frameworks see it this way too (along with the original MVC Scheme understanding).

Let's get started:

Chain

web page says "deprecated in favour of ejsgi"--see below.

Coltrane

  • last-commit: July 20, 2009
looks abandoned.

Djangode

  • last-commit: March 19, 2010
  • pollutes global namespace:  NO
  • session model: NONE
  • template default: Django templates
There doesn't seem to be much code to simplify writing Views. This project seems to focus on the template side of things.

EJSGI

  • last-commit: February 18, 2010
  • pollutes global namespace: NO
  • session model: NONE
  • template default: NONE
pretty low-level, but has login examples. Views are passed a request object, and return a response object (that then gets processed and sent as the Node.js response object.

Express

This is clearly one of the most advanced projects. I would probably try to work with Express if it weren't for the global namespace thing. It also obscures the asynchronous features in Node.js.

  • last-commit: May 15, 2010 (3 days ago)
  • pollutes global namespace: YES
  • session model: Store.Memory (this.session)
  • template default: Haml (%h1, %p)
  • comment: Class() -based
View details: 
  • 'this' object in views exposes plugins which can be called. That undermines the easy use of Node's asynchronous features. It forces asynchronous actions to be done in the View code, which could be a good thing.

Geddy

This even provides a 'geddy-gen' to do a build-out of a project like Rails/Django/etc. It also has models and data-validation. Very nice.

  • last-commit: May 16, 2010 (15 hours ago)
  • pollutes global namespace: NO
  • session model: store or memory
  • template default: EJS (javascript templates) <% and %>  <%= and %>
View details:
  • There's a this.cookies and a this.session available to the view.

JIMI (based on Djangode)

This project went up as I was reviewing all the modules. It says something about how fast this field is changing. This post will probably be out of date in a month.

  • last-commit: May 18, 2010 (1 day ago)
  • pollutes global namespace: NO
  • session model: NONE so far
  • template default: django templates (though the sample app doesn't use it yet)
Jimi seems to be fleshing out handlers similar to Django's structure: urls.py, static directory, templates directory, and a views.js

View details:
  • we have convenience methods like redirect(), etc. 
  • As much as I like Django, I think this is again obscuring Node's great asynchronous possibilities.

JS.io

This doesn't seem to be a traditional web framework. It's seems to be more like Comet--something that lets you do javascript-rpc stuff.

MVC

  • last-commit: March 27, 2010
  • pollutes global namespace: NO
  • session model: NONE
  • template default: EJS, <% and %>  <%= and %>
View details:
  • this.renderText()
  • mvc.addToContext( {DICT} ) adds to 'this' in views like middleware--a similar approach to plugins in Express.
  • There doesn't seem to be access to the request and response objects in the Views, which will make it difficult to 'cheat when you have to.'
I think this is my favorite at the moment. Even if it's a 'microframework' it contains the important pieces, and will let me scaffold my own structure for views.

  • last-commit: May 15, 2010 (2 days ago)
  • pollutes global namespace: NO
  • session model:
    • req.session  (memory/cookie, at the moment unconfigurable)
    • decorates http.IncomingMessage with get_cookie(), ,set_cookie(), get_or_create_session()
  • template default: NONE (but link to template.node.js)
  • comment: nice for a view framework

  • View details:
    • Passes views the request, response objects along with the matched elements from the Controller regex.

    Pintura

    • last-commit: May 15, 2010 (2 days ago)
    • pollutes global namespace: NO
    Pintura is part of some monolithic Dojo thing, which probably makes a lot of sense if you use Dojo. Everytime I've checked out Dojo, I find a buggy, disorganized, constantly refactored ill-documented mess.

    People keep raving about it, so it must be good. I'm just too stupid to figure it out.

    Conclusion

    The most mature projects at the moment both come inspired from Rails projects. Those are Express and Geddy. A more full-featured Django clone looks inevitable in Jimi or some future incarnation. I'm going to be starting out with Nerve, but if I start needing more that what's there already, I might jump over to Geddy.

    Anyway, hope this helps anyone else taking a peak into this early Node.js community which is growing every day.