Stop 05 · Express.js & Web FrameworksTopics · 14/14

Alternative Frameworks (Fastify, NestJS, Koa)

Part of the Backend Developer Roadmap

In short

Express is the most common starting point, but job listings also mention Fastify and NestJS. Knowing what each one is good at helps you pick, and talk about it in interviews.

Other major Node.js web frameworks — Fastify (performance-focused), NestJS (opinionated, Angular-inspired architecture), Koa (minimal, async-first) — each trading off differently against Express.

The mascot thinks while choosing between an auto-rickshaw, a scooter and a bus.

Think of it like this

Auto, scooter or bus

All three get you to college. A scooter is quick and nimble, a bus has fixed stops and room for a big group, an auto is flexible and everywhere. Express, Fastify, NestJS and Koa all serve HTTP; they suit different trips.

Watch it happen

Picking a Node framework

New Node API?
Small or learning
Speed + schemas
Big team app
Express
Koa
Fastify
NestJS

1/4Start from what you're building and who will maintain it.

The big ideas

What you need to know

Same core ideas

Routes, middleware or hooks, request and response. Learn them in Express and they carry over.

Fastify: speed and schemas

Built for low overhead, with schema-based validation and a plugin system.

NestJS: structure

Opinionated layout with decorators like @Controller and @Get. It can run on top of Express or Fastify.

Koa: tiny core

Very small, with async middleware and a single ctx object. You add routing and parsing yourself.

See it in code

Walk through the code

ts
1// Fastify: schema validates the body before your handler runs2import Fastify from "fastify";3const app = Fastify({ logger: true });4 5app.post("/orders", {6  schema: {7    body: {8      type: "object",9      required: ["item", "qty"],10      properties: { item: { type: "string" }, qty: { type: "integer", minimum: 1 } },11    },12  },13}, async (req, reply) => reply.code(201).send(req.body));14 15await app.listen({ port: 3000 });

1/4Create a Fastify app with its built-in logger turned on.

Send qty: 0 and Fastify returns a 400 before your handler is even called. In Express you'd add a library like Zod for that.

Save yourself the pain

Common mistakes

Oops

Jumping to NestJS before understanding plain routing and middleware.

Do this instead

Learn Express first. NestJS makes much more sense when you know what it's organising for you.

Oops

Picking a framework because a benchmark says it's fastest.

Do this instead

For most apps the database is the slow part. Choose by team skills, ecosystem and structure needs.

Your mission

Same API, two frameworks

~40 min

Quick check

What is NestJS's main selling point compared to Express?

Go deeper

  1. 1Read a 'Hello World' comparison across Express, Fastify and NestJS.
  2. 2Understand why NestJS's structure appeals to teams coming from Java/Angular backgrounds.
  3. 3Pick Express first — these are worth exploring once you're comfortable, not before.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge