Grepedia
OR

oRPC

oRPC provides a powerful yet simple framework for building end-to-end type-safe APIs in TypeScript that adhere to OpenAPI standards, supporting diverse runtimes and frontend framework integrations.

Score0
Comments0
About

oRPC (OpenAPI Remote Procedure Call) is a modern, type-safe API framework designed to provide an end-to-end development experience. It enables developers to define and call remote or local procedures through a type-safe API while ensuring full adherence to the OpenAPI specification. By combining the benefits of RPC with the standardized requirements of OpenAPI, oRPC allows for the construction of scalable applications ranging from simple scripts to complex microservice architectures. The framework is built with a focus on 'powerful simplicity,' allowing developers to define API endpoints as easily as standard functions while automatically gaining type safety, error handling, and robust documentation.

Some of the key features are:

  • End-to-End Type Safety: Ensures type-safe inputs, outputs, and errors across the entire client-server boundary.
  • First-Class OpenAPI: Built-in support for generating OpenAPI specifications directly from the codebase.
  • Contract-First Development: Supports an optional contract-first workflow, allowing developers to define API contracts before writing implementation logic.
  • Framework Integrations: Seamlessly integrates with major frontend frameworks like React, Vue, Solid, Svelte, and Angular, as well as backend frameworks such as NestJS, Elysia, Express, and Fastify.
  • Server Actions: Native compatibility with React Server Actions in platforms like Next.js and TanStack Start.
  • Standard Schema Support: Fully compatible with popular schema validation libraries including Zod, Valibot, and ArkType.
  • Native Type Support: Built-in support for native types such as Date, File, Blob, BigInt, and URL.
  • Multi-Runtime Support: Optimized for performance on diverse runtimes including Cloudflare Workers, Deno, Bun, and Node.js.

The framework operates by utilizing a procedure builder that allows developers to define procedures with input/output schemas and middleware logic. These procedures can then be aggregated into a router. Adapters allow this router to be exposed via various transport protocols, such as HTTP or WebSockets. The client-side utilizes a type-safe client that consumes the router, providing auto-completion and validation out of the box. Middleware in oRPC provides a flexible way to handle concerns like authentication, rate limiting, and logging, while interceptors allow for global error handling and request monitoring. The architecture is modular and highly extensible through a plugin system.

Some common use cases include:

  • Type-Safe Full-Stack Development: Building end-to-end type-safe APIs in TypeScript, reducing runtime errors by sharing schemas between the client and server.
  • Microservices Architecture: Easily scaling service communications where robust typing and API standards are critical for interoperability.
  • Edge-Ready API Servers: Deploying lightweight, high-performance API endpoints on platforms like Cloudflare Workers or Bun.
  • OpenAPI Compliant Services: Quickly generating industry-standard API documentation for existing or new projects without manual effort.

Comments

0
0/5000

Markdown is supported.