Skills / Community / tRPC Type-Safe APIs

tRPC Type-Safe APIs

Build end-to-end type-safe APIs with tRPC. Generates routers, procedures with Zod validation, middleware chains, subscriptions, React Query integration, and server-side caller patterns.

This skill helps you build fully type-safe APIs with tRPC v11. It generates router definitions with query/mutation/subscription procedures, Zod input/output schemas with automatic type inference, middleware for auth and rate limiting, React Query hooks on the client, server-side callers for SSR, and WebSocket subscriptions for real-time features. Covers Next.js App Router integration, standalone adapters, and OpenAPI generation.

trpc type-safe api typescript react-query

When to use

Use when building type-safe APIs between TypeScript frontend and backend, creating tRPC routers with validation, implementing real-time subscriptions, or integrating with Next.js.

Examples

Full-stack app API

Create a tRPC router for a project management app

Build a tRPC router for a project management app with CRUD for projects and tasks, auth middleware with JWT, input validation with Zod, and React Query hooks on the client

Real-time subscriptions

Add WebSocket subscriptions for live updates

Add tRPC WebSocket subscriptions to my app for real-time notifications: new messages, task updates, and user presence — with automatic reconnection handling
Added to wishlist