Skip to content

unnoq/orpc

Repository files navigation

NPM Downloads GitHub Release GitHub commit activity GitHub License

End-to-end typesafe APIs built quicker & easier

Note

This project is still in heavy development, please be mindful of breaking changes.

oRPC is a powerful combination of RPC and OpenAPI, offering an exceptional developer experience powered by TypeScript. It's designed to be simple and straightforward to use.


Features

  • Type-safe πŸ”’: oRPC is built on top of TypeScript, which means you get full type safety out of the box.
  • Easy to use ✍️: oRPC is designed to be simple and straightforward to use.
  • Contract first πŸ“: Take advantage of a "contract first" approach to developing your API.
  • Built-in plugins πŸ”Œ: Easily implement into your favourite frameworks.

Documentation & Examples

You can find the full documentation & examples here.


Packages

  • @orpc/contract: Build your API contract.
  • @orpc/server: Build your API or implement API contract.
  • @orpc/client: Consume your API on the client with type-safety.
  • @orpc/react-query: Integration with React Query.
  • @orpc/vue-query: Integration with Vue Query.
  • @orpc/vue-colada: Integration with Pinia Colada.
  • @orpc/openapi: Generate OpenAPI specs and provide OpenAPI handler for @orpc/server.
  • @orpc/next: Helpers and hooks for Next.JS.
  • @orpc/zod: More schemas that Zod doesn't support yet.

Comparison

This comparison table helps you understand how oRPC differs from other popular TypeScript RPC and REST solutions.

  • βœ… First-class, built-in support.
  • 🟑 Lacks features, or requires third-party integrations.
  • πŸ›‘ Not supported or not documented.
Feature oRPC tRPC ts-rest Description
End-to-end Type Safety βœ… βœ… βœ… Full TypeScript type inference from backend to frontend.
End-to-end Type Error βœ… πŸ›‘ βœ… Full TYpeScript type inference for Error from backend to frontend.
React Query Integration βœ… βœ… 🟑 Native support for React Query/TanStack Query.
Vue Query Integration βœ… πŸ›‘ 🟑 Native support for Vue Query/TanStack Query.
Pinia Colada Integration βœ… πŸ›‘ πŸ›‘ Native support for VPinia Colada.
With Contract-First βœ… πŸ›‘ βœ… API definitions before implementation.
Without Contract-First βœ… βœ… πŸ›‘ API definitions and implementation are combined in same place
File Operations βœ… 🟑 🟑 Built-in support for file uploads/downloads.
OpenAPI Support βœ… 🟑 🟑 Generation and consumption of OpenAPI specs.
Server Actions Support βœ… βœ… πŸ›‘ React/Next.js Actions compatibility.
WebSockets/SSE Support πŸ›‘ βœ… πŸ›‘ WebSockets/SSE support.
Nest.js integration πŸ›‘ 🟑 βœ… Integration with Nest.js.

References

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

  • tRPC: For pioneering the concept of end-to-end type-safe RPC and influencing the development of type-safe APIs.
  • ts-rest: 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 for more information.