Introduction
oRPC is a lightweight TypeScript RPC framework that gives you end-to-end type safety between server and client. It generates no code and requires no build step—types flow directly from your procedure definitions to your client calls.
What oRPC Does
- Provides end-to-end type inference from server procedures to client calls
- Supports input and output validation with Zod, Valibot, or any schema library
- Works with React, Vue, Svelte, SolidJS, and TanStack Query integrations
- Generates OpenAPI documentation from procedure definitions automatically
- Runs on any runtime: Node.js, Bun, Deno, Cloudflare Workers, and edge functions
Architecture Overview
oRPC defines procedures on the server with input/output schemas. The client imports the router type and uses a proxy-based client that maps function calls to HTTP requests. Type inference travels through the router type without code generation, giving autocompletion and error checking at compile time.
Self-Hosting & Configuration
- Install @orpc/server for the backend and @orpc/client for the frontend
- Define procedures with input/output schemas using Zod or Valibot
- Mount the router as an HTTP handler in Express, Hono, Next.js, or any framework
- Use the TanStack Query integration for React/Vue data fetching
- Enable OpenAPI generation with the @orpc/openapi plugin
Key Features
- Zero code generation—types flow via TypeScript inference
- Contract-first API design with optional OpenAPI spec output
- Framework-agnostic client with adapters for TanStack Query and SWR
- Middleware support for authentication, logging, and error handling
- Streaming responses and server-sent events support
Comparison with Similar Tools
- tRPC — pioneered TypeScript RPC; oRPC offers a simpler API with broader framework support
- Hono RPC — Hono-specific RPC layer; oRPC is runtime-agnostic and works with any HTTP framework
- ts-rest — contract-first REST API builder; oRPC uses RPC semantics with automatic OpenAPI output
- GraphQL — schema-based query language; oRPC provides simpler procedure calls with full type safety
FAQ
Q: How is oRPC different from tRPC? A: oRPC has a simpler API surface, supports more schema libraries, and works with more frontend frameworks out of the box.
Q: Does oRPC require code generation? A: No. Types flow via TypeScript inference—no build step or generation needed.
Q: Can I generate OpenAPI docs? A: Yes. The @orpc/openapi plugin produces OpenAPI 3.1 specs from your router definition.
Q: What runtimes does oRPC support? A: Node.js, Bun, Deno, Cloudflare Workers, and any platform with a standard Request/Response API.