Fastify

Node.js web framework focused on low overhead, with JSON-schema validation and a plugin system.

Works with AI agents:llms.txtCLI
Ask your AI about this, with this page as the source:ChatGPT ↗Claude ↗Perplexity ↗

Fastify is a web framework for Node.js for building HTTP APIs. It covers the same ground as Express — routes, request parsing, replies — but builds schemas, hooks and plugins into the core so that more of an API's structure is defined up front.

Two ideas carry most of the model. First, routes can declare JSON Schemas for the body, query string, params and response; Fastify compiles them with Ajv to validate input and with fast-json-stringify to serialize output. Second, everything is a plugin registered with register, and each plugin gets its own encapsulation context, so decorators, hooks and plugins added inside it are visible only to its children. Lifecycle hooks (such as onRequest and preHandler) replace Express-style middleware for cross-cutting work like auth checks.

For a small team, useful built-ins are structured JSON logging through pino (off until you enable it), TypeScript type definitions in the package, and type providers that derive request types from TypeBox or json-schema-to-ts schemas. It runs as a normal Node server; the docs recommend putting a reverse proxy in front in production and include adapters for AWS Lambda, Google Cloud Functions, Vercel and Netlify.

Fastify v5 runs only on Node.js 20 and later. Express middleware doesn't work out of the box — it needs the @fastify/express or @fastify/middie plugin — and the encapsulation model takes some learning. The docs also warn that schemas are compiled into code, so they must never come from user input.

Where it fits

How Fastify itself is built

1 tools, from its own code, website and Product Hunt page.

Who uses it

No maker's live product on record yet, and 75 open-source projects that declare it in their code.

We haven't found a maker's live product that uses Fastify yet — only the open-source projects below, which declare it in their code.

Open source: a project that declares Fastify as a dependency in its public code — verifiable, but not necessarily a live product.

Loved and watch-outs

Themes that recur in makers' words and Hacker News comments, each linked to what it summarises.

Most loved
  • It is named as a mainstream TypeScript backend choice and a modern replacement for Express. HNHN 2
  • Solo developers and two-person teams pair it with Postgres and Redis to ship small API backends quickly. HNHN 2HN 3HN 4
  • Teams run it as the HTTP layer under NestJS. HNHN 2

Reliability and open issues

Most wanted on GitHubOpen on 2026-10-04 in fastify/fastify, with activity in the last year — issues and feature requests by 👍.

Who switches

Public pull requests on GitHub since Oct 2024 whose title says "X to Y" — real code changes moving a project from one tool to another, by developers in general. Open a row to see the pull requests.

Express → Fastify68 PRs
FastAPI → Fastify4 PRs
NestJS → Fastify4+ PRs
Fastify → Hono9 PRs
Fastify → Express7 PRs
Fastify → NestJS4+ PRs

Alternatives to Fastify

All alternatives by situation →

Questions makers ask about Fastify

Can I use my existing Express middleware with Fastify?

Not directly. Since v3, middleware needs a plugin such as @fastify/express or @fastify/middie, and it only sees the raw Node request and response; for Fastify-aware logic, the docs suggest using hooks like preHandler instead. source ↗

Does Fastify have TypeScript support?

Yes. Type definitions ship with Fastify (you add @types/node), and type providers infer request and reply types from your schemas. The team maintains providers for TypeBox and json-schema-to-ts, and a third-party one exists for Zod. The docs note that a few parts of the API may still be typed loosely. source ↗

Which Node.js versions does Fastify v5 support?

Fastify v5 supports Node.js 20 and later only, so older runtimes need to stay on v4. source ↗

Can I run Fastify on serverless platforms?

Yes. The docs cover AWS Lambda, Google Cloud Functions and Cloud Run, Firebase Functions, Netlify and Vercel, usually with a small wrapper. They note that larger apps boot more slowly and suggest platforms that serve many requests per instance, such as Cloud Run or Fargate, for the best results. source ↗

How long is each major version supported?

A major release is supported for at least six months after it ships, and gets security fixes for six more months after the next major version comes out. source ↗

Does Fastify include logging?

Yes, it uses pino for JSON logs. Logging is off by default; you turn it on when you create the instance (for example with logger: true), and you can set log levels per route. source ↗

How does request validation work?

You attach JSON Schemas to a route for the body, query string, params and headers, and Fastify compiles them into validation functions; body validation applies to JSON requests unless you set schemas per content type. Response schemas speed up JSON serialization and keep fields you did not list out of the reply. source ↗

Is Fastify free?

Yes — it is free, open-source software.

Is Fastify open source or self-hostable?

Open source, and you can self-host it. source ↗

Can AI coding agents work with Fastify?

It serves an llms.txt docs index; it has an official CLI (fastify-cli).

Who uses Fastify?

No maker's live product we track yet; 75 open-source projects declare it in their code. source ↗