talira

Fast and low overhead web framework, for Node.js

open sourceMITfree

Fastify is a fast, low-overhead web framework for Node.js, inspired by Hapi and Express and one of the fastest Node web frameworks in benchmarks. Routes declare JSON Schemas that Fastify compiles into fast functions to validate requests and serialize responses, and with a type provider such as TypeBox the same schema also types the handler in TypeScript. Everything extends through hooks, decorators and an encapsulated plugin system, with hundreds of core and community plugins, and it logs through Pino, a fast logger, built in. Fastify is an OpenJS Foundation project.

Problems it solves

  • a faster Node.js web framework than Express for a high-traffic API
  • validate request bodies and serialize responses with JSON Schema in Node
  • cut server costs by handling more requests per second in my Node backend
  • structure a Node.js API with isolated, reusable plugins
  • type my Node API handlers from the same schema that validates requests
  • built-in low-overhead structured logging for a Node.js server

Features

  • high throughput, around 79,000 requests per second in its benchmark
  • JSON Schema validation and serialization compiled to fast functions
  • hooks, decorators and encapsulated plugins
  • hundreds of core and community plugins
  • Pino logging built in
  • TypeScript type declarations and type providers

Limitations

  • Fastify v5 needs Node.js 20 or newer.1

Alternatives

The same job

These do what Fastify does.

  1. Hono Web framework built on Web Standards
  2. NestJS A progressive Node.js framework for efficient, scalable backends
  3. Express Fast, unopinionated, minimalist web framework for Node.js

Compare Fastify with the top 3