Skip to content

pillarjs/node-frameworks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 

Repository files navigation

A comparison of server-side node frameworks. This may include frameworks with a browser-side component.

Frameworks

Only frameworks with over 1,000 stars are currently added. Feel free to add your own. The frameworks are listed by number of watchers, descending, as of March 18, 2014.

Framework Sponsor(s) / Author(s) Watchers Stars
Meteor Meteor Development Group 973 11,687
Express StrongLoop / TJ Holowaychuk 828 12,824
Sails Mike McNeil 485 5,582
Koa TJ Holowaychuk 232 3,160
Derby Nate Smith Brian Noguchi 213 3,079
Kraken PayPal 210 2,424
Hapi Walmart Labs 204 1,981
Connect Sencha Labs 202 4,180
LoopBack StrongLoop 187 2,602
Restify Mark Cavage 122 2,001
Geddy Matthew Eernisse 101 1,703
CompoundJS Anatoliy Chakkaev 91 1,542
Flatiron Nodejitsu 75 1,146

Stack Integration

Traditionally, frameworks are explicitly server-side. However, there are now frameworks that are vertically integrated, i.e. integrate the client with the server.

Framework Server-side Client-side
Meteor
Express
Sails
Koa
Derby
Kraken
Hapi
Connect
LoopBack
Restify
Geddy
CompoundJS
Flatiron

Dependencies

Some frameworks are built upon other frameworks.

Framework Dependencies
Meteor
Express Connect for < 4.0.0
Sails Express
Koa
Derby
Kraken Express
Hapi
Connect
LoopBack Express
Restify
Geddy
CompoundJS
Flatiron

Source Lines of Code

This is the lines of code a framework uses, not including comments. This is used to gauge complexity and modularity of a framework.

Framework Source Lines of Code Version
Meteor
Express 1,150 4.0.0-rc3
Sails 5,350 0.10.0-rc4
Koa 550 0.5.1
Derby 1,450 0.6.0-alpha3
Kraken 680 0.7.
Hapi 4,750 3.0.0
Connect 120 3.0.0-rc1
LoopBack 10,472 2.8.0
Restify 3,970 2.6.3
Geddy 5,660 0.12.4
CompoundJS 3,010 1.1.13-1
Flatiron 581 0.3.11

Note: sloc is used to calculate the SLOC. Most are simply counted by running sloc lib and lines of source code is used.

Middleware/Plugin Signature

Different frameworks use plugins and middleware differently. Some use objects, others use functions. Some work with node's req and res objects, whereas many others do not.

A framework "supports node" if node's req and res objects are passed to plugins and middleware, and using node's req and res objects is supported.

Framework Signature Supports Node
Meteor ×
Express app.use(function (req, res, next) {})
Sails function(req, res, next)
Koa app.use(function* (next) {}) ×
Derby
Kraken app.use(function (req, res, next) {})
Hapi app.ext('onRequest', function (req, next) {}) ×
Connect app.use(function (req, res, next) {})
LoopBack app.use(function (req, res, next) {})
Restify app.use(function (req, res, next) {})
Geddy this.before(function (req, res) {})
CompoundJS
Flatiron

Error Handling

Error handling in node.js is wonderful! The current solution to catch uncaught exceptions (emitters and streams throwing errors everywhere) is to use domains (unless you listen to every error). If a framework does not handle uncaught exceptions, then domains should probably use domains.

Framework Middleware/Plugin Uncaught Exceptions Handling
Meteor
Express next(err) / app.use(function (err, req, res, next) {}) ×
Sails
Koa try/catch × - Unnecessary with generators
Derby
Kraken next(err) / app.use(function (err, req, res, next) {})
Hapi domains
Connect next(err) / app.use(function (err, req, res, next) {}) ×
LoopBack next(err) / app.use(function (err, req, res, next) {}) x
Restify next(err)
Geddy
CompoundJS
Flatiron

Control Flow

Most frameworks use only node's traditional callbacks for control. As we move towards ES6, we will see frameworks that use generators and promises to avoid callback hell. Any framework without a control flow is assumed to use callbacks unless otherwise specified.

Framework Control Flow
Meteor fibers
Express
Sails
Koa generators - co
Derby
Kraken
Hapi
Connect
LoopBack
Restify
Geddy
CompoundJS
Flatiron

Included Features

If a feature is not included, there is a very good possibility that it can be used via middleware or plugin. Which features a framework includes or does not include is unimportant - its philosophy is.

Framework Content Negotiation Cookie Management Routing View System Body Parsing Multipart Parsing
Meteor
Express
Sails
Koa
Derby
Kraken
Hapi
Connect
LoopBack
Restify
Geddy
CompoundJS
Flatiron
Framework Session Management CSRF Protection Compression File Uploads Basic Authentication
Meteor
Express
Sails
Koa
Derby
Kraken
Hapi
Connect
LoopBack
Restify
Geddy
CompoundJS
Flatiron
  • Content Negotiation - ability to negotiation server response types and the request's acceptable types.
  • Cookie Management - ability to parse cookies as well as set cookies
  • Routing -
  • View System - ability to choose a templating system and render templates by their name
  • Body Parsing - ability to parse urlencoded and json request bodies
  • Multipart Parsing - ability to part multipart request bodies
  • Session Management - ability to provide non-authenticated cookie-based sessions
  • CSRF Protection - built in CSRF protection
  • Compression - built-in gzip and deflate response compression
  • File Uploads - built-in ability to send local files to the client
  • Basic Authentication

Database

Framework Required Databases Recommended Databases Compatible Databases
Meteor MongoDB
Express
Sails MongoDB, MySQL, Postgres
Koa
Derby
Kraken
Hapi
Connect
LoopBack Microsoft SQL Server, MongoDB, MySQL, Oracle, Postgres
Restify
Geddy LevelDB, MongoDB, MySQL, Postgres, Riak, SQLite
CompoundJS
Flatiron

Templating

Framework Required Templating Systems Recommended Templating Systems Compatible Templating Systems
Meteor handlebars
Express consolidate
Sails consolidate
Koa
Derby handlebars-like
Kraken dustjs consolidate
Hapi
Connect
LoopBack consolidate
Restify
Geddy handlebars, EJS, Jade, Swig, mustache
CompoundJS
Flatiron

consolidate means that the framework supports any templating system supported by consolidate.js.

Contributing

When adding a new framework, you must add the simplest metadata such as links, SLOC, stack, and dependencies. Frameworks without a decent amount of stars are not welcomed. Do not spam your brand new framework.

Performance comparisons are not welcomed.

Metadata should be updated for the latest stable versions, including release candidates, but not including alpha or beta versions.

License

The MIT License (MIT)

Copyright (c) 2014 Jonathan Ong me@jongleberry.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A comparison of server-side node frameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published