Understanding routers in oRPC — nestable objects composed of procedures.
Scanned 9/12/2026
Install to Claude Code
npx -y skills add ali-master/skills --skill orpc-router --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Orpc Router?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/ali-master-orpc-router)More formats (shields.io, HTML) on the badges page.
---
name: oRPC Router
description: Understanding routers in oRPC — nestable objects composed of procedures.
license: MIT
metadata:
author: Ali Torki
homepage: https://github.com/ali-master
version: "1.0.0"
---
# Router in oRPC
Routers are simple, nestable objects composed of procedures.
## Overview
```ts
import { os } from '@orpc/server'
const ping = os.handler(async () => 'ping')
const pong = os.handler(async () => 'pong')
const router = {
ping,
pong,
nested: { ping, pong }
}
```
## Extending Router
```ts
const router = os.use(requiredAuth).router({
ping,
pong,
nested: { ping, pong }
})
```
> Avoid duplicate middleware execution. See [Dedupe Middleware](/docs/best-practices/dedupe-middleware).
## Lazy Router
```ts
// router.ts
const router = {
ping,
pong,
planet: os.lazy(() => import('./planet'))
}
```
```ts
// planet.ts
export const listPlanet = os
.input(z.object({ limit: z.number().optional() }))
.handler(async ({ input }) => [{ id: 1, name: 'name' }])
export default {
list: listPlanet,
}
```
Alternative using the standalone `lazy` helper (faster type inference):
```ts
import { lazy } from '@orpc/server'
const router = {
ping,
pong,
planet: lazy(() => import('./planet'))
}
```
## Utilities
```ts
import type {
InferRouterInputs, InferRouterOutputs,
InferRouterInitialContexts, InferRouterCurrentContexts
} from '@orpc/server'
type Inputs = InferRouterInputs<typeof router>
type Outputs = InferRouterOutputs<typeof router>
type InitialContexts = InferRouterInitialContexts<typeof router>
type CurrentContexts = InferRouterCurrentContexts<typeof router>
type FindPlanetInput = Inputs['planet']['find']
type FindPlanetOutput = Outputs['planet']['find']
```
Is this your skill, or is something wrong with this listing? . Author removals are honored within 72 hours.
No comments yet. Be the first to comment!