ts-rest → tRPC
mediumts-rest gives REST-shaped contracts; tRPC gives RPC. If you don't need REST verbs and are TypeScript-only, tRPC is more ergonomic.
npm install @trpc/server @trpc/client @trpc/react-query @tanstack/react-query
ts-rest contract → tRPC router. Each contract endpoint becomes a procedure (publicProcedure.input(z).query/mutation).
ts-rest middleware → tRPC middleware via t.middleware. Attach session/user to ctx.
client.endpoint({ body }) → trpc.namespace.endpoint.useQuery(input). Mutations use useMutation().
What this migration involves
Moving from ts-rest to tRPC is rated medium and takes about 4-8h on a typical project. The guide breaks it into 5 steps, 1 of which ship with runnable commands and 1 with a verification check.
Related migrations
FAQ
How long does migrating from ts-rest to tRPC take?
Around 4-8h for a typical project — 5 steps, difficulty rated medium, 1 of them with copy-paste commands.
Is moving from ts-rest to tRPC reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your ts-rest data before you start.
What does tRPC cost compared to ts-rest?
tRPC: open-source from $0/mo, free plan available.