O que é tRPC?
Aprenda sobre o tRPC, sua finalidade e como ele simplifica o desenvolvimento de APIs aproveitando o TypeScript.
O que é tRPC? é uma aula grátis de tRPC End-to-End Type Safe APIs no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de tRPC End-to-End Type Safe APIs, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de tRPC End-to-End Type Safe APIs inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
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.
Perguntas Frequentes
A aula “O que é tRPC?” é grátis?
Sim — o texto completo de “O que é tRPC?” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de tRPC End-to-End Type Safe APIs, atualize para CoddyKit PRO. O curso de tRPC End-to-End Type Safe APIs inclui 4 aulas no total.
O que vou aprender em “O que é tRPC?”?
Aprenda sobre o tRPC, sua finalidade e como ele simplifica o desenvolvimento de APIs aproveitando o TypeScript. Você pratica tRPC End-to-End Type Safe APIs com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar tRPC End-to-End Type Safe APIs?
Nenhuma experiência prévia é necessária. tRPC End-to-End Type Safe APIs no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.
Quanto tempo leva a aula “O que é tRPC?”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de tRPC End-to-End Type Safe APIs?
Sim. Cada aula de tRPC End-to-End Type Safe APIs inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- O que é tRPC?
- O poder da segurança de tipos
- Visão geral dos conceitos fundamentais do tRPC
- Configurando seu primeiro projeto tRPC