A Node.js HTTP framework focused on performance, JSON Schema validation, structured logging, and a plugin-based architecture inspired by Hapi and Express.
Overview
Fastify is a web framework for Node.js aimed at serving HTTP APIs and sites with low overhead and a strong developer experience. It uses a plugin and hook model so teams extend routing, serialization, authentication, and cross-cutting concerns without forking core code.
Routes can declare JSON Schema for request validation and response serialization; the framework compiles schemas into efficient runtime checks. Logging defaults to the Pino logger to keep log overhead small while remaining structured.
The core ships with TypeScript type definitions and patterns for encapsulation so plugins stay isolated. An ecosystem of official and community plugins covers CORS, static files, cookies, rate limiting, observability, and many other common needs.
Fastify targets recent Node.js releases and documents serverless, HTTP/2, and testing guides. Benchmarks on synthetic hello-world workloads show higher request throughput than several older Node frameworks, though real-world performance depends on application code.
Key features
- JSON Schema validation
- Plugin and hook architecture
- Pino-based logging
- TypeScript type support
- Encapsulated plugin scopes
- Large official plugin catalog
- Async route handlers
- Content-type parsers
Use cases
- High-throughput REST APIs
- Microservices on Node.js
- JSON APIs with strict schemas
- Serverless HTTP handlers
- Migrating from Express-style apps