Guide
Express vs Fastify: Node.js Framework Choice 2026




Express vs Fastify on current npm data and Fastify's own benchmark: Express 5 leads on ecosystem and reach, Fastify 5 on schemas, logging and low overhead.
Contents
Contents
Pick Express 5 when you want the broadest middleware ecosystem, the most existing code and the least migration work. Pick Fastify 5 when you want JSON Schema validation, built-in Pino logging and encapsulated plugins. Fastify also has a measured but modest speed edge. On Fastify's own single-instance hello-world benchmark, Fastify 5.12.7 serves 89,733 GET requests per second and Express 5.3.0 serves 67,794. That is a 1.3× gap, measured on a trivial route.
Verdict
Both frameworks are current, MIT-licensed and actively maintained, so pick on fit. Express is the default for teams with existing Express code, Express-only middleware or a large pool of Express-trained developers. Fastify is the stronger default for a new JSON API where you will write request and response schemas anyway, because those schemas then drive validation, serialization and OpenAPI docs.
Do not switch a working Express service for speed alone. Fastify's lead holds on its own benchmark, but that benchmark measures framework overhead on a trivial route. In many production APIs, database calls, network calls and business logic cost more than the framework layer.
At-a-glance comparison
| Check | Express | Fastify |
|---|---|---|
| Latest version on npm | 5.3.0 | 5.12.8 |
| npm downloads, 2026-11-03 to 2026-11-09 | 195,493,804 | 22,366,239 |
| GitHub stars | 69,584 | 37,403 |
| GitHub repository created | 2009 | 2016 |
| License | MIT | MIT |
| Minimum Node.js (current major) | 18 | 20 |
| TypeScript types | Separate @types/express package | Bundled (fastify.d.ts) |
| Request validation | Bring your own middleware | Built in (JSON Schema via Ajv) |
| Logging | Bring your own middleware | Built in (Pino) |
| GET hello-world, Fastify-published | 67,794 req/s, 14.25 ms | 89,733 req/s, 10.63 ms |
| POST JSON echo, Fastify-published | 44,142 req/s, 22.15 ms | 69,080 req/s, 13.98 ms |
The benchmark rows come from Fastify's own benchmarks page. They are single-instance Node.js results for Express 5.3.0 and Fastify 5.12.7, and Fastify labels them illustrative. Express had about 8.7× more downloads than Fastify in the same week. Download counts include CI installs and transitive dependencies, so treat them as a reach signal, not a count of new projects.
See the live package data at pkgpulse.com/compare/express-vs-fastify, or open the Express and Fastify package pages.
Performance: what the official benchmark shows
Fastify publishes a benchmark of seven Node.js frameworks. Each test runs on a single Node.js instance. The GET test returns { hello: 'world' }. The POST test parses a small JSON body and echoes it back.
| Fastify-published test | Express 5.3.0 | Fastify 5.12.7 | Fastify's reported gap |
|---|---|---|---|
| GET, requests per second | 67,794 | 89,733 | 1.3× |
| GET, latency | 14.25 ms | 10.63 ms | 1.3× lower |
| GET, throughput | 12.09 MB/s | 16.09 MB/s | 1.3× |
| POST, requests per second | 44,142 | 69,080 | 1.6× |
| POST, latency | 22.15 ms | 13.98 ms | 1.6× lower |
| POST, throughput | 7.87 MB/s | 12.39 MB/s | 1.6× |
These numbers have limits. Fastify runs the benchmark, picks the routes and states that real-world results depend on hardware, Node.js version and workload. The page tells readers to rerun the fastify/benchmarks suite against their own routes. The tests also used Fastify 5.12.7, one patch behind the current npm release.
The POST test adds JSON body parsing and serialization, and Fastify's reported gap widens there from 1.3× to 1.6×.
Sources of the overhead difference
The npm dependency lists show where the two designs differ:
- Routing. Fastify depends on
find-my-way. Express 5 depends on the separaterouterpackage. - Serialization. Fastify depends on
fast-json-stringifyand its compiler. It can build a serializer from a response schema instead of calling plainJSON.stringify. - Validation. Fastify depends on
@fastify/ajv-compiler, so route schemas compile into validators. - Logging. Fastify depends on
pinoand builds a Pino logger from itsloggeroption.
Workloads where the gap matters
A 1.3× difference in framework overhead matters most when the framework itself is a large share of each request's cost. Examples are thin proxies, gateways, health and webhook endpoints, and JSON APIs that return cached data. On a route that spends most of its time waiting for a database, a few milliseconds of framework latency rarely decides capacity. Measure your own slowest routes before you plan a migration on performance grounds.
Developer experience
Express: minimal and familiar
const express = require('express');
const app = express();
app.get('/api/users/:id', (req, res) => {
res.json({ id: req.params.id, name: 'John' });
});
app.listen(3000);
Express 5 keeps the familiar API and drops support for Node.js versions before 18. The Express team describes the release as intentionally "boring": it focuses on old Node.js support, security fixes and simpler maintenance. Two changes matter in daily code:
- Promise support. A rejected promise returned from middleware now reaches Express error handling, so
asyncmiddleware no longer needs a wrapper to forward errors. - Safer path matching. Express 5 removed regular-expression sub-expressions such as
/:foo(\\d+)to close a class of ReDoS attacks. All route parameters must now be named.
Express still leaves validation, logging and serialization to you. That keeps the core small, but every team assembles its own stack and conventions.
Fastify: schema-first and structured
const fastify = require('fastify')({ logger: true });
fastify.get('/api/users/:id', {
schema: {
params: { type: 'object', properties: { id: { type: 'string' } } },
response: {
200: {
type: 'object',
properties: { id: { type: 'string' }, name: { type: 'string' } }
}
}
}
}, async (request, reply) => {
return { id: request.params.id, name: 'John' };
});
fastify.listen({ port: 3000 });
The schema costs more lines, but it does three jobs: it validates input, it controls the serialized response and it feeds @fastify/swagger for OpenAPI docs. Route schemas are optional: Fastify validates input only for the parts of a route you add a schema to. When you do supply a querystring, params, body or response schema, Fastify 5 requires the full JSON Schema format, including the type property. You can replace the default validator, for example with Zod.
Fastify's type definitions ship inside the package, and its type providers infer request types from schemas. Express types come from the separate @types/express package. The trade-off is a steeper start: plugin registration, encapsulation and decorators are concepts Express does not have.
Ecosystem
Express has the larger and older middleware ecosystem, built on the simple (req, res, next) contract. The Express docs list official middleware modules such as body-parser, cors, compression, cookie-parser, morgan, multer, serve-static and session.
Fastify has a core plugin set maintained by the Fastify team. It includes @fastify/auth, @fastify/jwt, @fastify/passport, @fastify/cors, @fastify/helmet, @fastify/rate-limit, @fastify/swagger and @fastify/aws-lambda. A separate community list covers more. Fastify plugins are encapsulated: code registered inside one plugin scope stays in that scope. The Fastify ecosystem also lists @fastify/middie, a middleware engine, and @fastify/express, an Express compatibility layer.
NestJS supports both. NestJS uses @nestjs/platform-express by default and offers @nestjs/platform-fastify as an alternative. Its current docs also add a third option, NodeAdapter, on the node:http module. NestJS recommends it starting with v12.3 and says it will become the default in v13. A NestJS team choosing between Express and Fastify adapters should check that option too.
Decision matrix
| Team constraint | Pick | Check before switching |
|---|---|---|
| Large Express codebase that works | Express 5 | Upgrade 4 → 5 first. Review regex routes, req.body defaults and removed method signatures. |
| Depends on Express-only middleware | Express 5, or Fastify with @fastify/express for a transition | The compatibility plugin is not a long-term solution and does not support HTTP/2. |
| New JSON API with typed contracts | Fastify 5 | Schemas are optional, but each one you add must be a full JSON Schema with type. Budget time to write them for the routes you validate. |
| Need OpenAPI docs from code | Fastify 5 | Confirm @fastify/swagger output matches your API gateway or client generator. |
| Thin proxy or high-volume webhook service | Fastify 5 | Rerun fastify/benchmarks or load-test your own routes on your Node.js version. |
| Pinned to Node.js 18 | Express 5 | Fastify 5 supports Node.js 20 and later only. |
| NestJS application | Keep the current adapter | Compare Express, Fastify and the newer NodeAdapter in a staging load test. |
| Serverless deployment | Either | Confirm the adapter for your platform supports your framework's current major. |
Migration notes
If you are moving from Express to Fastify, migrate in steps:
- Start new services in Fastify. Do not rewrite working Express code only for speed.
- Mount Express code with
@fastify/express. The plugin exposes Express'susefunction and can register a whole Express router or application. It needs the same body parsers you use in Express. - Move routes one at a time. Start with routes where schemas or lower overhead help the most.
- Add schemas gradually. Response schemas let Fastify use its compiled serializer. Request schemas add validation.
- Remove the compatibility layer. The plugin's own README says it is a transition aid and that Express-specific code should move to Fastify over time.
// Express (old)
import express from "express"
const app = express()
app.use(express.json())
app.get("/packages/:name", async (req, res) => {
const pkg = await db.findPackage(req.params.name)
if (!pkg) return res.status(404).json({ error: "Not found" })
res.json(pkg)
})
app.listen(3000)
// Fastify (new)
import Fastify from "fastify"
const app = Fastify()
app.get<{ Params: { name: string } }>("/packages/:name", async (request, reply) => {
const pkg = await db.findPackage(request.params.name)
if (!pkg) return reply.status(404).send({ error: "Not found" })
return pkg // Return value is automatically serialized to JSON
})
app.listen({ port: 3000 })
Two Fastify 5 changes often catch migrating teams. First, the logger option no longer accepts a custom logger instance, so pass your own Pino instance as loggerInstance. Second, all Fastify 4 deprecations were removed, so fix v4 deprecation warnings before you upgrade.
Support windows
Express supports only the latest release of each major line. Its support page lists both v5.x and v4.x as ongoing. Fastify supports each major for at least six months after release. It also gives security updates for six more months after the next major ships. Fastify 4 LTS ended on 2025-06-30. Fastify 5 shipped on 2024-09-17 and has no announced end date.
When to choose Express
- Your team already has Express services, and they meet their load targets.
- You depend on middleware that has no Fastify-native equivalent.
- You must stay on Node.js 18 for now.
- You want the smallest core and prefer to pick your own validation and logging libraries.
- Your hires and contractors mostly know Express, and onboarding time matters more than framework overhead.
When to choose Fastify
- You are starting a new JSON API and will define request and response schemas anyway.
- You want validation, serialization and OpenAPI docs generated from the same schema.
- You want structured Pino logging without adding middleware.
- You want plugin encapsulation to keep large APIs split into isolated modules.
- Framework overhead is a large share of your request cost, and your own load test confirms the gain.
Frequently Asked Questions
Is Fastify faster than Express?
On Fastify's own single-instance benchmark, yes. Fastify 5.12.7 served 89,733 GET requests per second against 67,794 for Express 5.3.0, about 1.3×. On the JSON POST test the gap was about 1.6×. Fastify labels the figures illustrative and says real-world results depend on hardware, Node.js version and workload. Check current package data on PkgPulse.
Should I switch from Express to Fastify?
Not for speed alone. If Express meets your load targets, a migration costs more than it saves. Start new services in Fastify instead, and move existing routes gradually with the @fastify/express compatibility plugin. Then remove that plugin once the Express-specific code is gone.
What is the fastest Node.js framework?
There is no neutral answer. Each project's benchmark measures its own chosen routes. On Fastify's published Node.js benchmark, Fastify leads the GET test, followed by Hono 4.13.14 at 84,930 req/s and H3 2.0.8 at 80,974 req/s. For a broader comparison that includes Bun-first frameworks, read Hono vs Express vs Fastify vs Elysia or compare Fastify vs Hono.
Methodology
This refresh replaced earlier unsourced throughput claims with primary data. Versions come from the npm registry, downloads from the npm downloads API for one fixed week, and stars and creation dates from the GitHub API. Benchmark figures come only from Fastify's published benchmark page, and each row says so. Framework behavior comes from the Express and Fastify docs, release notes and plugin README. PkgPulse did not run its own load test for this guide.
Source notes
- Fastify benchmarks: https://fastify.dev/benchmarks/
- Fastify LTS policy: https://fastify.dev/docs/latest/Reference/LTS/
- Fastify v5 migration guide: https://fastify.dev/docs/latest/Guides/Migration-Guide-V5/
- Fastify validation and serialization: https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/
- Fastify ecosystem plugins: https://fastify.dev/docs/latest/Guides/Ecosystem/
@fastify/expressREADME: https://github.com/fastify/fastify-express- Express version support: https://expressjs.com/en/support/
- Express 5 release post: https://expressjs.com/en/blog/2024-10-15-v5-release
- NestJS first steps and HTTP platforms: https://docs.nestjs.com/first-steps
- npm registry, express: https://registry.npmjs.org/express/latest
- npm registry, fastify: https://registry.npmjs.org/fastify/latest
- npm downloads, express: https://api.npmjs.org/downloads/point/last-week/express
- npm downloads, fastify: https://api.npmjs.org/downloads/point/last-week/fastify
- GitHub API, expressjs/express: https://api.github.com/repos/expressjs/express
- GitHub API, fastify/fastify: https://api.github.com/repos/fastify/fastify
Related guides
- Hono vs Express vs Fastify vs Elysia: the four-framework comparison
- Koa vs Fastify for Node.js APIs
- Express in 2026: when to use Express, Fastify or Hono
- Express vs Hono: legacy vs modern Node.js
- The decline of Express: what developers are switching to
- Hono vs Express vs Fastify for edge and Node.js APIs
Compare more backend packages on PkgPulse: Express vs Fastify, Express vs Hono, Fastify vs Hono or Express vs Koa.