tRPC + TanStack Query
End-to-end typesafe APIs with tRPC and TanStack Query for async state management. Types flow from server to client automatically.
Simple Query
A basic tRPC query with no input parameters
Loading...
Query with Input
Input is validated with Zod on the server
Mutation
Create items using tRPC mutations with type-safe responses
Loading States
TanStack Query provides fine-grained loading states
Initial loading...
How it works
- 1. Define procedures in
lib/trpc/routers/ - 2. Use Zod for input validation - errors are typed
- 3. Import
trpcclient and call hooks - 4. Types are inferred from server to client