orpc-server

Guides changes to oRPC router contracts, handlers, and Nitro transport setup in the dashboard server.

Updated Aug 8, 2026
One-click install
npx skills add https://github.com/wolfstar-project/code-zero --skill orpc-server-wolfstar-project
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: orpc-server
Source: https://github.com/wolfstar-project/code-zero/tree/main/.skills/orpc-server
Command: npx skills add https://github.com/wolfstar-project/code-zero --skill orpc-server-wolfstar-project

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing the dashboard's server routes, oRPC contracts, or transport setup involves subtle conventions across packages/api and Nuxt's Nitro server, and mistakes like using .route() sugar or Nitro v3 APIs silently break /api/v1/** routes in production builds. ## Core Features & Use Cases - Contract and router guidance: Keeps procedure contracts in packages/api/src/orpc/router.ts with .meta(openapi(...)) metadata so OpenAPI routes survive Nitro's bundler tree-shaking. - Transport rules: Enforces classic h3 APIs (defineEventHandler, toWebRequest) on the pinned Nuxt v4 / nitropack v2 stack, avoiding unreleased Nitro v3 patterns. - Error and environment conventions: Standardizes H3Errors from server/utils/errors.ts, environment resolvers in server/utils/environment.ts, and KV persistence through the KeyValueStorage contract. - Use Case: When adding a new control-plane procedure, follow the workflow to define the contract, keep the handler thin, add createRouterClient tests, and verify with a real nuxt build. ## Quick Start Use the orpc-server skill to add a new procedure to the dashboard router and expose it over both the RPC and OpenAPI transports.

Frequently Asked Questions about orpc-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new oRPC procedure to a Nuxt server?▼

Define the procedure contract in `packages/api/src/orpc/router.ts` with `.meta(openapi(...))` metadata, keep the handler thin by delegating to control-plane operations, and add tests using `createRouterClient` without opening a network port.

Why are my OpenAPI routes missing after a Nitro production build?▼

The `.route()` sugar from `@orpc/openapi/extensions/route` relies on a side-effect import that Nitro's bundler tree-shakes away, silently dropping `/api/v1/**` routes. Use `.meta(openapi(...))` instead, which is a real import the bundler keeps.

Can I use Nitro v3 defineHandler with Nuxt 4?▼

No. Nuxt pinned to the v4 channel uses nitropack v2 with classic h3, so route handlers must use `defineEventHandler` and `toWebRequest` from `h3`. The Fetch-first `defineHandler` API belongs to the unreleased Nuxt v5 nightly channel.

How should server errors be handled in oRPC Nitro routes?▼

Throw `H3Error`s from the catalogue in `server/utils/errors.ts`, such as `errors.notFound()` or `errors.internal(error)`, and let Nitro serialize them. The internal error helper redacts secrets and attaches no cause because Nitro logs thrown errors whole.

Should server environment variables use Nuxt runtimeConfig?▼

No. Resolvers in `server/utils/environment.ts` take the environment record as an argument instead, because runtimeConfig defaults are baked at build time and require `NUXT_`-prefixed names, while deployments set variables like `GITHUB_WEBHOOK_SECRET` at run time.