Express: Minimalist Web Framework for Node.js
GitHub Repo
MIT
November 16, 2026 at 01:54 PM
0 views

Express: Minimalist Web Framework for Node.js

@expressjsProject Author

What Express is

Express is the long-running minimalist web framework for Node.js. Its README sums it up in one line, "Fast, unopinionated, minimalist web framework for Node.js", and its philosophy section explains the scope: "small, robust tooling for HTTP servers", suited to "single page applications, websites, hybrids, or public HTTP APIs". It does not pick an ORM, a template engine, an authentication scheme or a project layout. The FAQ on the documentation site is blunt about this: "Express has no notion of a database", authentication is "another opinionated area that Express does not venture into", and there is "no definitive answer" to how an application should be structured.

What Express does provide is a router, a middleware pipeline, thin helpers on top of Node's own request and response objects, a view system, content negotiation and a handful of built-in body parsers and a static file server. The hello-world guide stresses that req and res "are the exact same objects that Node provides", so anything that works on a raw http.IncomingMessage or http.ServerResponse still works inside an Express handler.

The repository, expressjs/express, was created on 26 June 2009 and is MIT-licensed. The LICENSE file carries copyright lines for TJ Holowaychuk (2009-2014), Roman Shtylman and Douglas Christopher Wilson, and the README credits TJ Holowaychuk as the original author. The project is now run by a Technical Committee of eight people listed in the README, with a separate group of triagers, and governance is documented in the expressjs/discussions repository. The current major line is Express 5, which reached 5.0.0 in September 2024 according to the npm registry; the 4.x line is still published under the latest-4 tag.

How it works: middleware, routes and the request cycle

The middleware stack

An Express application is an ordered list of functions. Each one receives (req, res, next) and either ends the response or calls next() to hand control to the following function. The middleware guide splits these into application-level middleware (bound with app.use() and app.METHOD()), router-level middleware (bound to an express.Router() instance), error-handling middleware, built-in middleware and third-party middleware. Calling next('route') skips the remaining callbacks of the current route, which the routing guide suggests for imposing preconditions on a route; passing anything else to next() marks the request as an error and jumps to error handlers.

Routing and path matching

