Use oRPC inside a Nuxt.js project.
Scanned 9/12/2026
Install to Claude Code
npx -y skills add ali-master/skills --skill orpc-nuxt --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Orpc Nuxt?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/ali-master-orpc-nuxt)More formats (shields.io, HTML) on the badges page.
---
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 } }
})
```
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!