Adapter Fastify

Mount tRPC as a Fastify plugin with fastifyTRPCPlugin from @trpc/server/adapters/fastify. Configure prefix, trpcOptions (router, createContext, onError). Enable WebSocket subscriptions with useWSS and @fastify/websocket. Set routerOptions.maxParamLength for batch requests. Requires Fastify v5+. FastifyTRPCPluginOptions for type-safe onError. CreateFastifyContextOptions provides req, res.

trpc 68c6b80 5.2 KB Updated

File contents

trpc/trpc/tree/main/packages/server/skills/adapter-fastify commit 68c6b80547

Frequently asked questions

npx skillmds add trpc/adapter-fastify