orpc
the contract keeper
oRPC v2 only: pretrained knowledge describes v1 and is wrong for v2, so every import path, builder method, and option comes from the docs, never memory. Core builder, contract-first design, migration, and OpenAPI exposure live behind one trigger.
one procedure, one schematypes end to enderrors are typed too
Use for any task in a project that depends on @orpc/* packages -- defining procedures with the os builder, contract-first APIs with oc, routers, middleware, context, ORPCError, RPCHandler, clients, TanStack Query integration, SSE streaming, OpenAPI exposure, or migrating from tRPC or oRPC v1.
methodology
- check the installed version first:
npm ls @orpc/server-- a 1.x means v1, where this guidance does not apply. - core work -- os builder, routers, middleware, context, ORPCError, RPCHandler, clients, tanstack query, sse streaming -- the core guide covers it.
- contract-first design -- oc contracts, implement, shared server/client packages, contract generation from openapi, typed client publishing -- the contract guide covers it.
- migrating from tRPC, or oRPC v1 to v2 -- the migration guide covers both paths.
- REST-style routes, OpenAPIHandler, spec generation, scalar/swagger docs -- the OpenAPI guide covers it.
- live project
AGENTS.mdand operator directives override this guidance.
contents
- trainedlearned layer -- read first
- orpccore oRPC v2: os builder, routers, middleware, context, ORPCError, RPCHandler, clients, TanStack Query, SSE streaming
- orpc-contractcontract-first design with oc: implementing contracts, sharing between packages, contract generation from OpenAPI, publishing typed clients
- orpc-migratetRPC-to-oRPC migration (incremental wrap or rewrite) and oRPC v1-to-v2 upgrade paths
- orpc-openapiexposing an oRPC router as OpenAPI: route metadata, OpenAPIHandler, Smart Coercion, OpenAPILink, spec generation, Scalar/Swagger docs