Skip to content
Back to skills

Orpc Router

ASecurity

Understanding routers in oRPC — nestable objects composed of procedures.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
toolsgit

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add ali-master/skills --skill orpc-router --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Orpc Router?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Orpc Router
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ali-master-orpc-router/badge)](https://www.skillsdirectory.com/skills/ali-master-orpc-router)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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']
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.