fastify

Build Fastify 5 HTTP APIs with schema validation and plugin encapsulation.

15|2|Updated May 23, 2026
One-click install
npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill fastify-vkirill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastify
Source: https://github.com/VKirill/antigravity-for-claude-code/tree/main/skills/fastify
Command: npx skills add https://github.com/VKirill/antigravity-for-claude-code --skill fastify-vkirill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Fastify 5 projects often fail or leak bugs when teams misuse schemas, skip response typing, mis-handle plugin encapsulation, or break webhook verification with the wrong body parsing.

Core Features & Use Cases

  • Production-ready Fastify 5 patterns for lifecycle, hooks, decorators, logging, error handling, and graceful shutdown.
  • Schema-based validation and response serialization using full JSON Schema with correct Type Provider setup.
  • Secure integration work with common plugins like JWT, CORS, Helmet, rate limiting, multipart, and raw-body webhook HMAC verification (including migration from Fastify 4).

Quick Start

Use the fastify skill to generate a Fastify 5 server with schema-validated routes, typed request/response handling, secure error mapping, and raw-body HMAC webhook support.

Frequently Asked Questions about fastify

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up schema validation and TypeScript type-provider integration in Fastify 5?

Schema validation in Fastify 5 requires defining full JSON Schema for routes and configuring a TypeScript Type Provider to automatically infer request and response types. This approach ensures type-safe APIs with automatic validation and serialization.

Why does my Fastify plugin encapsulation break shared decorators across routes?

Fastify plugin encapsulation isolates decorators by default, so shared decorators require using fastify-plugin to hoist scope. Without fastify-plugin, parent scopes cannot access child decorators, breaking route wiring and shared utility access.

How do I verify webhook HMAC signatures using raw-body capture in Node.js?

Webhook HMAC verification requires capturing the raw request body before JSON parsing to hash the original payload. In Fastify 5, this involves specific raw-body plugin configuration to ensure the signature matches the unmodified payload.

What is the best way to migrate from Fastify 4 to Fastify 5 without breaking lifecycle hooks?

Migrating from Fastify 4 to 5 requires updating lifecycle hook ordering, applying strict response schemas for every public route, and removing forbidden patterns like calling register() inside handlers to maintain production-grade stability.

Can I test Fastify 5 API routes without starting a live HTTP server?

Yes, you can test Fastify 5 API routes using the built-in app.inject method. This function simulates HTTP requests internally, allowing you to validate schema-driven endpoints, error mapping, and lifecycle behavior without network overhead.

Does Fastify 5 require response schemas for every public API route?

Yes, Fastify 5 enforces strict production rules requiring response schemas for every public route. Defining full JSON Schema for outputs ensures proper response serialization, secure error mapping, and prevents unexpected data leakage.