tRPC

Backend

tRPC is a TypeScript library for type-safe APIs, which I use less often, when the frontend and backend live in the same codebase.

How I use tRPC

Types flow from the server to the client automatically, so I don't write them twice.

For you, that means fewer bugs that would otherwise surface only for users: if a field name or data shape changes on the server, the editor and type check immediately flag every place in the app that needs fixing. Changes get done faster and more safely.

When I use it, I validate each procedure's input with a schema such as Zod, keep protected procedures separate from public ones, and pair it with TanStack Query for caching and refetching. I don't have a portfolio project built on tRPC.

tRPC makes sense when one team owns both frontend and backend in TypeScript, for example in a Next.js project. When mobile apps or outside services also consume the API, I choose REST, and in most projects Supabase covers the needs without a separate API layer.

Frequently asked questions about tRPC

What is tRPC?

tRPC is a TypeScript library for building APIs where the client calls server functions like regular functions, with full type checking. There's no separate schema or manual syncing of types, because TypeScript carries the types from server to client on its own.

tRPC or REST: when should you use which?

tRPC is a good fit when frontend and backend are both TypeScript in the same project, since you get type safety with no extra work. REST is better when mobile apps, other languages or outside services use the API, because it doesn't depend on TypeScript.

Do you use tRPC in your projects?

Less often. I know tRPC, but I don't have a portfolio project built on it, because most of my projects use Supabase or a classic REST API. I consider tRPC when frontend and backend share one TypeScript project, for example in Next.js.

All skills →