What is tRPC?
Learn about tRPC, its purpose, and how it simplifies API development by leveraging TypeScript.
What is tRPC? is a free tRPC End-to-End Type Safe APIs lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the tRPC End-to-End Type Safe APIs learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Hello, tRPC!
Welcome to tRPC! APIs let separate systems talk — like a restaurant menu telling you what you can order and what to expect back.
Traditional API Challenges
Traditional REST and GraphQL share pain points: manual type syncing between client and server, boilerplate, and mismatches that only surface at runtime.
Meet tRPC: A New Approach
tRPC (TypeScript Remote Procedure Call) fixes that: end-to-end type-safe APIs with no schemas and no code generation. Fewer bugs, faster shipping.
The 'T' in tRPC: TypeScript
The T is TypeScript. tRPC uses its inference to auto-share types between backend and frontend — define the API once, the client just knows the shapes.
The 'RPC' in tRPC: Remote Calls
The RPC is Remote Procedure Call: invoke a server function as if it were local. tRPC makes backend procedures feel like plain imports on the frontend.
No Code Generation Needed
Unlike OpenAPI or GraphQL, tRPC needs no code generation. It shares types natively across your monorepo — less setup, fewer build steps, less to maintain.
Why Choose tRPC?
Why developers reach for tRPC: compile-time type safety, autocomplete-rich DX, zero codegen, and a lightweight client that ships only type definitions.
Server-Side Glimpse: A Query
On the server, an endpoint is a procedure. Here's a simple hello query that returns a message.
import { initTRPC } from '@trpc/server';
const t = initTRPC.create();
export const appRouter = t.router({
hello: t.procedure
.query(() => {
return { message: 'Hello from tRPC server!' };
}),
});
export type AppRouter = typeof appRouter;Client-Side Glimpse: Calling It
On the client, calling that procedure feels like a local function — with full type safety and autocomplete baked in.
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../server/trpc'; // Type import
const trpc = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3000/trpc',
}),
],
});
async function greet() {
const response = await trpc.hello.query();
console.log(response.message); // Type-safe access!
}
greet();Boost Your Developer Experience!
With tRPC you get instant autocomplete for every endpoint, input, and output. Rename a server field and TypeScript flags the breakage in your client at once.
Quick Check: What is tRPC?
Let's test your understanding of tRPC's core principles.
Recap: What is tRPC?
Recap: tRPC uses TypeScript for end-to-end type safety, the RPC model for direct calls, and zero codegen — all boosting developer experience. Next: type safety itself.
Frequently asked questions
Is the “What is tRPC?” lesson free?
Yes — the full text of “What is tRPC?” is free to read here on the web, and the tRPC End-to-End Type Safe APIs course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the tRPC End-to-End Type Safe APIs course, upgrade to CoddyKit PRO.
What will I learn in “What is tRPC?”?
Learn about tRPC, its purpose, and how it simplifies API development by leveraging TypeScript. You practise tRPC End-to-End Type Safe APIs with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start tRPC End-to-End Type Safe APIs?
No prior experience is required. tRPC End-to-End Type Safe APIs on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What is tRPC?” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this tRPC End-to-End Type Safe APIs lesson?
Yes. Every tRPC End-to-End Type Safe APIs lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.