
tRPC Has a Free API — End-to-End Type-Safe APIs Without Code Generation
What if your API client knew every endpoint, parameter, and return type — without generating any code? tRPC gives you end-to-end type safety between your server and client. Define procedures on the server, call them from the client — TypeScript infers everything. Why tRPC Zero code generation — types flow from server to client via inference Full autocomplete — your IDE knows every endpoint and its types Validation included — Zod, Yup, or any validator React Query integration — built-in hooks with caching Subscriptions — WebSocket support Framework-agnostic — works with Next.js, Express, Fastify, Deno Quick Start npm install @trpc/server @trpc/client @trpc/react-query Server: import { initTRPC } from " @trpc/server " ; import { z } from " zod " ; const t = initTRPC . create (); export const appRouter = t . router ({ getUser : t . procedure . input ( z . object ({ id : z . string () })) . query ( async ({ input }) => { const user = await db . users . findById ( input . id ); return user
Continue reading on Dev.to Webdev
Opens in a new tab