Routes combine an HTTP method with a path. The routing guide states that Express 5 uses path-to-regexp v8 to match route strings (the install in the hands-on section pulled in path-to-regexp 8.4.2 through the separate router package, version 2.2.0). Paths can be strings with named parameters (/users/:id), named wildcards (/*splat), optional segments in braces (/:file{.:ext}) or regular expressions. app.route() chains several methods on one path, and express.Router builds mountable sub-applications so routes can live in separate modules.

Errors

Error handlers are middleware with four arguments, (err, req, res, next), and must be registered after the routes they cover. If none handles an error, the built-in handler writes it to the client: the error-handling guide says the status comes from err.status or err.statusCode (clamped to 500 if outside 4xx/5xx), headers from err.headers, and the body is the stack trace outside production and a plain status message when NODE_ENV is production. Since Express 5, a handler that returns a rejected promise, including any async function that throws, is forwarded to next(err) automatically. The guide still describes the cases that need manual work: callback APIs such as fs.readFile, promise chains that are not returned, and timers. A 404 is not an error in Express; the FAQ recommends a final catch-all middleware for it.

Built-in middleware

Five middleware functions ship in the package: express.static for files, and express.json, express.raw, express.text and express.urlencoded for request bodies. Everything else, from sessions and CORS to compression and security headers, comes from separate packages in the expressjs organisation or from third parties. The production security guide, for instance, recommends Helmet for response headers rather than building that into the core.

Key features in Express 5

  • Async handlers without wrappers. Rejected promises and thrown errors in async middleware reach error handlers, so the .catch(next) boilerplate common in 4.x code is no longer needed for returned promises.
  • Stricter path syntax. Wildcards must be named (/*splat), the ? optional marker is replaced by braces, regexp characters inside strings are rejected, and the characters ()[]?+! are reserved. Wildcard parameters now arrive as arrays of segments.
  • Safer defaults. The default query parser changed from "extended" to "simple", express.urlencoded defaults to extended: false, and express.static ignores dotfiles, including files inside dot-directories such as .well-known, unless dotfiles: 'allow' is set.
  • Removed legacy signatures. app.del(), req.param(), res.sendfile(), the pluralisation-less req.acceptsCharset() family, and argument orders like res.json(obj, status) and res.redirect(url, status) are gone; the magic string 'back' in res.redirect() is no longer supported.
  • Codemods for migration. The migration guide links an @expressjs/v5-migration-recipe codemod that bundles individual transforms such as route-del-to-delete, status-send-order, redirect-arg-order and static-dotfiles.
  • Listen errors go to the callback. app.listen now passes server errors such as EADDRINUSE to the user callback instead of throwing.
  • Brotli request bodies. The body parsers accept Content-Encoding: br in addition to gzip and deflate.
  • QUERY method freshness (5.3.0). The 5.3.0 changelog adds conditional revalidation for the HTTP QUERY method, so app.query() routes can answer 304 to a matching If-None-Match.
  • TypeScript through DefinitelyTyped. The installing guide says Express "does not bundle its own type definitions" and points to @types/express; with Node 22.18 or later it shows running .ts files directly with type stripping.
  • View engines and helpers. The README lists a view system "supporting 14+ template engines", content negotiation, HTTP helpers for redirection and caching, and an application generator.

Getting started

The README requires Node.js 18 or higher, and package.json declares "node": ">= 18". In a project that already has a package.json, install from npm:

npm install express

The README's hello world uses ES module syntax:

import express from 'express'

const app = express()

app.get('/', (req, res) => {
  res.send('Hello World')
})

app.listen(3000, () => {
  console.log('Server is running on http://localhost:3000')
})

For TypeScript, the installing guide adds the community type packages as development dependencies:

npm install --save-dev typescript @types/express @types/node

Existing 4.x projects upgrade by pinning the new major, then running the codemod bundle from the migration guide and the test suite:

npm install "express@5"
npx codemod@latest @expressjs/v5-migration-recipe

The README's quick start still uses the separate generator, pinned to major 4, with the note that "the executable's major version will match Express's":

npm install -g express-generator@4
express /tmp/foo && cd /tmp/foo
npm start

For a production deployment the security guide's first concrete step after TLS and input validation is Helmet:

npm install helmet

Hands-on: Express 5.3.0 next to 4.22.3 on Node 22

To see how much of the migration guide shows up in practice, the same test application was installed against both major lines on a 2 vCPU Linux VM with Node.js 22.23.4 and npm 10.9.9 on 16 November 2026. npm install express resolved to 5.3.0 (the registry's latest tag, published 9 October 2026) and npm install express@4 to 4.22.3 (latest-4, published 14 September 2026). Neither install reported vulnerabilities from npm audit.

Install footprint

Measureexpress 5.3.0express 4.22.3
Packages added6568
node_modules size (du -sh)4.4 MB4.5 MB
Direct dependencies declared28not counted
Install time, warm npm cache (npm's own report)517 ms932 ms
require('express'), cold process38-40 ms39-43 ms
Body parser / query parser resolvedbody-parser 2.4.0, qs 6.17.1body-parser 1.20.9, qs 6.16.2
Path matcherpath-to-regexp 8.4.2 (via router 2.2.0)path-to-regexp 0.1.13

The registry lists the 5.3.0 tarball at 76,638 bytes unpacked in 10 files; almost all of the 4.4 MB is the dependency tree. The first cold install, including npm start-up and registry fetches, took about 3.0 seconds of wall time.

Behaviour differences

One script registered a set of routes covering the points the migration guide calls out, then curl exercised each route. The same file ran unchanged against both versions; route registrations were wrapped in try/catch so that a rejected pattern would be logged rather than stop the process.

Testexpress 5.3.0express 4.22.3
async handler throws an error with status: 404Custom error middleware ran; response 404 {"handled":true,...}Request hung until curl's 3 s timeout; an unhandledRejection listener fired
Same, with no unhandledRejection listener500 from the error middleware, server kept runningFirst request killed the process (exit code 1, Error: async boom); the second request got no connection
Register /files/*Throws at startup: PathError: Missing parameter name at index 8Registered; GET /files/a/b.txt gave {"0":"a/b.txt"}
Register /files/*splatGET /files/a/b.txt gave {"splat":["a","b.txt"]}Registered without error
Register /img/:file.:ext?Throws: PathError: Unexpected ? at index 15GET /img/photo gave {"file":"photo"}
Register /doc/:file{.:ext}/doc/photo gave {"file":"photo"}; /doc/photo.png added "ext":"png"Registered, but both URLs returned 404
GET /q?a[b]=1&c=2, then req.query = {x:1}Simple parser: {"a[b]":"1","c":"2"}; the assignment was silently ignoredAssignment replaced the object: {"x":1}
res.status(99)Error: "Invalid status code: 99. Status code must be greater than 99 and less than 1000."Error: "Invalid status code: 99"
express.static serving /.well-known/assetlinks.json404200
QUERY /reports with matching If-None-Match304304
Second app.listen on a busy portCallback received an error with code EADDRINUSEUncaught Error: listen EADDRINUSE: address already in use 0.0.0.0:3005, process exited
JSON POST to a route without a body parserreq.body was undefinedreq.body was undefined

Three practical points came out of this. First, the async change matters more than it looks: on Node 22 an unhandled rejection terminates the process by default, so a single throwing async route in a 4.x app without wrappers took the whole server down, while 5.x routed the same error to the error handler. Second, the path syntax change fails loudly at startup, which is the useful kind of break, but the express.static dotfile change fails quietly at request time: anything served from .well-known (ACME challenges, Android App Links, Apple Universal Links) simply starts returning 404 until dotfiles: 'allow' is added for that path. Third, assigning to req.query in 5.x does not throw in non-strict CommonJS code; it is a no-op, so code that rewrote the query object keeps running but silently reads the original values.

Two results did not match expectations from the docs. The migration guide says req.body was {} by default in Express 4, but 4.22.3 returned undefined on a route with no parser in this test. And the QUERY freshness change is listed under 5.3.0 in History.md, yet 4.22.3 also answered 304, and its lib/request.js contains the same 'QUERY' check, so the change appears to have been applied to the 4.x line too.

A local throughput check

The README lists "focus on high performance" as a feature, and Fastify's README publishes a hello-world benchmark in which Express 4.17.3 handles 14,200 requests per second against 77,193 for Fastify 4.0.0 on its test machine. To see whether the gap still looks similar with current versions, each server below returned {"hello":"world"} as JSON and was hit with autocannon 9.0.0 using -c 100 -d 10, twice per server. This is a single-machine measurement on 2 vCPUs, with the load generator and the server competing for the same cores, so the absolute numbers say little about production capacity; the ratios are the interesting part.

Server (local, 16 Nov 2026)Run 1 req/sRun 2 req/sp50 / p99 latency
Plain node:http (Node 22.23.4)84,21987,3330 ms / 3 ms
Fastify 5.12.876,65473,8211 ms / 3 ms
Koa 3.3.045,56646,7952 ms / 4-5 ms
Express 4.22.315,80114,8285 ms / 17-20 ms
Express 5.3.013,75912,8875-6 ms / 17 ms

No run produced errors or non-2xx responses. In this setup Express 5.3.0 handled roughly 15% of the plain node:http rate and was slightly behind 4.22.3. For most applications the framework's per-request overhead (a few milliseconds here) is small next to database and network time, but for a service that mostly returns small cached payloads at high volume the difference is real and worth benchmarking against the actual workload, which is exactly what Fastify's README also advises.

How Express compares

The table sets Express next to two other Node.js frameworks it is often weighed against, a multi-runtime option, and two non-JavaScript frameworks with similar routing styles. Facts come from each project's README and registry entry; the throughput column is only the local test above.

FrameworkLanguage / runtimeProgramming modelValidation and extras in coreLicenceLocal hello-world req/s
Express 5.3.0JavaScript on Node.js 18+(req, res, next) middleware on Node's own objectsNone built in; body parsers and static files onlyMITabout 13,000
Fastify 5.12.8JavaScript / TypeScript on Node.jsPlugins, hooks and decorators; README says it is "inspired by Hapi and Express"JSON Schema validation and serialisation, Pino loggingMITabout 74,000-77,000
Koa 3.3.0JavaScript on Node.js 18+Async (ctx, next) middleware flowing down and back upNone; README says Koa "is not bundled with any middleware"MITabout 46,000
Hono 4.13.19TypeScript on Web Standards: Node.js, Deno, Bun, Cloudflare Workers, Lambda and others(c) context handlers returning responsesBuilt-in middleware; README says zero dependenciesMITnot tested
GinGoMartini-like API on httprouter; the README describes its routing as "Express.js-style"Recovery middleware, routing groupsMITnot tested
FastAPIPythonHandlers typed with Python type hints, on Starlette and PydanticValidation and docs generated from type hintsMITnot tested

The choice inside Node.js usually comes down to ecosystem versus built-in structure and speed. Express has the oldest and broadest middleware ecosystem and the smallest conceptual surface; Fastify trades some of that simplicity for schemas, an encapsulated plugin system and much lower overhead in the test above; Koa keeps a similar minimalism with a cleaner async model but a different ctx API, so Express middleware does not drop in. Hono targets code that has to run on edge runtimes and on Bun or Deno as well as Node. Teams not tied to JavaScript sometimes compare against Gin or FastAPI on language grounds rather than framework features.

Running Express in production

The documentation site's production guides fill in what the minimalist core leaves out. Points worth knowing before deploying:

  • Set NODE_ENV=production. The performance guide says this makes Express cache view templates, cache CSS generated from CSS extensions and produce less verbose error messages, and it links tests claiming a threefold improvement from this alone. The default error handler also stops sending stack traces.
  • Terminate TLS and compress at a proxy. The security guide recommends Nginx for TLS and the performance guide recommends compression at the reverse proxy for high-traffic sites; reverse proxies such as Caddy or Traefik fill the same role. Behind any proxy, the trust proxy setting controls whether req.ip, req.protocol and req.hostname read X-Forwarded-* headers; the default is false, and the proxies guide warns that the setting must match how the proxy actually behaves.
  • Use the init system and cluster across cores. The performance guide recommends systemd over process managers for restarts, and Node's cluster module or PM2 cluster mode for multi-core use, with shared state in a store such as Redis because workers do not share memory.
  • Validate input yourself. The security guide gives an open-redirect example and says responsibility for validating user input "is yours". The organisation's security policy goes further with a threat model that treats prototype pollution from unsanitised input, misconfigured static serving and third-party dependency issues as application concerns, outside Express's own security scope.
  • Report vulnerabilities privately. Reports go through GitHub Security Advisories or [email protected], with acknowledgement within 48 hours for email reports according to the policy.

Limits and when not to use it

  • Raw throughput. In the local test Express served about a sixth of the requests of Fastify or plain node:http for a trivial JSON route. If per-request framework overhead dominates the budget, measure first or start with a lower-overhead framework.
  • No built-in validation, schema or API docs. Request validation, response serialisation and OpenAPI generation all come from separate packages. Projects that want those decided up front may be better served by Fastify or, outside Node, FastAPI.
  • Node-specific. Express sits on Node's http objects. Code that must also run on Cloudflare Workers or other Web Standards runtimes needs something like Hono instead.
  • Types are third-party. TypeScript support depends on the DefinitelyTyped @types/express package rather than types shipped with the framework, and some middleware needs its own @types package as well.
  • Upgrades from 4.x are not free. Route strings with unnamed wildcards or ? stop the app at startup, and dotfile and query-parser defaults change behaviour silently. MIME types from mime-db can also change in minor releases, which the migration guide says are not treated as breaking changes.
  • Uneven tooling around the edges. The README's quick start still pins express-generator@4, and the router's debug namespace moved from express:router to router in 5.x, which can confuse existing logging setups.
  • Support window. The version support page says only the latest release of each major line is supported. Both 5.x and 4.x are listed as "ongoing", while 3.x and earlier are end-of-life; the page points to HeroDevs for paid support of versions that cannot be upgraded.

Recent releases

Per History.md, 5.1.0 (31 March 2025 on npm) removed several small dependencies and added Uint8Array support in res.send(). 5.2.0 and 5.2.1 (1 December 2025) first shipped and then reverted a query-parser change tied to CVE-2024-51999, which the changelog says was rejected as not a real vulnerability. 5.3.0 (9 October 2026) fixed a Content-Length and Transfer-Encoding conflict in res.send(), upgraded qs, proxy-addr and body-parser for several listed CVEs (including a fail-open request size limit when the body-parser limit option was invalid), made the default error handler log the full error object including Error.cause, and changed res.attachment() and related methods to stop quoting file names that are valid HTTP tokens. Tests that assert on exact Content-Disposition bytes will need updating after that upgrade.

Project activity

Checked 16 November 2026: latest release 5.3.0 (published to npm on 9 October 2026; the 4.x line is at 4.22.3 from 14 September 2026), MIT licence, about 69,600 stars on the expressjs/express repository, with about 25,500 forks and a last push on 2 November 2026. The project is written in JavaScript, was created on 26 June 2009 and develops on the master branch. Release notes are in History.md. Documentation lives at expressjs.com, whose sources (Astro and MDX, content under a CC BY 4.0 licence) are in the expressjs.com repository. Discussion happens in the expressjs/discussions repository, and the project takes funding through Open Collective.

Enjoying this project?

Discover more amazing open-source projects on TechLogHub. We curate the best developer tools and projects.

Project
express-nodejs-web-framework
Created
November 16
Last Updated
November 16, 2026 at 01:54 PM

Maintain Express: Minimalist Web Framework for Node.js? Add the badge to your README

Show that the project is featured on TechLogHub and send readers to this write-up.

Featured on TechLogHub
[![Featured on TechLogHub](https://techloghub.com/badge-neutral.svg)](https://techloghub.com/open-source/express-nodejs-web-framework?utm_source=techloghub_badge&utm_medium=referral&utm_campaign=readme)

Find more projects like this

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.