Scripts2026年9月11日·1 分钟阅读

oRPC — Typesafe RPC Framework for TypeScript

Build end-to-end typesafe APIs with a lightweight RPC framework that works across React, Vue, Svelte, and server runtimes.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
oRPC Overview
直接安装命令
npx -y tokrepo@latest install 78c8b4c7-ada5-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

oRPC is a lightweight TypeScript RPC framework that gives you end-to-end type safety between server and client. It generates no code and requires no build step—types flow directly from your procedure definitions to your client calls.

What oRPC Does

  • Provides end-to-end type inference from server procedures to client calls
  • Supports input and output validation with Zod, Valibot, or any schema library
  • Works with React, Vue, Svelte, SolidJS, and TanStack Query integrations
  • Generates OpenAPI documentation from procedure definitions automatically
  • Runs on any runtime: Node.js, Bun, Deno, Cloudflare Workers, and edge functions

Architecture Overview

oRPC defines procedures on the server with input/output schemas. The client imports the router type and uses a proxy-based client that maps function calls to HTTP requests. Type inference travels through the router type without code generation, giving autocompletion and error checking at compile time.

Self-Hosting & Configuration

  • Install @orpc/server for the backend and @orpc/client for the frontend
  • Define procedures with input/output schemas using Zod or Valibot
  • Mount the router as an HTTP handler in Express, Hono, Next.js, or any framework
  • Use the TanStack Query integration for React/Vue data fetching
  • Enable OpenAPI generation with the @orpc/openapi plugin

Key Features

  • Zero code generation—types flow via TypeScript inference
  • Contract-first API design with optional OpenAPI spec output
  • Framework-agnostic client with adapters for TanStack Query and SWR
  • Middleware support for authentication, logging, and error handling
  • Streaming responses and server-sent events support

Comparison with Similar Tools

  • tRPC — pioneered TypeScript RPC; oRPC offers a simpler API with broader framework support
  • Hono RPC — Hono-specific RPC layer; oRPC is runtime-agnostic and works with any HTTP framework
  • ts-rest — contract-first REST API builder; oRPC uses RPC semantics with automatic OpenAPI output
  • GraphQL — schema-based query language; oRPC provides simpler procedure calls with full type safety

FAQ

Q: How is oRPC different from tRPC? A: oRPC has a simpler API surface, supports more schema libraries, and works with more frontend frameworks out of the box.

Q: Does oRPC require code generation? A: No. Types flow via TypeScript inference—no build step or generation needed.

Q: Can I generate OpenAPI docs? A: Yes. The @orpc/openapi plugin produces OpenAPI 3.1 specs from your router definition.

Q: What runtimes does oRPC support? A: Node.js, Bun, Deno, Cloudflare Workers, and any platform with a standard Request/Response API.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产