• Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
  • Created over 10 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A comparison of server-side node frameworks

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 [email protected]

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.

More Repositories

1

path-to-regexp

Turn a path string such as `/user/:name` into a regular expression
TypeScript
8,041
star
2

hbs

Express view engine wrapper for Handlebars
JavaScript
1,659
star
3

understanding-csrf

What are CSRF tokens and how do they work?
1,391
star
4

multiparty

A node.js module for parsing multipart-form data requests which supports streams2
JavaScript
1,298
star
5

cookies

Signed and unsigned cookies based on Keygrip
JavaScript
1,283
star
6

send

Streaming static file server with Range and conditional-GET support
JavaScript
791
star
7

router

Simple middleware-style router
JavaScript
404
star
8

csrf

Logic behind CSRF token creation and verification.
JavaScript
294
star
9

finalhandler

Node.js final http responder
JavaScript
215
star
10

parseurl

parse a url with memoization
JavaScript
188
star
11

routington

Trie-based URL Routing
JavaScript
187
star
12

path-match

please use path-to-regexp's `match` function
JavaScript
138
star
13

encodeurl

Encode a URL to a percent-encoded form, excluding already-encoded sequences
JavaScript
34
star
14

resolve-path

Resolve a relative path against a root path with validation
JavaScript
32
star
15

templation

[ON HOLD] an asynchronous, extensible view system
JavaScript
13
star
16

ssl-redirect

redirect users to the SSL version of your app
JavaScript
11
star
17

discussions

http://pillarjs.github.io
7
star
18

qs-strict

[ON HOLD] pillarjs
JavaScript
4
star
19

extend-proto

generic __proto__ injection utility
JavaScript
3
star
20

re2js-legendary

a node v0.10 compatible build of RE2JS
JavaScript
3
star
21

request

Express style request object
JavaScript
2
star
22

.github

2
star
23

views

Node.js view rendering abstraction.
1
star