"매 fastest Node.js web framework — schema-first, plugin-driven, zero-overhead". Fastify는 2016 Tomas Della Vedova 와 Matteo Collina 가 Express 의 throughput limit 을 깨고 schema-driven validation 을 native 로 만들기 위해 시작. 2026 현재 v5.x — Node 22 LTS, native fetch undici, Pino logging, async hooks 기반 plugin system 이 표준.
매 핵심
매 설계 원칙
Schema-first: 매 route 가 JSON Schema 의 declare — request/response validation + serialization 의 fast-json-stringify 통해 2-3x serialize speedup.
Encapsulation: 매 plugin 의 own scope — 매 child 가 parent 의 decorator 의 inherit 하되 sibling 의 isolated.
Async/await native: 매 handler 가 promise return — 매 reply.send() implicit.
Zero-overhead logging: Pino 의 default — 매 JSON structured, async write.
매 vs Express
매 throughput: Fastify ~76k req/s vs Express ~13k req/s (Tech Empower 2026).
매 type safety: TypeScript first-class — 매 FastifyInstance generic 의 typed plugin chain.
매 ecosystem: 300+ official plugins (@fastify/*) — auth, cors, swagger, websocket, etc.
매 응용
High-throughput REST/JSON API gateway.
GraphQL server (Mercurius 통해).
Microservice 의 internal RPC.
💻 패턴
Server bootstrap with TypeBox schema
importFastifyfrom'fastify';import{TypeBoxTypeProvider,Type}from'@fastify/type-provider-typebox';constapp=Fastify({logger: true}).withTypeProvider<TypeBoxTypeProvider>();app.get('/users/:id',{schema:{params: Type.Object({id: Type.String({format:'uuid'})}),response:{200: Type.Object({id: Type.String(),name: Type.String()}),},},},async(req)=>{// req.params.id is typed as string
return{id: req.params.id,name:'Ada'};});awaitapp.listen({port: 3000,host:'0.0.0.0'});
Encapsulated plugin
importfpfrom'fastify-plugin';exportdefaultfp(async(app)=>{app.decorate('db',awaitconnectPg(process.env.DATABASE_URL!));app.addHook('onClose',async(instance)=>instance.db.end());},{name:'pg-plugin',dependencies:[]});// Usage in route file
app.register(async(scope)=>{scope.get('/health',async(req)=>{constr=awaitapp.db.query('SELECT 1');return{ok: r.rowCount===1};});});