trpc

Installation
SKILL.md

tRPC

Overview

tRPC enables end-to-end type-safe APIs by sharing TypeScript types between server and client without code generation or schemas. The server defines procedures (queries, mutations, subscriptions) in a router, and the client infers all types from the exported AppRouter type.

When to use: TypeScript full-stack apps needing type-safe API layers, monorepos sharing types, real-time subscriptions, rapid API iteration without OpenAPI/GraphQL overhead.

When NOT to use: Public APIs consumed by non-TypeScript clients (use REST/GraphQL), polyglot backends, projects requiring OpenAPI spec generation as primary output.

Quick Reference

Pattern API Key Points
Initialize initTRPC.context<Ctx>().create() Single entry point, configure once
Router t.router({ ... }) Nest routers with t.mergeRouters()
Query t.procedure.input(schema).query(fn) Read operations, cached by clients
Mutation t.procedure.input(schema).mutation(fn) Write operations
Subscription t.procedure.subscription(fn) Real-time via WebSocket or SSE
Related skills
Installs
39
GitHub Stars
11
First Seen
Feb 23, 2026