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.
Estimated: 8-20h · 5 steps
Progress0%
Step 1: Audit GraphQL usage
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.
Step 2: Install tRPC
npm install @trpc/server @trpc/client @trpc/react-query @tanstack/react-query && npm uninstall @apollo/server graphql
Step 3: Convert resolvers to procedures
GraphQL Query resolvers → tRPC query procedures. Mutations → mutation procedures. Subscriptions → tRPC subscriptions (websocket transport).
Step 4: Replace Apollo Client
Apollo useQuery/useMutation → tRPC's React Query hooks. Apollo cache → TanStack Query cache.
const { data } = trpc.users.list.useQuery()Step 5: Remove GraphQL schema
Type-safety now comes from TypeScript inference, not the SDL. No more schema.graphql or code generation.
✓ All data fetching works. Types infer correctly. Bundle size reduced.