Which Web Framework Should You Choose in 2020?

Express vs. Koa vs. Hapi vs. Sinatra

While there are dozens, if not hundreds, of web frameworks out there to choose from in 2020, I am only going to focus on minimalist, server-side frameworks, and Express.js, Koa, hapi, and Sinatra in particular.

What is a minimalist, server-side framework?

A server-side framework typically requires the page to be refreshed, and can be written in any language. The opposite of server-side would be client-side, and that includes popular frameworks such as ReactJS, Vue.js, and Angular — frameworks that allow the page to be updated in small chunks, but are limited to JavaScript — the language of the browser.

Photo by Artem Sapegin on Unsplash


  • Creator: TJ Holowaychuk
  • Version: 4.17.1
  • npm weekly downloads: 9.8M
  • github stars: 48.8k

Hello World

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 at http://localhost:${port}`))


Another very important aspect of a web framework is how it deals with separating routes. The following are two simple GET and POST requests to the ‘/hello’ URL using the router bundled with Express:

app.get(‘/hello’, (req, res) => res.send(‘Hello World!’))app.post('/hello', (req, res) => res.send('Got a POST request'))


  • Creator: Express.js team
  • Version: 2.12.0
  • npm weekly downloads: 400k
  • github stars: 29.3k

Hello World

const Koa = require('koa');
const app = new Koa();

app.use(async ctx => {
ctx.body = 'Hello World';



In Koa, routing is a little more complicated than Express and requires using a router middleware to handle the routes:

const route = require('koa-route');

app.use(route.get('/hello', ctx => {
ctx.body = 'Hello World!';


  • Creator: Walmart Labs (Eran Hammer)
  • Version: 19.1.1
  • npm weekly downloads: 200k
  • github stars: 12.4k

hapi was created around the idea that configuration is better than code, that business logic must be isolated from the transport layer, and that native node constructs like buffers and stream should be supported as first class objects.

Another big focus of hapi is code security. The developers are proud to state that “every single line of code you get has been verified” and “hapi is the only leading node framework without any external code dependencies”.

Hello World

'use strict';

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);

process.on('unhandledRejection', (err) => {




The following is how hapi would handle a GET request r] to the root URL:

method: 'GET',
path: '/',
handler: (request, h) => {

return 'Hello World!';


  • Creator: Blake Mizerany
  • Version:
  • github stars: 11k

Hello World

require 'sinatra'

get '/' do
'Hello world!'


The routing in Sinatra is also minimal effort and very human readable.

get '/' do
.. show something ..

post '/' do
.. create something ..

put '/' do
.. replace something ..

patch '/' do
.. modify something ..

delete '/' do
.. annihilate something ..

options '/' do
.. appease something ..

link '/' do
.. affiliate something ..

unlink '/' do
.. separate something ..
Photo by Emily Morter on Unsplash

How do you compare different open source libraries?

There are many different criteria to compare open source libraries against, so how do you know which one’s are more useful than others?

  1. Documentation — A very important criteria is documentation. Good documentation can save precious time and make learning a new framework more bearable and fun rather than tediously searching for answers.
  2. Stable Release This criteria applies less to the frameworks being compared here, but you have to be aware what state an open source library is in. When was the last stable, unstable, or testing release?
  3. Popularity — The more popular a library is, the list of it’s contributors and size of it’s community rise with that. A large community following means it will be easier to find answers to obscure questions as the communities will be more active and knowledgable.
  4. Project Fit — When it comes down to it, none of the other criteria matter if the library simply does not work well with the project being developed. However, this criteria is very subjective and dependant on your project, so it is something that needs be decided for yourself.
Photo by Zach Lucero on Unsplash

Final Comparison



  • Basically the standard for node.js framework middleware
  • Simple, low learning curve and fast development
  • Long list of middleware and easy implementation of it


  • Becomes very complicated for larger applications
  • Requires clear organization to allow maintainability
  • Creator no longer working on it and updates are less frequent



  • Cleaner, more readable async code with no more callbacks
  • Fun and very good user experience
  • Long list of helpful methods while still maintaining tiny footprint


  • Small open source community (but rapidly growing)
  • Not compatible with Express middleware and some node middleware
  • Not a good choice if not willing to spend time building needed middleware



  • Very scalable with it’s plugin-based architecutre
  • Best choice if you prefer configuration over coding features
  • Provides routing, authentication, validation and caching for REST APIs


  • Endpoint creation and refactoring is very manual
  • Developers are locked into using hapi-specific modules and plugins
  • Ample work needs to be done by the developer to extend core functionality

Sinatra (Ruby)


  • Easy to learn and easy to use (minimal effort)
  • Compatible with many other Ruby libraries and Gems
  • Benefits of huge Rails community crossover to Sinatra


  • Does not handle asynchronous workloads very simply
  • Lacks HTML helpers, unlike Ruby on Rails
  • Requires running a threaded Rack-compatible server

Winner: Express.js

For me personally, the winner of which web framework to choose in 2020 is Express.js. The large community and ease of use makes it a clear choice for developers looking to build small-medium sized applications. However, this does not mean this can’t change in a few years. With how quickly software technology advances and the fact that Express is not being updated as frequently anymore, it can be overtaken by something else in a matter of time.

Photo by Joshua Golde on Unsplash


The truth is there isn’t really a real answer to this comparison. The best web framework to use is based on what your already comfortable with as a developer and how well it will work with the project you plan to develop. It’s up to you to make the best decision for yourself.

Photo by sydney Rae on Unsplash

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store