Skip to content
Back to skills

Orpc Trpc

ASecurity

Use oRPC features (OpenAPI specs, OpenAPIHandler) inside existing tRPC applications via @orpc/trpc.

  • 30 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 8, 2026
ai-agentsgitapi

Works with

  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned November 8, 2026

npx -y skills add majiayu000/claude-skill-registry-data --skill orpc-trpc --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Orpc Trpc?

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

Security grade badge for Orpc Trpc
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-orpc-trpc/badge)](https://www.skillsdirectory.com/skills/majiayu000-orpc-trpc)

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 tRPC Integration
description: Use oRPC features (OpenAPI specs, OpenAPIHandler) inside existing tRPC applications via @orpc/trpc.
license: MIT
metadata:
  author: Ali Torki
  homepage: https://github.com/ali-master
  version: "1.0.0"
---

# tRPC Integration

Integrate oRPC with tRPC to leverage oRPC features in your existing tRPC applications.

## Installation

```sh
npm install @orpc/trpc@latest
```

## OpenAPI Support

Convert a [tRPC router](https://trpc.io/docs/server/routers) to an [oRPC router](/docs/router) to access most oRPC features.

```ts
import { ORPCMeta, toORPCRouter } from '@orpc/trpc'

export const t = initTRPC.context<Context>().meta<ORPCMeta>().create()

const orpcRouter = toORPCRouter(trpcRouter)
```

> Set the `.meta` type to `ORPCMeta` when creating your tRPC builder for OpenAPI features to function.

```ts
const example = t.procedure
  .meta({ route: { path: '/hello', summary: 'Hello procedure' } })
  .input(z.object({ name: z.string() }))
  .query(({ input }) => `Hello, ${input.name}!`)
```

## Specification Generation

```ts
const openAPIGenerator = new OpenAPIGenerator({
  schemaConverters: [
    new ZodToJsonSchemaConverter(),
    new ValibotToJsonSchemaConverter(),
    new ArkTypeToJsonSchemaConverter(),
  ],
})

const spec = await openAPIGenerator.generate(orpcRouter, {
  info: { title: 'My App', version: '0.0.0' },
})
```

## Request Handling

```ts
const handler = new OpenAPIHandler(orpcRouter, {
  plugins: [new CORSPlugin()],
  interceptors: [onError(error => console.error(error))],
})

export async function fetch(request: Request) {
  const { matched, response } = await handler.handle(request, {
    prefix: '/api',
    context: {},
  })

  return response ?? new Response('Not Found', { status: 404 })
}
```

## Error Formatting

`toORPCRouter` does not support [tRPC Error Formatting](https://trpc.io/docs/server/error-formatting). Catch and format errors via interceptors:

```ts
const handler = new OpenAPIHandler(orpcRouter, {
  interceptors: [
    onError((error) => {
      if (
        error instanceof ORPCError
        && error.cause instanceof TRPCError
        && error.cause.cause instanceof ZodError
      ) {
        throw new ORPCError('INPUT_VALIDATION_FAILED', {
          status: 422,
          data: error.cause.cause.flatten(),
          cause: error.cause.cause,
        })
      }
    })
  ],
})
```

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

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