Highly performant
One of the fastest web frameworks in town. Depending on code complexity, Fastify can serve around 60 thousand requests per second.
Fastify is a web framework focused on the best developer experience with the least overhead. A powerful plugin architecture, schema-based speed, and one of the fastest cores in Node.js.
npm install fastify// why fastify
An efficient server keeps your infrastructure costs low, stays responsive under load, and leaves your users happy. Fastify is built to serve as many requests as possible without compromising on security, validation, or developer experience. Inspired by Hapi and Express, it's one of the fastest web frameworks around.
// core features
One of the fastest web frameworks in town. Depending on code complexity, Fastify can serve around 60 thousand requests per second.
Fully extensible via its hooks, plugins, and decorators. Encapsulation keeps your components isolated and reusable.
Use JSON Schema to validate routes and serialize outputs. Internally Fastify compiles the schema into a highly performant function.
Logs are important but costly. We chose the fastest logger, Pino, to almost entirely remove that cost.
Expressive by design, built to help developers in daily use without sacrificing performance or security.
We work hard to maintain a TypeScript type declaration file to support the growing TypeScript community.
// quick start
Install Fastify and TypeBox, then create server.ts. The same schema validates incoming data, serializes the response, and infers the request type for your handler.
npm install fastify @fastify/type-provider-typebox typeboximport Fastify from 'fastify'
import { Type } from 'typebox'
import type { TypeBoxTypeProvider } from '@fastify/type-provider-typebox'
const fastify = Fastify({ logger: true })
.withTypeProvider<TypeBoxTypeProvider>()
fastify.get('/', {
schema: {
querystring: Type.Object({
name: Type.Optional(Type.String()),
}),
response: {
200: Type.Object({
hello: Type.String(),
}),
},
},
}, async (request) => {
return { hello: request.query.name ?? 'world' }
})
await fastify.listen({ port: 3000 })// benchmarks
Leveraging deep experience with Node.js performance, Fastify was built to be as fast as possible. Compare it against other common frameworks.
See full benchmarksreq/s · higher is better · illustrative comparison
// ecosystem
An ever-growing ecosystem of 297 plugins. There's probably already one for your database or template engine — and it's very easy to write your own.
Enables the use of CORS in a Fastify application.
OpenTelemetry instrumentation library.
Plugin for serving static files as fast as possible.
The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.
Parse and set cookie headers.
Multipart support for Fastify.
// maintainers
Fastify is an OpenJS Foundation project maintained by a global team of lead maintainers and collaborators.
// lead maintainers
// active
// alumni
Ship a production-grade API today. Start with the guide, or dive into the reference.