Introducing the Best 10 Node.js Frameworks for 2019 and 2020
Tags: node, javascript, frameworks
Published: 2019-08-23 11:03:13

---
title: Introducing the Best 10 Node.js Frameworks for 2019 and 2020
published: true
tags: [node, javascript, frameworks]
cover_image: "https://thepracticaldev.s3.amazonaws.com/i/z5j0wnr711voyslzldah.jpg"
canonical_url: https://softwareontheroad.com/nodejs-frameworks/
series: JavaScript on Data
---

**Originally published at [softwareontheroad.com](https://softwareontheroad.com/nodejs-frameworks/)**

I’m so tired of reading articles claiming what is the best node.js framework based on biased opinions or sponsorships _(yes, that’s a thing)_

So here are the top node.js frameworks ranked by daily downloads, the data was taken from npmjs.com itself _(sorry yarn)_.

{% youtube P0Xk8UhawEQ %}


# What is a node.js framework?

# How to choose a node.js framework for my application?

You have to consider mainly 2 things:

1. The scalability and robustness of the framework

2. If the development process is something you feel comfortable working with.

Regardless of scalability and robustness, every node.js web framework is built on top of the `http` module.

Some of these frameworks add too much … and that makes a huge impact on the server’s throughput.

In my opinion, working with a barebone framework like Express.js or Fastify.js is the best when the service you are developing is small in business logic but need to be highly scalable.

By the other hand, if you are developing a medium size application, it’s better to go with a framework that helps you have a clear structure like next.js or loopback.

There is no simple answer to the question, you better have a peek on how to declare API routes on every framework on this list and decide for yourself.

<cta-container type="hire" copy="node"></cta-container>

 

# 10. Adonis

[_Adonis.js_](https://adonisjs.com/) is an MVC (Model-View-Controller) node.js framework capable of building an API Rest with JWT authentication and database access.

## What’s is this framework about?

The good thing is that Adonis.js framework comes with a CLI to create the bootstrap for applications.

```bash
$ npm i -g @adonisjs/cli
$ adonis new adonis-tasks
$ adonis serve --dev
```

The typical Adonis app has an MVC structure, that way you don’t waste time figuring out how you should structure your web server.

Some apps built with adonis can [be found here.](https://madewithadonisjs.com/)

 

# 👉 GET MORE ADVANCED NODE.JS DEVELOPMENT ARTICLES

Join the other 2,000+ savvy node.js developers who get article updates.


[![Email List Form](https://thepracticaldev.s3.amazonaws.com/i/z35fnxzuzl8h3b87xvud.png)](https://softwareontheroad.us20.list-manage.com/subscribe/post?u=337d8675485234c707e63777d&amp;id=14f1331817
)

# 9. Feathers

[_Feather.js_](https://feathersjs.com/) is a node.js framework promise to be a REST and realtime API layer for modern applications.

## See what’s capable of!!

This is all the code you need to set-up your API REST + realtime WebSockets connection thanks to the socket.io plugin

```ts
const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const socketio = require('@feathersjs/socketio');
 
const memory = require('feathers-memory');
 
// Creates an Express compatible Feathers application
const app = express(feathers());
 
// Parse HTTP JSON bodies
app.use(express.json());
// Parse URL-encoded params
app.use(express.urlencoded({ extended: true }));
// Add REST API support
app.configure(express.rest());
// Configure Socket.io real-time APIs
app.configure(socketio());
// Register a messages service with pagination
app.use('/messages', memory({
  paginate: {
    default: 10,
    max: 25
  }
}));
// Register a nicer error handler than the default Express one
app.use(express.errorHandler());
 
// Add any new real-time connection to the `everybody` channel
app.on('connection', connection => app.channel('everybody').join(connection));
// Publish all events to the `everybody` channel
app.publish(data => app.channel('everybody'));
 
// Start the server
app.listen(3030).on('listening', () =>
  console.log('Feathers server listening on localhost:3030')
);
```

Pretty sweet right?

Here are some apps [built with feathers.js.](https://github.com/feathersjs/awesome-feathersjs#projects-using-feathers)

 

# 8. Sails

_[Sails.js](https://sailsjs.com/) Ye’ olde node.js framework_

With 7 years of maturity, this is a battle-tested node.js web framework that you should definitively check out!

## See it in action

Sails.js comes with a CLI tool to help you get started in just 4 steps

```bash
$ npm install sails -g
$ sails new test-project
$ cd test-project
$ sails lift 
```

 

# 7. Loopback

Backed by IBM, [Loopback.io](https://loopback.io) is an enterprise-grade node.js framework, used by companies such as GoDaddy, Symantec, IBM itself. 

They even offer Long-Term Support (LTS) for 18 months! 

This framework comes with a CLI tool to scaffold your node.js server

```bash
$ npm i -g @loopback/cli

```

Then to create a project

```bash
$ lb4 app
```

Here is what an API route and controller looks like:

```js
import {get} from '@loopback/rest';

export class HelloController {
  @get('/hello')
  hello(): string {
    return 'Hello world!';
  }
}
```

# 6. Fastify

[Fastify.io](https://www.fastify.io) is a node.js framework that is designed to be the replacement of express.js [with a 65% better performance](https://www.fastify.io/benchmarks/).

## Show me the code

```ts
// Require the framework and instantiate it
const fastify = require('fastify')({
  logger: true
})

// Declare a route
fastify.get('/', (request, reply) => {
  reply.send({ hello: 'world' })
})

// Run the server!
fastify.listen(3000, (err, address) => {
  if (err) throw err
  fastify.log.info(`server listening on ${address}`)
})
```

And that’s it!

I love the simplicity and reminiscence to Express.js of Fastify.js, definitively is the framework to go if performance is an issue in your server.

 

# 5. Restify

[Restify](http://restify.com/) claims to be the future of Node.js Web Frameworks.

This framework is used in production by NPM, Netflix, Pinterest and Napster.

## Code example

Setting up a Restify.js server is just as simple as this

```ts
const restify = require('restify');

function respond(req, res, next) {
  res.send('hello ' + req.params.name);
  next();
}

const server = restify.createServer();
server.get('/hello/:name', respond);
server.head('/hello/:name', respond);

server.listen(8080, function() {
  console.log('%s listening at %s', server.name, server.url);
});
```

 
# 👉 GET MORE ADVANCED NODE.JS DEVELOPMENT ARTICLES

Join the other 2,000+ savvy node.js developers who get article updates.


[![Email List Form](https://thepracticaldev.s3.amazonaws.com/i/z35fnxzuzl8h3b87xvud.png)](https://softwareontheroad.us20.list-manage.com/subscribe/post?u=337d8675485234c707e63777d&amp;id=14f1331817
)

# 4. Nest.js

A relatively new node.js framework, [Nest.js](https://nestjs.com) has a similar architecture to Angular.io, so if you are familiar with that frontend framework, you'll find this one pretty easy to develop as well.

## Example

```ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setViewEngine('hbs');
  await app.listen(3000);
}
bootstrap();
```

 

# 3. Hapi

One of the big 3 node.js frameworks, [hapi.js](https://hapi.dev) has an ecosystem of libraries and plugins that makes the framework highly customizable.

Although I never used hapi.js on production, I’ve been using its validation library Joi.js for years.

## Creating a server

A hapi.js webserver looks like this

```ts
const Hapi = require('@hapi/hapi');

const init = async () => {

  const server = Hapi.server({
      port: 3000,
      host: 'localhost'
  });

  await server.start();
  console.log('Server running on %s', server.info.uri);
};

init();
```

 

# 2. Koa

[Koa](https://koajs.com) is a web framework designed by the team behind Express.js the most famous and used node.js framework.

Koa aims to be a smaller, more expressive, and more robust foundation for web applications and APIs than express.js.

Through leveraging generators Koa allows you to ditch callbacks and greatly increase error-handling.

Koa does not bundle any middleware within the core and provides an elegant suite of methods that make writing servers fast and enjoyable.

## Example

```ts
const Koa = require('koa'); 
const app = new Koa(); 
app.use(async ctx => { 
  ctx.body = 'Hello World'; 
}); 
app.listen(3000);
```

 

# 1. Express

[Express.js](https://expressjs.com) is definitively the king of node.js frameworks, will reach the incredible mark of 2 million daily downloads by the end of 2019.

Despite being such an old framework, Express.js is actively maintained by the community and is used by big companies such as User, Mulesoft, IBM, and so on.

## Example

Just add it to your node.js project

`$ npm install express`

Then declare some API routes

```ts
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening on port ${port}!`))
```

And that’s all you need to start using it!
 

# Conclusion

There are tons of node.js frameworks out there, the best you can do is go and try them all ‘til you find the ones that suit your needs.

Personally, I prefer Express.js because, through these 6 years of node.js development, I build a strong knowledge of good architectural patterns, all based on trial and error.

But that doesn’t mean you have to do the same, here is all the secrets of a good express.js framework project.

{% link santypk4/bulletproof-node-js-project-architecture-4epf %}

## Now tell me, what is your favorite node.js framework?

Send me a tweet to [@santypk4](https://twitter.com/santypk4), come on! I want to know what the people are using, I don’t want to fall behind!



# 👉 GET MORE ADVANCED NODE.JS DEVELOPMENT ARTICLES

Join the other 2,000+ savvy node.js developers who get article updates.


[![Email List Form](https://thepracticaldev.s3.amazonaws.com/i/z35fnxzuzl8h3b87xvud.png)](https://softwareontheroad.us20.list-manage.com/subscribe/post?u=337d8675485234c707e63777d&amp;id=14f1331817
)