Fastify Web Framework

5.8.5 · active · verified Sat Apr 18

Fastify is a high-performance web framework for Node.js, known for its low overhead and powerful plugin architecture. It provides an excellent developer experience with a focus on speed and security. Currently in stable version 5.8.5, Fastify undergoes active development with frequent releases, including critical security patches.

Common errors

Warnings

Install

Imports

Quickstart

This example sets up a basic Fastify server listening on port 3000 and defines a root route that returns a JSON object.

import Fastify from 'fastify';

const fastify = Fastify({
  logger: true
});

fastify.get('/', async (request, reply) => {
  reply.send({ hello: 'world' });
});

fastify.listen({ port: 3000 }, (err, address) => {
  if (err) {
    fastify.log.error(err);
    process.exit(1);
  }
  console.log(`Server listening on ${address}`);
});

view raw JSON →