Web FrameworkNode.jsPlugin ArchitectureHooksDecoratorsLoggingTypescriptServerless

Fastify

Fast and low overhead web framework, for Node.js

Overview

Fastify is a fast and low overhead web framework for Node.js, designed to provide a highly performant and extensible server foundation via plugins, hooks, and decorators. It recommends a schema-based approach using JSON Schema for route validation and response serialization, and commonly uses Pino for logging. Fastify also provides guidance for running Fastify in serverless and container-based platforms (e.g., AWS Lambda, Google Cloud Run, Vercel, Netlify Lambda).\n\nNote: Fastify is a backend web framework (not a UI rendering framework), so it does not provide CSR/SSR/SSG/ISR rendering modes as a built-in concept."

Rendering Modes
Server
Best For

High-performance APIs, Microservices, Real-time apps

License

MIT

Quick Start

npm init && npm install fastify

Create a new JavaScript file for your server (for example, server.js), Instantiate Fastify with logging enabled. Register a GET route that returns a JSON object. Start the server by calling fastify.listen on a port (for example, 3000)., Run the server with Node.js. Open the local address in your browser or call the endpoint with curl.

Key Features

Schema Validation

Serialization

Plugins

Hooks

TypeScript Support

Pros & Cons

Pros

  • Very fast
  • Great TypeScript support
  • Built-in validation

Cons

  • Smaller ecosystem than Express
  • Different patterns to learn

Common Use Cases

High-Performance REST APIsMicroservices & Internal APIsAPI Gateway / BFF (Backend for Frontend)JSON Schema Validation & Typed Contracts

Compatible CMS

Compatible Cloud Servers