Category: nodejs
express js alternatives
Published on 19 May 2026
Explanation
Koa is a lightweight Node.js framework
created by the Express team. It
provides better async/await support and
cleaner middleware handling.
Code:
const Koa = require('koa');
const app = new Koa();
app.use(async ctx => {
ctx.body = 'Hello from Koa';
});
app.listen(3000);
Explanation
Fastify is a high-performance Node.js
framework
designed for speed and low overhead.
Code:
const fastify = require('fastify')();
fastify.get('/', async (request, reply) => {
return { message: 'Hello from Fastify' };
});
fastify.listen({ port: 3000 });
Explanation
NestJS is a scalable backend framework
built with TypeScript and inspired by
Angular architecture.
Code:
@Controller()
export class AppController {
@Get()
getHello(): string {
return 'Hello from NestJS';
}
}
Explanation
Hapi is a powerful Node.js framework
focused on configuration-driven
development and security.
Code:
const Hapi = require('@hapi/hapi');
const init = async () => {
const server = Hapi.server({
port: 3000,
host: 'localhost'
});
server.route({
method: 'GET',
path: '/',
handler: () => 'Hello from Hapi'
});
await server.start();
};
init();
Explanation
Sails.js is an MVC framework for
building data-driven APIs and
real-time applications.
Code:
module.exports.routes = {
'/': {
view: 'pages/homepage'
}
};
Explanation
AdonisJS is a full-featured Node.js MVC
framework with authentication, ORM,
and validation support.
Code:
Route.get('/', async () => {
return 'Hello from AdonisJS';
});
Explanation
Restify is a Node.js framework optimized
for building REST APIs.
Code:
const restify = require('restify');
const server = restify.createServer();
server.get('/', (req, res, next) => {
res.send('Hello from Restify');
next();
});
server.listen(3000);
Explanation
LoopBack is a Node.js framework for
quickly creating APIs connected to databases.
Code:
module.exports = function(app) {
app.get('/', function(req, res) {
res.send('Hello from LoopBack');
});
};