
Fastify vs Express in 2026: which one for a new project
A practical comparison between Fastify and Express in 2026: performance, plugin architecture, schema-based validation, ecosystem maturity, and when to pick one over the other.
Express remains, by far, the most used HTTP framework in the Node.js ecosystem — it’s the default choice in practically every tutorial. Fastify has been around for years as a serious alternative, but the question of “which one for a new project” keeps coming back, and the honest answer is: it depends on what you’re optimizing for.
Performance: not just marketing
The speed gap between the two doesn’t come from router micro-optimizations, but from a specific architectural choice: Fastify serializes JSON responses using the schema declared for the route, instead of going through generic JSON.stringify. If you declare the exact shape of the response, Fastify can generate a serializer optimized for that specific shape, skipping most of the work JSON.stringify does to handle the generic case.
fastify.get(
"/users/:id",
{
schema: {
response: {
200: {
type: "object",
properties: {
id: { type: "number" },
name: { type: "string" },
},
},
},
},
},
async (request) => {
return db.findUser(request.params.id);
},
);
Express has no built-in equivalent: validation and serialization, if you want them, come from third-party middleware (express-validator, zod used by hand in the route). The exact benchmark numbers change with every release of both frameworks — for up-to-date data it’s better to check the official Fastify benchmarks page rather than trust a number frozen in an article. The direction, though, has been stable for years: Fastify is faster, and the gap widens specifically on endpoints with structured JSON responses, where schema-based serialization matters most.
⚠ Attenzione
For most web applications, the throughput difference between Express and Fastify isn’t the real bottleneck — database queries, calls to external services, or blocking I/O almost always are. Choosing Fastify “because it’s faster” without raw HTTP performance actually being a measured problem is optimizing the wrong part of the stack.
Architectural differences
Plugin encapsulation. Fastify treats every plugin as an isolated context: decorators, hooks, and configuration registered inside a plugin don’t leak out unless you explicitly register them as global. This makes it natural to structure a large app into independent modules (auth, users, payments) without one “polluting” another’s state — a common problem in large Express apps, where middleware is global by design and registration order matters silently.
Built-in validation. In Fastify, the schema (JSON Schema or TypeBox) isn’t just documentation: it’s compiled into an actual validator (ajv), run automatically before the handler. In Express, validation is always an explicit, manual step, often inconsistent across routes in the same project because the framework doesn’t enforce a pattern.
Lifecycle hooks. Fastify exposes granular hooks (onRequest, preValidation, preHandler, onSend, etc.) with a well-defined execution order. Express only has the concept of sequential middleware — flexible, but less explicit about when in the request lifecycle a middleware runs.
Maturity and ecosystem: where Express still wins
Here the advantage runs the other way. Express has existed since 2010, and it’s the de facto standard in practically every tutorial, course, and Stack Overflow question of the last fifteen years. For pretty much any problem you run into, the odds that someone else already solved and documented it with Express are higher. The number of ready-to-use third-party middleware (auth, rate limiting, logging, integrations with specific providers) is orders of magnitude larger. If your team already has solid Express experience, or you’re integrating code with libraries that assume the Express middleware interface (req, res, next), the adoption cost of Fastify needs to be weighed against a performance benefit that, as noted above, often isn’t the app’s actual bottleneck.
Summary table
| Express | Fastify | |
|---|---|---|
| Raw HTTP performance | Good | Higher, especially with structured JSON responses |
| Request validation | Manual (third-party middleware) | Built-in via schema |
| Plugins/encapsulation | Global middleware | Isolated per-plugin contexts |
| TypeScript | Supported, not native | Designed with TS in mind from the start |
| Ecosystem/community | The largest in the Node ecosystem | Solid, but smaller |
| Adoption curve for Express-experienced teams | None | Low-to-medium |
When to pick which
Express remains the right choice when the team already knows it well, the project relies on middleware only available for Express, or raw HTTP response speed has never actually been a constraint of the project — most internal CRUDs and low-traffic APIs fall here.
Fastify pays off for high-throughput APIs where JSON serialization actually matters, for TypeScript-first projects where you want request/response schemas to also be the source of truth for your types, or for large modular architectures where plugin encapsulation prevents a whole class of unwanted shared-state bugs.
If you’ve gone with Fastify, the guide on building a REST API with Fastify and TypeScript covers setup, routing, and schema-based validation in practice, starting from scratch.