tRPC

Build type-safe APIs in TypeScript projects with routers, procedures, and context.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/vibekit-apps/skills-registry --skill trpc-vibekit-apps
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tRPC
Source: https://github.com/vibekit-apps/skills-registry/tree/main/skills/trpc
Command: npx skills add https://github.com/vibekit-apps/skills-registry --skill trpc-vibekit-apps

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fully type-safe APIs across client and server without schemas or code generation, enabling seamless end-to-end TypeScript contracts.

Core Features & Use Cases

  • End-to-end type inference: share routers, procedures, and context between server and client with automatic type safety.
  • Seamless Next.js integration: works great with Next.js App Router and React Query, enabling precise client-server contracts.
  • Minimal setup and extensibility: define routers and procedures with plain TypeScript and optional middleware for authentication and validation.

Quick Start

Create a minimal tRPC router in a Next.js app with a hello procedure to demonstrate full TypeScript inference.

Frequently Asked Questions about tRPC

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe APIs in Next.js without code generation?

tRPC provides end-to-end type-safe API development for TypeScript projects without requiring schemas or code generation. It defines routers and procedures with plain TypeScript, sharing types automatically between client and server.

Does tRPC work with Next.js App Router and React Query?

Yes, tRPC works seamlessly with Next.js App Router and React Query. It enables precise client-server contracts with full TypeScript inference, allowing your React components to consume API procedures with automatic type safety.

What's the best way to share API contracts between client and server in TypeScript?

The best way to share API contracts is using tRPC's end-to-end type inference. By defining routers, procedures, and context on the server, the client receives full TypeScript inference for inputs and outputs automatically without schemas or manual syncing.

How do I add authentication and input validation to a tRPC router?

You add authentication and input validation to a tRPC router by using optional middleware. Middleware intercepts procedures to validate inputs and create authentication context before executing the main router logic, maintaining full type safety.

Do I need a schema to get end-to-end type safety in a TypeScript API?

No, you do not need a schema. tRPC achieves end-to-end type safety by using plain TypeScript router and procedure definitions, eliminating the need for schemas or code generation steps while maintaining full type inference across client and server.

How do I set up nested routers and error handling in a type-safe API?

You set up nested routers and error handling by composing tRPC procedures into parent routers using plain TypeScript. The Skill provides examples covering these patterns, ensuring your API structure and errors maintain strict end-to-end type inference.