
Fastify
A fast, low-overhead web framework for building servers and APIs with Node.js.
- Stars
- 37.3k
- Forks
- 3k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 4 days ago
- Type
- Library
What it is
Fastify is a framework for building web servers and APIs in Node.js. You define routes, such as a URL that returns data, and Fastify handles incoming requests with minimal extra work per request. It also offers a plugin system, input and output validation using JSON Schema, and built-in logging through Pino.
- Build a JSON REST API with routes that validate request bodies
- Serve an HTTP endpoint that returns a response with logging enabled
- Structure a backend into plugins using the encapsulation model
- Write tests for routes using the testing guide in the docs
Great for
- Node.js developers building JSON APIs or backend services
- Teams that care about request throughput and want a lightweight framework
- Projects that want schema-based validation of routes and responses
- Developers who want to organize code into reusable plugins
Not ideal for
- Beginners who have not yet learned Node.js basics, since the framework assumes JavaScript familiarity
- Projects that need a non-Node.js language, because Fastify is for Node.js only
- Teams expecting a large built-in feature set; much functionality comes from plugins, per the docs
How to get it
- 1
Install with a package manager
You'll need: Node.js
Install Fastify in an existing project
npm i fastifyGenerate a new Fastify project
npm init fastify - 2
Run it
- Create a folder and run npm init fastify inside it
- Run npm i to install dependencies
- Start the app in dev mode with npm run dev
- Open the local address the server reports and check the response
- 3
Get the most out of it
- Turn on logger: true to get structured logs via Pino
- Use JSON Schema on routes to validate inputs and serialize outputs
- Organize features into plugins and use encapsulation to scope them
- Read the Testing and Benchmarking guides in the docs before relying on performance claims
Downloads
Strengths
- The README reports high request throughput in a synthetic hello-world benchmark, with the caveat that real results depend on the application
- Supports JSON Schema validation and serialization for routes
- Includes a plugin architecture and hooks for extending behavior
Trade-offs
- Benchmark figures come from the maintainers' own synthetic test and may not match your workload
- The README's benchmark table lists an older Fastify version (4.0.0), so the numbers are not current
- Binding to 0.0.0.0 in containers requires care, since the README warns of security risks
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| fastify (this) | 37.3k | Library | beginner | 4 days ago | Node.js developers building JSON APIs or backend services |
| express | 69.6k | Framework | intermediate | 4 days ago | Developers building JavaScript or Node.js back-end servers |
| koa | 35.7k | Library | intermediate | 4 days ago | Node.js developers who want a minimal web framework they can shape themselves |
| Betterfox | 11k | Other | beginner | 2 months ago | Firefox users who want privacy-focused defaults without installing extra software |
| fiber | 40.2k | Library | intermediate | 4 days ago | Go developers building REST APIs or web backends |
| gin | 89.5k | Library | intermediate | 27 days ago | Go developers building REST APIs |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.