13 great frameworks for Node.js

This baker's dozen of lean and mean Node.js frameworks can help streamline your development of fast websites, rich APIs, and real-time apps

Fab Node frameworks
Fab Node frameworks

Spring is the time when the plants send out their green shoots and look to grow in all directions. Node.js may be several years old now, but it is still in the spring of its life. The options are multiplying as everyone experiments with new and better ways to build websites and applications on the platform. There are dozens of frameworks, and the new growth is everywhere.

What follows are just a few of the most prominent frameworks that caught our eye. They make it simpler to build a complex website, a data-driven Web app, a real-time application, or an API. If you're starting a new project, building on one of these frameworks is a fast way to leverage much of the best prior work and experience to be found in the Node ecosystem. 

Express
Express

This very thin shell -- less than 1,000 lines of code -- takes a minimalist approach to processing Web requests. Express maps the URL to a template and then fills in the values with data from a generic data store. The standard template engine is Consolidate, but the pattern is simple enough that most will work quite well.

The Express team promises that MySpace is trying to upgrade its hipness score by building the next version in Express. If you don't remember MySpace, ask your grandparents. They may still have an account.

Express is distributed under the MIT license from GitHub

Locomotive
Locomotive

Designed to add more "configuration by convention" features to Express, Locomotive follows in the path of Express but extends the minimalist framework with features that use a standard plan for configuration. Thus every Locomotive site runs on top of Express, and all of the MVC and REST hooks work in the same way, while Locomotive adds a standard architecture and directory structure. It's sort of like a framework for the Express framework.

The image shows the directory structure's standard convention. Locomotive is distributed under the MIT license from GitHub.  

Koa
Koa

The team that built Express decided to move on and build the next generation. The result, Koa, is a telescoping call stack designed to let you add new features to the call and response handshake. You start by writing just a bit of code to handle the request, but then you can customize anything along the path. The middleware that handles all of the telemetry is open for your changes. Dozens of plug-in packages make it easy to add compression, caching, JSON encoding, and other features to the stack.

The image shows some of the Jade markup used by one of the templating libraries bundled with Koa. Koa is distributed under the MIT license from GitHub

Total.js
Total.js

The Total.js stack is designed to automate as many things as possible. You start with a markup template for the HTML and CSS, then Total.js compiles them into raw code and then compresses it for delivery. It's one big compiler of websites masquerading as a framework.

The image shows an example sushi bar website built to support ordering. Total.js is distributed under the MIT license from GitHub.

Derby
Derby

One of the points of using Node.js is to use the same language in the client and the server. Derby takes this principle to the extreme by trying to run the same code in both and synchronize the results. Then it tosses in template rendering, packaging, and some MVC to simplify the process. You don't need to worry about things like compiling your CSS because Derby's got this integrated.

The image shows a basic To Do example distributed with the code. Derby is distributed under the MIT License from GitHub

Meteor
Meteor

Meteor is designed to build Web apps that constantly synchronize with the server. Your changes to the templates and the data flow from the server to the browser automatically, and the redrawing and the updating are handled directly by the underlying framework. This works, by the way, in both directions: Your browser code can make changes or write data as if the database is right there. The synchronization happens in the background.

The image shows an example app for synchronizing the work of emergency first responders. Meteor is distributed under the Apache license from Meteor.com and from GitHub

Mojito
Mojito

This HTML5 framework for the browser and server from Yahoo offers direct MVC access to the server database through the local routines. One clever feature allows the code to migrate. If the client can't run JavaScript for some reason, Mojito will run it on the server -- a convenient way to handle very thin clients.

The image shows Yahoo's Cricket site that delivers scores and news from the Cricket community. Mojito is distributed under the new BSD license from GitHub

Nombo
Nombo

Real-time apps are a bit trickier to build than your typical website. Nombo is a framework that builds upon the strengths of Node.js to deliver information in real time to a single-page application. The designers relied upon Node's basic non-blocking framework and then extended it in a careful way. Pairing a linearly scalable server with an RIA-style client, Nombo is geared for online gaming, live communications, and transaction systems.

The image shows a one-page chat application that fits the paradigm perfectly. Nombo is distributed under the MIT license from GitHub

Restify
Restify

Not every application requires full support for a browser. Restify is one of the server-side frameworks designed to serve up data and only data through an API. You fire it up, and out comes JSON to everyone who shows up.

Restify places special emphasis on debugging and profiling so you can drill down and optimize the performance of your server. DTrace integration makes it possible to watch just what happens and see when things might go wrong.

The image shows an audit packet saved from a debugging session. Restify is available from GitHub under a very basic license that requires little except a notice of copyright. 

LoopBack
LoopBack

Most of the work of creating an API can be automated. Once you know the data model, building the tools for editing the data is largely grunt work. LoopBack automates much of this and adds connectors for popular data stores, such as Oracle, MySQL, and MongoDB. It supports either dynamic data models that evolve with time or static models with a fixed schema. There's also a ready-made security layer with access control lists and some good mobile services. All of this is built on top of Express.

The image shows LoopBack's API explorer. LoopBack is available from GitHub under a hybrid open source license for test projects or under a subscription that includes support and connectors to high-end databases like Oracle. 

ActionHero
ActionHero

Many frameworks aim to deliver full-featured support for interacting with browsers and JSON clients. ActionHero does that but also works on a lower level, communicating directly with TCP and wire protocols. It's great if you need something simpler than JSON. This can be quite useful if you want to send out raw files too, because ActionHero delivers like a CDN without forcing you to run Apache or Nginx.

The image shows the ActionHero stack. ActionHero is available under the Apache license from GitHub.

 

Frisby
Frisby

"Trust but verify" was the slogan Ronald Reagan lived by during the Cold War. It's also a good motto for anyone running a server farm. Frisby is a framework built for testing APIs; you wind it up, and it sends off requests and verifies the responses. Frisby is also built on top of Node.js, making it a good complement for some of the other frameworks here.

The image shows some of the code that's used to check to see that the JSON response is correct. Frisby is available under an unspecified license and installs as an NPM package. 

DocPad
DocPad

"The more the merrier" is a phrase that also applies to open source development, especially when the development is delivered through a robust plug-in ecosystem. There are dozens of plug-ins built to extend the DocPad framework. Many are preprocessors that convert shorthand like CoffeeScript and Haml to HTML and JavaScript. Others do things like generate a sitemap.xml file for search engines. All of them make building and deploying a complex DocPad app much faster.

The image shows a query engine demonstration built on top of DocPad. DocPad is available from GitHub under the MIT license.