Node.js Web Frameworks

Posted 23 January 2018


Express

Website GitHub

Install: npm install express --save

Express is a minimal framework for developing Node.js web applications. Many of the other frameworks in this list are based on Express with additional useful features to help speed up development or apply a design pattern to aid maintainability. Express is unopinionated and the go to option for a Node.js webserver.

Two of the main concepts required for developing Express-based applications is routing and middleware. Express request handlers are JavaScript functions that accept 2 or more arguments: req = Request, res = Response, and next = function to call next middleware. Which request handler is called is determined by the routes registered to the router and the URL of the request.

Express also supports a range of template engines out of the box, including Pug, Mustache, and EJS which support features like partial templates, variable interpolation and conditional branching within HTML templates.

The express-generator package allows for quick generation of a skeleton Express application via a command line interface (CLI).

Loopback

Website GitHub

Install: npm install -g loopback-cli

Loopback is a framework based on Express for rapidly building REST APIs. Development is maintained by IBM and integration with IBM Connect is provided.

Loopback has a command line interface for creating models, relations, and access control rules reducing time setting up boilerplate code. There's also an web-based API explorer that allows you to view and test your REST API routes.

It can also support a range of popular database management systems via database connectors.

A comparison of Loopback vs other frameworks

Sails.js

Website GitHub

Install: npm install -g sails

Sails is a framework based on Express implementing a Model-View-Controller (MVC) design pattern similar to Ruby on Rails.

Sails uses an ORM called Waterline for defining database models which supports a range of database connectors.

Blueprints allow for rapid development of REST APIs by generating common CRUD methods.

Nest

Website GitHub

Install: git clone https://github.com/nestjs/typescript-starter.git <project-name>

Nest is a framework based on Express that implements a very similar architecture to an Angular application, including support for TypeScript.

hapi.js

Website GitHub

hapi.js is a web application framework that handles requests and routing similar to Express. There are also a range of community plugins for handling common web application requirements such as authentication, authorization, and templating.


Thanks for reading

I'm Alex O'Callaghan and this is my personal website where I write about software development and do my best to learn in public. I currently work at Mintel as a Principal Engineer working primarily with React, TypeScript & Python.

I've been leading one of our platform teams, first as an Engineering Manager and now as a Principal Engineer, maintaining a collection of shared libraries, services and a micro-frontend architecture.