tRPC enables type-safe APIs without schemas or codegen. Its vocabulary — procedures, routers, context, mutations — is distinct from REST and GraphQL and comes up in full-stack TypeScript discussions.
0 / 5 completed
1 / 5
A developer says: 'tRPC gives us end-to-end type safety without a schema.' What does this mean?
End-to-end type safety in tRPC means the TypeScript types you define in your server router procedures are automatically inferred in the client — without GraphQL schemas, Swagger/OpenAPI files, or code generation. If you change a procedure's return type on the server, the TypeScript compiler immediately catches mismatches on the client. In discussions: 'no schema needed' highlights tRPC's zero-codegen approach.
2 / 5
A developer explains: 'We have a query for fetching and a mutation for updating.' What is the difference in tRPC?
In tRPC, queries (defined with publicProcedure.query()) are for reading data — they map to HTTP GET and React Query caches them. Mutations (defined with publicProcedure.mutation()) are for changing data — they map to HTTP POST. React Query treats them differently: queries invalidate on mutation. The terms come from GraphQL conventions but are implemented as type-safe JavaScript functions.
3 / 5
A senior engineer says: 'Add input validation to the procedure using Zod.' What does this mean in tRPC?
tRPC integrates with Zod for runtime input validation. You chain .input(z.object({ id: z.string() })) on a procedure to define the expected shape. tRPC validates incoming calls against the schema and throws a typed error if validation fails. This provides both TypeScript type inference AND runtime validation. In reviews: 'add Zod input validation' means declare the schema explicitly, don't trust raw input.
4 / 5
A developer mentions the tRPC router. What is a router in this context?
A tRPC router groups related procedures into a namespace: const userRouter = router({ getUser: ..., createUser: ... }). Routers can be nested: const appRouter = router({ user: userRouter, post: postRouter }). This creates a typed API hierarchy that mirrors the structure on the client: trpc.user.getUser.query(). In discussions: 'add a new router for orders' means create a new grouped namespace in the tRPC hierarchy.
5 / 5
A PR review says: 'Add context to pass the authenticated user to procedures.' What is tRPC context?
tRPC context is created via a createContext() function that runs per request. It typically includes the authenticated user, database connection, or other per-request state. Every procedure receives it as ctx: publicProcedure.query(({ ctx }) => ctx.user). This avoids passing the session down manually through every function call. In discussions: 'add user to context' means extract auth from the request once and make it available everywhere.