Library / SDK
middleapi/orpc avatar
middleapi/orpc

oRPC: A TypeScript Contract Layer That Puts OpenAPI Coercion in the Middle

Typesafe APIs Made Simple. @orpc/json-schema: Smart coercion for OpenAPI requests.

5,765 stars176 forksTypeScriptMIT

At a glance

What is it?
oRPC is a TypeScript framework for defining API contracts once and reusing them across server, client, and OpenAPI tooling. This review covers how it works, how to run it, and where its beta status and package sprawl create real friction.
Who is it for?
Adopt oRPC if you want a single TypeScript contract that drives both server and client with end-to-end type safety, and if you are comfortable with a v2.0.0-beta release cycle. Do not adopt it if you need a stable, long-term API or if you dislike managing many small packages.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • middleapi/orpc5,765 ★ · +333
Star history
Repository2026-08-022026-11-14
middleapi/orpc5.4k5.8k

333 Stars in the last 104 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The Problem oRPC Solves: Contract Drift Between Server and Client

Most TypeScript API projects start with a server, then hand-write a client or generate one from OpenAPI. The server schema and the client types drift apart. oRPC attacks that by defining an API contract as the single source of truth. The @orpc/contract package holds that definition. @orpc/server implements it, and @orpc/client consumes it with full type inference. If you change a contract field, the client type updates immediately. That is the core value. It is aimed at teams building APIs where the client and server live in the same repository or at least share a TypeScript monorepo. It is less useful if your clients are not TypeScript or if you must serve many external consumers.

How the Contract Flows Through the Packages

The contract is not just a type definition. It is a runtime object that carries validation logic. You define a procedure with an input schema, an output schema, and a handler. The server package interprets that contract and exposes it over HTTP. The client package creates a typed caller from the same contract. No code generation step appears in the README; the types flow directly from the contract object. That is the key mechanism. The @orpc/openapi package adds OpenAPI compatibility, which means you can generate documentation or feed the contract into OpenAPI tooling. The @orpc/json-schema package handles what the description calls smart coercion for OpenAPI requests. That suggests it converts incoming OpenAPI request data into the types your schema expects. The design is modular: every feature is a separate npm package, from @orpc/zod to @orpc/hibernation.

Getting Started: Install the Packages You Actually Need

The README's example defines a router with os from @orpc/server, validates input with a Zod schema, and calls it from a client created with createORPCClient and an RPCLink from @orpc/client/fetch, with no code generation. @orpc/contract is for defining the API contract as a separate source of truth, and @orpc/zod, @orpc/valibot and @orpc/arktype are JSON Schema converters for those libraries. For framework support, the monorepo includes packages such as @orpc/next and @orpc/node. The @orpc/openapi package is optional unless you need OpenAPI output. The beta versions, such as v2.0.0-beta.48, are published to npm under the @orpc scope.

The Schema Library Choice: Zod, Valibot, or ArkType

oRPC does not force one validator. It has separate integration packages for Zod, Valibot, and ArkType. That is a strength if you already use one of those. It is also a maintenance burden for the project, because each integration must track upstream changes. The README lists all three as equals, so you can pick based on your existing stack. Zod is the most common, but Valibot offers a smaller footprint and ArkType focuses on performance. If you are starting fresh, the choice matters because it affects every contract you write. The monorepo also contains an @orpc/effect package for Effect users.

Where oRPC Struggles: Beta Status and Package Sprawl

The most obvious limitation is the version number. v2.0.0-beta.48 means the project is still in beta. The release dates are close together, with three releases in about eight days, which shows active development but also implies instability. If you adopt oRPC, you must budget for breaking changes. The second issue is package sprawl. The README lists over twenty packages. That gives flexibility, but it also means you must learn which packages you need and track updates across many dependencies. Packages carrying the experimental- prefix, such as @orpc/experimental-lock, are explicitly experimental. The @orpc/hibernation package depends on platform-specific APIs like Cloudflare's Hibernation WebSocket, which only work on certain runtimes. If you are on a standard Node.js server, that package is irrelevant.

Alternatives: tRPC and Plain OpenAPI Generation

The most direct alternative is tRPC, which also provides end-to-end type safety. The difference is that tRPC is tightly coupled to its own client and server, and it does not naturally produce OpenAPI documents. oRPC has a separate @orpc/openapi package that adds OpenAPI compatibility. Another alternative is to skip the framework entirely and use OpenAPI as the source of truth, generating types with tools like openapi-typescript. That approach works for any client language, but it requires a code generation step and does not give you type inference from a server implementation. oRPC usually inverts that: the TypeScript code is the source, and OpenAPI is an output, though @orpc/contract also documents generating a contract from OpenAPI.

Maintenance, Licensing, and the Cost of Upgrades

The project is MIT licensed, so you can use it commercially without paying for a license. Maintenance cost is real: with over twenty packages, every release requires updating several dependencies. The beta cadence means you should pin exact versions and review changelogs before upgrading. The @orpc/opentelemetry and @orpc/pino packages indicate the project takes observability seriously, which helps in production, but they are extra packages to maintain. You should assume that upgrading from one beta to the next may require code changes.

Editorial conclusion

Adopt oRPC if you want a single TypeScript contract that drives both server and client with end-to-end type safety, and if you are comfortable with a v2.0.0-beta release cycle. Do not adopt it if you need a stable, long-term API or if you dislike managing many small packages. Before committing, verify that the specific integrations you need (Next.js, NestJS, Cloudflare, or the schema library of your choice) are maintained and that the beta API matches your use case, since breaking changes are still possible.

Frequently asked questions

Is oRPC better than tRPC?

The answer depends on what your project already has. oRPC makes @orpc/contract the single source of truth, can generate that contract from OpenAPI, serves a specification and a Scalar page through @orpc/openapi, and converts schemas from Zod, Valibot or ArkType.

How do I set up the oRPC monorepo for local work?

The root package.json pins pnpm 12.4.2 under devEngines with onFail set to download, so a mismatched package manager is downloaded rather than used. Copy .env.example to .env and fill in REDIS_URL, UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN, because some project tests depend on Redis or Upstash Redis.

Which validation libraries can an oRPC contract use?

Zod, Valibot and ArkType, through the @orpc/zod, @orpc/valibot and @orpc/arktype packages, each of which is a JSON Schema converter for its library. Smart coercion for incoming OpenAPI requests is separate, in @orpc/json-schema.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/middleapi-orpc.svg)](https://hysenlabs.com/projects/middleapi-orpc)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/middleapi-orpc.svg)](https://hysenlabs.com/projects/middleapi-orpc)

Was this useful?