<h1 align="center">oRPC - Typesafe APIs Made Simple 🪄</h1>



## Documentation

You can read the documentation [here](https://orpc.dev).

## Packages

**Core**

- [@orpc/contract](https://npmx.dev/package/@orpc/contract): Define API contract as the single source of truth.
- [@orpc/server](https://npmx.dev/package/@orpc/server): Build APIs or implement contracts.
- [@orpc/client](https://npmx.dev/package/@orpc/client): Consume APIs with end-to-end type safety.
- [@orpc/openapi](https://npmx.dev/package/@orpc/openapi): Add OpenAPI compatibility to APIs.

**Schema validation**

- [@orpc/zod](https://npmx.dev/package/@orpc/zod): Integrate with [Zod](https://zod.dev/).
- [@orpc/valibot](https://npmx.dev/package/@orpc/valibot): Integrate with [Valibot](https://valibot.dev/).
- [@orpc/arktype](https://npmx.dev/package/@orpc/arktype): Integrate with [ArkType](https://arktype.io/).

**Built-in features**

- [@orpc/publisher](https://npmx.dev/package/@orpc/publisher): Pub/Sub with memory, Redis, and Upstash adapters.
- [@orpc/ratelimit](https://npmx.dev/package/@orpc/ratelimit): Rate limiting with memory, Redis, and Upstash adapters.
- [@orpc/hibernation](https://npmx.dev/package/@orpc/hibernation): Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api).
- [@orpc/json-schema](https://npmx.dev/package/@orpc/json-schema): Smart coercion for OpenAPI requests.

**Framework & ecosystem integrations**

- [@orpc/next](https://npmx.dev/package/@orpc/next): Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data).
- [@orpc/ai-sdk](https://npmx.dev/package/@orpc/ai-sdk): Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools.
- [@orpc/tanstack-query](https://npmx.dev/package/@orpc/tanstack-query): Integrate with [TanStack Query](https://tanstack.com/query/latest).
- [@orpc/pinia-colada](https://npmx.dev/package/@orpc/pinia-colada): Integrate with [Pinia Colada](https://pinia-colada.esm.dev/).
- [@orpc/swr](https://npmx.dev/package/@orpc/swr): Integrate with [SWR](https://swr.vercel.app/).
- [@orpc/experimental-effect](https://npmx.dev/package/@orpc/experimental-effect): Integrate with [Effect](https://effect.website/).
- [@orpc/nest](https://npmx.dev/package/@orpc/nest): Implement your contract with [NestJS](https://nestjs.com/).
- [@orpc/node](https://npmx.dev/package/@orpc/node): [Node.js](https://nodejs.org/) plugins for static file serving and large uploads.
- [@orpc/bun](https://npmx.dev/package/@orpc/bun): Adapters for [Bun's Redis](https://bun.sh/).
- [@orpc/cloudflare](https://npmx.dev/package/@orpc/cloudflare): Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/).
- [@orpc/trpc](https://npmx.dev/package/@orpc/trpc): Reuse existing [tRPC](https://trpc.io/) routers within oRPC.

**Observability**

- [@orpc/opentelemetry](https://npmx.dev/package/@orpc/opentelemetry): Integrate with [OpenTelemetry](https://opentelemetry.io/) for distributed tracing.
- [@orpc/pino](https://npmx.dev/package/@orpc/pino): Integrate with [Pino](https://getpino.io/) for logging.
- [@orpc/evlog](https://npmx.dev/package/@orpc/evlog): Integrate with [Evlog](https://evlog.dev/) for logging.

## Sponsors

Like what we build over at [middleapi](https://github.com/middleapi)? You can help keep it going here: [GitHub Sponsors](https://github.com/sponsors/dinwwwh). Every bit helps! 🚀

### 🏆 Platinum Sponsor



| [ScreenshotOne.com](https://screenshotone.com/?ref=orpc) |
| --- |



### 🥈 Silver Sponsor



| [村上さん](https://misskey.io/?ref=orpc) |
| --- |



### Generous Sponsors



| [LN Markets](https://github.com/ln-markets?ref=orpc) |
| --- |



### Sponsors



| [Reece McDonald](https://github.com/hrmcdonald?ref=orpc) | [あわわわとーにゅ](https://github.com/u1-liquid?ref=orpc) | [nk](https://github.com/nicognaW?ref=orpc) | [supastarter](https://github.com/supastarter?ref=orpc) | [Dexter Miguel](https://github.com/divmgl?ref=orpc) | [herrfugbaum](https://github.com/herrfugbaum?ref=orpc) |
| --- | --- | --- | --- | --- | --- |
| [Ryota Murakami](https://github.com/ryota-murakami?ref=orpc) | [David Cramer](https://github.com/dcramer?ref=orpc) | [Valerii Petryniak](https://github.com/valerii15298?ref=orpc) | [Valerii Strilets](https://github.com/letstri?ref=orpc) | [Kyle Mistele](https://github.com/K-Mistele?ref=orpc) | [christ12938](https://github.com/christ12938?ref=orpc) |
| [Ryan Soderberg](https://github.com/Ryanjso?ref=orpc) | [shota](https://github.com/itigoore01?ref=orpc) | [Ellis Driscoll](https://github.com/ellis-driscoll?ref=orpc) | [Hoang Nguyen](https://github.com/hoangbn?ref=orpc) |  |  |



### Backers



| [David Walsh](https://github.com/rhinodavid?ref=orpc) | [Robbe Vaes](https://github.com/Robbe95?ref=orpc) | [Aidan Sunbury](https://github.com/aidansunbury?ref=orpc) | [soonoo](https://github.com/soonoo?ref=orpc) | [Kevin Porten](https://github.com/kporten?ref=orpc) | [Denis](https://github.com/pumpkinlink?ref=orpc) | [Christopher Kapic](https://github.com/christopher-kapic?ref=orpc) |
| --- | --- | --- | --- | --- | --- | --- |
| [Tom Ballinger](https://github.com/thomasballinger?ref=orpc) | [Sam](https://github.com/SSam0419?ref=orpc) | [Titoine](https://github.com/Titoine?ref=orpc) | [Igor Makowski](https://github.com/Mnigos?ref=orpc) | [hanayashiki](https://github.com/hanayashiki?ref=orpc) | [Lev Dubinets](https://github.com/ldub?ref=orpc) | [Kelly Peilin Chan](https://github.com/mr-kelly?ref=orpc) |
| [Guy Ariely](https://github.com/guyariely?ref=orpc) | [Alex](https://github.com/piscis?ref=orpc) | [Andrey Gubanov](https://github.com/finom?ref=orpc) |  |  |  |  |



With thanks to 37 past sponsors who helped get oRPC here.

## References

oRPC is inspired by existing solutions that prioritize type safety and developer experience. Special acknowledgments to:

- [tRPC](https://trpc.io): For pioneering the concept of end-to-end type-safe RPC and influencing the development of type-safe APIs.
- [ts-rest](https://ts-rest.com): For its emphasis on contract-first development and OpenAPI integration, which have greatly inspired oRPC's feature set.

## License

Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/main/LICENSE) for more information.