+2
Daily
5,767
stars
176
forks
11
watchers
2,017
prs
333
issues
271
releases
README
oRPC - Typesafe APIs Made Simple 🪄
oRPC is a TypeScript framework for building end-to-end typesafe APIs. Write your API once as plain TypeScript functions, and oRPC gives you a fully typed client, a REST API with an OpenAPI document, and MCP tools for AI agents, with no code generation. It runs on Node.js, Bun, Deno, Cloudflare Workers, and more.
Define procedures on the server and serve them with an RPC handler:
ts
import { os } from '@orpc/server'
import as z from 'zod'
export const router = {
planet: {
find: os
.input(z.object({ id: z.number() }))
.handler(({ input }) = ({ id: input.id, name: 'Earth' })),
},
}
Then call them from a client that knows every input and output, without generating anything:
ts
import { createORPCClient } from '@orpc/client'
import { RPCLink } from '@orpc/client/fetch'
import type { RouterClient } from '@orpc/server'
import type { router } from './router'
const link = new RPCLink({ origin: 'http://localhost:3000', url: '/rpc' })
const client: RouterClient = createORPCClient(link)
const planet = await client.planet.find({ id: 1 }) // { id: number, name: string }
Documentation
Read the full documentation at orpc.dev, starting with the Getting Started guide.
Packages
Core
| Package | Purpose | Docs |
| -------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| @orpc/contract | Define API contract as the single source of truth. | Procedure Contract, Contract Router, Implementation, Generate from OpenAPI |
| @orpc/server | Build APIs or implement contracts. | Procedure, Router, Middleware, Context, RPC Handler |
| @orpc/client | Consume APIs with end-to-end type safety. | Client-Side Clients, Server-Side Clients, RPC Link, Error Handling |
| @orpc/openapi | Add OpenAPI compatibility to APIs. | OpenAPI Handler, OpenAPI Link, Specification, Scalar |
Schema validation
| Package | Purpose | Docs |
| ---------------------------------Top issues
#482Better File Upload/Download operations in oRPC thanks to builtin integration of TUS11 comments · 2025-05-09#1415[Feature] Add Protocol Buffers (Protobuf) support for more efficient RPC communication8 comments · 2026-02-07#1389Feature request: allow full customization of URL search params and body serialization8 comments · 2026-01-27#1291Implement oRPC contract in Hono router7 comments · 2025-12-11#1282Add more contract-first examples in real world6 comments · 2025-12-09#729[Feature Request]: TCP Transport Adapter for server to server communication (mainly for microservices)5 comments · 2025-07-04#1217Neverthrow plugin for type safe error handling4 comments · 2025-11-14#481Automatic .output (for OpenAPI documentation) with the return type of .handler4 comments · 2025-05-09
Discussions
#2446oRPC v2 migration feedback: what hurt, and what should change before stable?3 comments · 2026-11-07#2361Locked into ORPCError for OpenAPIHandler?2 comments · 2026-10-30#1982Should we remove the ability to return a typesafe `ORPCError` from `.handler`?4 comments · 2026-09-05#1896v2 Tmp File Handling using fetch handler1 comments · 2026-08-19#1788`eridu-tech` — the server-side infrastructure behind your oRPC procedures0 comments · 2026-08-04#1584OpenAPI docs generate invalid request examples for oRPC endpoints3 comments · 2026-06-14#1539Support Zod Codecs1 comments · 2026-04-24#1514OpenAPI Spec to Contract1 comments · 2026-03-31
Latest release
v1.16.2 v1.16.2 2026-11-06 🐞 Bug Fixes - client: Reject 3xx responses in RPCLink - by @dinwwwh in https://github.com/middleapi/orpc/issues/2429 (e6038) View changes on GitHub