~/TechPurAILearn · Build · Grow
Start Learning
Blog / Opinion
Opinion2 min read · Aug 6, 2026

Why I switched from REST to tRPC on my side projects

End-to-end type safety sounded like a gimmick until I tried it on a real project.

VK
Vijay Kumar
Founder of TechPurAI
Share
TechPurAI graphic comparing REST (multiple endpoints, manual type handling, more boilerplate, slower development) against tRPC (end-to-end type safety, no manual serialization, simpler cleaner code, faster development), with a developer at a laptop between the two

Every side project starts the same way: a handful of REST endpoints, a fetch wrapper, and a type file you promise to keep in sync. Six weeks later the type file is wrong, a field got renamed on the backend, and you find out in production. tRPC fixes the exact part of that story I was tired of.

The waterfall problem

A single user profile page used to cost me three sequential requests: fetch the user, fetch their posts, fetch comments on the first post. Each one waited on the last, and each one needed its own loading state.

ts
GET /api/user/1
GET /api/user/1/posts
GET /api/user/1/posts/9/comments

With tRPC, that becomes one typed procedure call. The client gets full autocomplete on the response shape, and if the backend changes a field name, the build fails instead of the page.

ts
const profile = await trpc.user.withPosts.query(1);
// profile is fully typed, no .d.ts to maintain

The type file you promise to keep in sync is the one that's always six weeks out of date.

Where it doesn't help

If you need a public API that other teams or third parties consume, tRPC isn't the right tool — it assumes a TypeScript client on the other end. I still reach for REST or GraphQL for anything crossing a real API boundary.

What I'd tell past me

  • Start with tRPC only on internal, full-stack TypeScript projects.
  • Don't migrate an existing REST API just to try it — build the next one this way instead.
  • Pair it with Zod for input validation; you get runtime safety for free.

Six months in, the thing I notice most isn't the saved boilerplate — it's how rarely a backend change breaks the frontend without me knowing at build time.

VK

Vijay Kumar

Founder of TechPurAI — writing hands-on tutorials and honest tool breakdowns.

LinkedIn ↗

Frequently asked questions

Does tRPC work if my backend isn't written in TypeScript?

No — tRPC's entire value proposition is inferring types directly from your backend's TypeScript source and sharing them with the client, with no code generation step. If the backend is in a different language, there's no type signature for tRPC to read, and you're back to needing a schema-based approach like GraphQL or an OpenAPI-documented REST API instead.

Can I use tRPC for a public API that other companies consume?

Not well. tRPC assumes the client calling it is also TypeScript and imports the backend's router types directly — that works great inside one codebase or a monorepo, but a third party integrating with your API has no access to that type information and no reason to want a TypeScript-specific client. REST or GraphQL remain the right choice for anything crossing a real external API boundary.

Do I need to migrate an existing REST API to try tRPC?

No, and I'd actively avoid it. Migrating a working REST API just to experiment is a lot of risk for not much signal. Build the next new endpoint in tRPC instead, on an internal, full-stack TypeScript project, and judge it from there.