GraphQL (Apollo) → tRPC
hardtRPC gives type safety without a schema language or codegen. Better fit for full-stack TypeScript apps that don't need a public API.
List all queries, mutations, and subscriptions. Check if any clients outside your TypeScript app consume the API (mobile, third-party). If yes, GraphQL may be the right choice.
npm install @trpc/server @trpc/client @trpc/react-query @tanstack/react-query && npm uninstall @apollo/server graphql
GraphQL Query resolvers → tRPC query procedures. Mutations → mutation procedures. Subscriptions → tRPC subscriptions (websocket transport).
Apollo useQuery/useMutation → tRPC's React Query hooks. Apollo cache → TanStack Query cache.
const { data } = trpc.users.list.useQuery()Type-safety now comes from TypeScript inference, not the SDL. No more schema.graphql or code generation.
What this migration involves
Moving from GraphQL (Apollo) to tRPC is rated hard and takes about 8-20h on a typical project. The guide breaks it into 5 steps, 2 of which ship with runnable commands and 1 with a verification check.
FAQ
How long does migrating from GraphQL (Apollo) to tRPC take?
Around 8-20h for a typical project — 5 steps, difficulty rated hard, 2 of them with copy-paste commands.
Is moving from GraphQL (Apollo) to tRPC reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your GraphQL (Apollo) data before you start.
What does tRPC cost compared to GraphQL (Apollo)?
tRPC: open-source from $0/mo, free plan available.