tRPC router
The object that groups a server’s tRPC procedures by name; its type, usually exported as AppRouter, is all the client needs.
In more detail
Routers can be nested to organise procedures by feature. The exported type is erased at compile time, so no server code reaches the browser bundle.
Example
export type AppRouter = typeof appRouterRelated terms
- tRPC — A TypeScript framework that lets a frontend call backend procedures with full type safety by sharing the server’s types, with no code generation.
- procedure — One callable server function in a tRPC router, declared as a query (read) or a mutation (write), with a validated input.
- typeof — A keyword that asks for the type of a value, both in JavaScript at run time and in TypeScript types.
Taught in
- Type-Safe RPC Architectures: tRPC & Procedures — Production Full-Stack Engineering