oRPC lets developers define APIs as TypeScript procedures and get typed clients, REST with OpenAPI, MCP tools for agents, and realtime streams without code generation.
Overview
oRPC is a TypeScript framework for building end-to-end typesafe APIs. You write procedures as plain TypeScript functions on the server, and oRPC exposes them through an RPC handler while keeping inputs and outputs fully typed on clients.
From one router definition, oRPC can serve a typed client, a REST API backed by a generated OpenAPI document, MCP tools for AI agents, and typed realtime streams. The project emphasizes contract-first workflows, middleware, typed errors, and integrations with stacks such as TanStack Query and Next.js server functions.
The framework runs on Node.js, Bun, Deno, Cloudflare Workers, and other supported runtimes. Documentation and package splits cover schema validation, OpenAPI generation, observability, and framework-specific adapters.
Community sponsorship supports ongoing maintenance; the MIT-licensed project draws on prior contract-first and type-safe API approaches.
Key features
- End-to-end TypeScript types without codegen
- REST and OpenAPI from the same router
- MCP tool exposure for AI agents
- Typed errors and middleware
- Contract-first API design
- Realtime streaming procedures
- TanStack Query integration
- In-process and networked clients
Use cases
- Building typed RPC backends in TypeScript
- Publishing OpenAPI-backed REST from one definition
- Exposing agent tools via MCP
- Sharing APIs across SSR and client apps