Skip to content
Back to skills

Orpc Nuxt

ASecurity

Use oRPC inside a Nuxt.js project.

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

Works with

  • cli

Security analysis

A100/100

Scanned September 12, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Orpc Nuxt?

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

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

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 Nuxt.js Adapter
description: Use oRPC inside a Nuxt.js project.
license: MIT
metadata:
  author: Ali Torki
  homepage: https://github.com/ali-master
  version: "1.0.0"
---

# Nuxt.js Adapter

[Nuxt.js](https://nuxt.com/) integration.

## Server

```ts
// server/routes/rpc/[...].ts
import { RPCHandler } from '@orpc/server/fetch'
import { onError } from '@orpc/server'

const handler = new RPCHandler(router, {
  interceptors: [onError(e => console.error(e))],
})

export default defineEventHandler(async (event) => {
  const request = toWebRequest(event)
  const { response } = await handler.handle(request, {
    prefix: '/rpc',
    context: {},
  })

  if (response) return response

  setResponseStatus(event, 404, 'Not Found')
  return 'Not found'
})
```

```ts
// server/routes/rpc/index.ts
export { default } from './[...]'
```

## Client

Set up in a [Nuxt Plugin](https://nuxt.com/docs/guide/directory-structure/plugins) for SSR compatibility:

```ts
// app/plugins/orpc.ts
export default defineNuxtPlugin(() => {
  const event = useRequestEvent()

  const link = new RPCLink({
    url: `${typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000'}/rpc`,
    headers: event?.headers,
  })

  const client: RouterClient<typeof router> = createORPCClient(link)

  return { provide: { client } }
})
```

## Optimize SSR

```ts
// app/plugins/orpc.client.ts
export default defineNuxtPlugin(() => {
  const link = new RPCLink({
    url: `${window.location.origin}/rpc`,
    headers: () => ({}),
  })

  const client: RouterClient<typeof router> = createORPCClient(link)

  return { provide: { client } }
})
```

```ts
// app/plugins/orpc.server.ts
export default defineNuxtPlugin((nuxt) => {
  const event = useRequestEvent()

  const client = createRouterClient(router, {
    context: { headers: event?.headers },
  })

  return { provide: { client } }
})
```

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.