ScriptsApr 12, 2026·2 min read

Express — Fast Unopinionated Minimalist Web Framework for Node.js

Express is the original, most popular web framework for Node.js. Minimal, flexible, and the foundation of countless APIs. The go-to starting point for Node.js backends that inspired Koa, Hono, Fastify, and many others.

TL;DR
Express is the minimal, flexible Node.js web framework that inspired Koa, Hono, Fastify, and remains the go-to starting point for backends.
§01

What it is

Express is the original and most popular web framework for Node.js. It provides a minimal, unopinionated foundation for building web applications and APIs. Express handles routing, middleware composition, request/response processing, and template rendering.

Express inspired an entire generation of Node.js frameworks including Koa, Hono, Fastify, and NestJS. Despite newer alternatives, it remains the most widely used Node.js backend framework.

§02

How it saves time or tokens

Express reduces the boilerplate of raw Node.js HTTP servers to a few lines. Its middleware pattern lets you compose authentication, logging, CORS, body parsing, and error handling as reusable functions. The massive npm ecosystem means most common tasks have an Express middleware already built.

For AI code generation, Express is the most well-represented Node.js framework in training data. LLMs produce accurate Express code more reliably than for newer, less documented alternatives.

§03

How to use

  1. Initialize a project and install Express:
mkdir my-api && cd my-api
npm init -y
npm install express
  1. Create a basic server:
const express = require('express');
const app = express();

app.use(express.json());

app.get('/api/health', (req, res) => {
  res.json({ status: 'ok' });
});

app.post('/api/users', (req, res) => {
  const { name, email } = req.body;
  res.status(201).json({ id: 1, name, email });
});

app.listen(3000, () => console.log('Server running on port 3000'));
  1. Add middleware for authentication, logging, or validation as needed.
  1. Deploy with PM2, Docker, or any Node.js hosting platform.
§04

Example

// Express middleware pattern
const authMiddleware = (req, res, next) => {
  const token = req.headers.authorization;
  if (!token) return res.status(401).json({ error: 'Unauthorized' });
  req.userId = verifyToken(token);
  next();
};

app.get('/api/profile', authMiddleware, (req, res) => {
  res.json({ userId: req.userId });
});
§05

Related on TokRepo

§06

Common pitfalls

  • Not handling async errors. Express 4 does not catch promise rejections in route handlers. Either use express-async-errors or wrap handlers in try-catch. Express 5 fixes this.
  • Blocking the event loop with synchronous operations. Heavy computation in Express route handlers blocks all other requests. Use worker threads or offload to a queue.
  • Using Express for real-time features without WebSocket support. Express handles HTTP only. For WebSocket, add socket.io or ws on top.
  • Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.

Frequently Asked Questions

Is Express still relevant in 2026?+

Yes. Express remains the most downloaded Node.js framework on npm. While newer frameworks like Fastify and Hono offer better performance and TypeScript support, Express has the largest ecosystem, most tutorials, and broadest community. It is a safe choice for most projects.

How does Express compare to Fastify?+

Fastify is faster than Express in benchmarks due to its schema-based validation and optimized routing. Fastify also has better TypeScript support and built-in JSON schema validation. Express is simpler, has more middleware available, and is better supported by AI code generation tools.

Does Express support TypeScript?+

Express works with TypeScript via @types/express. However, its middleware typing is less ergonomic than purpose-built TypeScript frameworks like Hono or tRPC. For type-safe Express development, use the types package and define typed request/response interfaces.

What is the Express middleware pattern?+

Middleware functions in Express have access to the request, response, and next function. They can modify the request/response, end the cycle, or call next() to pass control to the next middleware. This composable pattern is Express's core architecture.

Should I use Express for new projects?+

For simple REST APIs and prototypes, Express is a solid choice due to its simplicity and ecosystem. For high-performance APIs, consider Fastify. For full-stack TypeScript apps, consider NestJS or Hono. Express is best when you want minimal opinions and maximum flexibility.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets