Express

Express is the most widely deployed Node.js web framework, providing a minimal, unopinionated layer of routing, middleware, and HTTP utilities on top of the built-in http module. Express defined the middleware pattern that nearly every Node web framework since has adopted.

Core concepts

  • Routes. Map HTTP methods and URL paths to handler functions.
  • Middleware. Functions of the form (req, res, next) => void that compose into a request pipeline.
  • Request and response. Augmented Node.js objects with helpers like res.json(), req.params, req.body.
  • Routers. Modular sub-applications mounted on path prefixes.

Common middleware

  • express.json(), express.urlencoded() for body parsing
  • cors, helmet, compression for security and performance
  • morgan, pino-http for request logging
  • express-rate-limit, express-validator for protection and validation

Alternatives

  • Fastify. Higher throughput, schema-driven, growing share.
  • Koa. Modern async-first design from the Express authors.
  • NestJS. Opinionated, Angular-inspired structure on top of Express or Fastify.
  • Hono. Edge-first, runs on Bun, Deno, Cloudflare Workers, Node.
🔗

Subscribe to Sahil's Playbook

Clear thinking on product, engineering, and building at scale. No noise. One email when there's something worth sharing.
[email protected]
Subscribe
Mastodon