Skip to content
abedmurrarPublic
forked from expressjs/express

About

Fast, unopinionated, minimalist web framework for node.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

6,424 Commits

Folders and files

Repository files navigation

A fork of Express

CI Benchmark

This is a fork of Express, the web framework for Node.js, maintained at https://github.com/abedmurrar/express. It is not the official Express project, and it isn't published to npm yet.

The master branch is a drop-in replacement for Express 5.3.0 on Node.js 22, 24 and 26. It gives the same responses byte for byte, except for bug fixes. Community middleware written for Express keeps working unchanged. Breaking changes go to a separate 6.x line.

const express = require('express')
const app = express()

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

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

What's different from Express 5.3.0

The full plan, with a decision for every open upstream issue and pull request, is in ROADMAP.md. The research behind it is in research/. So far:

  • Proof that nothing changes by accident. Every change runs through:
    • a differential check that sends the same requests to this fork and to Express 5.3.0 and requires identical responses;
    • the same check with popular middleware (body-parser, cors, helmet, morgan, cookie-parser, express-session, compression, multer, passport, express-rate-limit);
    • a fuzzer that builds random apps and requests and runs that check on each, and property tests that check query parsing, routing, content negotiation, cookies, ranges, ETags and freshness on random inputs;
    • a 100% coverage gate.
  • Regression tests for 21 confirmed bugs, which stay skipped until each fix lands.
  • A security test suite that checks auth guards against path tricks (case, slashes, encoding, RegExp paths), header injection, redirect targets, prototype pollution and path traversal. Each check was shown to fail when its guard is broken on purpose.
  • A benchmark on every PR against Express 5.3.0, Fastify, Koa, Hono, polka and plain node:http. It runs in CI, and the results are in benchmarks/results.
  • Our own copies of router and send (see VENDORED.md), so routing and file-sending bugs can be fixed here.
  • Leaner tooling: Biome for linting and formatting, c8 for coverage, and fewer installed packages.
  • Built-in TypeScript types and an ES module entry (see TypeScript and ES modules), checked by type tests and attw.

Coming next: bug fixes, speed-ups and strict TypeScript, all on the drop-in line. See ROADMAP.md.

Installation

Node.js 22, 24 or 26 is required. Older versions are not supported.

The fork isn't on npm yet. To try it, install it from GitHub:

npm install github:abedmurrar/express

It installs under the name express, so require('express') keeps working.

TypeScript and ES modules

The package ships its own TypeScript types, so you don't need @types/express:

npm uninstall @types/express @types/express-serve-static-core
npm install --save-dev typescript @types/node

The types are ported from @types/express 5.0.6 and @types/express-serve-static-core 5.1.3, so code written for them compiles unchanged: the same names (Request<P, ResBody, ReqBody, ReqQuery, Locals>, Response, NextFunction, RequestHandler, ErrorRequestHandler, Router, Application, Express and the rest), route parameters inferred from the path, and the global Express namespace that middleware such as passport (req.user) and multer (req.file) add to.

import express, { type Request, type Response } from 'express'

const app = express()

app.get('/users/:id', (req, res) => {
  res.json({ id: req.params.id }) // req.params.id is a string
})

app.use((err: Error, req: Request, res: Response, next: express.NextFunction) => {
  res.status(500).json({ error: err.message })
})

Imports from express-serve-static-core keep working while another @types package still installs it, and its types mix with these. To use these types everywhere instead, map the module in tsconfig.json:

{
  "compilerOptions": {
    "paths": { "express-serve-static-core": ["./node_modules/express/typings/core.d.ts"] }
  }
}

The names apps import from there (ParamsDictionary, Query, RouteParameters, PathParams and the like) can also come from express itself.

For ES modules, import express, { Router, json, static as serveStatic } from 'express' loads index.mjs, a thin wrapper over the CommonJS build: import and require give the same objects, so there is only one copy of Express. require('express') and its export shape are unchanged from Express 5.3.0.

Documentation

The fork's docs site is https://abedmurrar.github.io/express/. It has the Express 5 documentation from expressjs.com (used under CC BY 4.0, with credit), plus a Fork section on what this fork changes, its compatibility promise, benchmarks and roadmap. The source is in docs/.

Development

git clone https://github.com/abedmurrar/express.git && cd express
npm install
npm run build                         # compile src/ into lib/ (npm test and test-ci build first)
git config core.hooksPath .githooks   # lint staged files and check commit messages

npm test                              # all tests
npm run test-ci                       # all tests, with the 100% coverage gate
npm run lint                          # Biome
npm run test:types                    # type tests (strict, loose, @types/express snippets) and the type-size budget
npm run attw                          # check the packed types and exports with Are the Types Wrong
REGRESSIONS_ALL=1 npm test            # also run the skipped bug tests (they fail until fixed)
PROPERTY_RUNS=10000 FUZZ_RUNS=10000 npm test   # longer property and fuzz runs (add PROPERTY_SEED / FUZZ_SEED for a new seed)

npm run bench:install && npm run bench   # the benchmark comparison (about 25 minutes)
npm --prefix docs install && npm --prefix docs run docs:dev   # the docs site, on http://localhost:5173/express/

Each change is one pull request in this repository, following the "Definition of done" in ROADMAP.md. Commits use the GitHub noreply address and carry no Co-Authored-By lines.

Security

To report a security problem in this fork, see SECURITY.md.

Credit

Express was created by TJ Holowaychuk and is maintained by the Express team and its contributors. Everything here builds on their work. Upstream pull requests taken into this fork keep their authors.

The vendored copies of router, send, serve-static, qs and body-parser keep their original licences, in src/<package>/LICENSE (copied into lib/ when built).

The TypeScript types in typings/ are ported from @types/express (by Boris Yankov, Puneet Arora, Dylan Frankland and Sebastian Beltran) and @types/express-serve-static-core (by Boris Yankov, Satana Charuwichitratana, Jose Luis Leon, David Stephens and Shin Ando), with the other DefinitelyTyped contributors. They are MIT licensed; each file keeps the licence header and lists what changed.

License

MIT

About

Fast, unopinionated, minimalist web framework for node.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages