Type-safe oRPC communication between Node.js worker threads via the Message Port adapter.
Scanned 9/12/2026
Install to Claude Code
npx -y skills add ali-master/skills --skill orpc-worker-threads --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Orpc Worker Threads?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/ali-master-orpc-worker-threads)More formats (shields.io, HTML) on the badges page.
---
name: oRPC Worker Threads Adapter
description: Type-safe oRPC communication between Node.js worker threads via the Message Port adapter.
license: MIT
metadata:
author: Ali Torki
homepage: https://github.com/ali-master
version: "1.0.0"
---
# Worker Threads Adapter
Use [Node.js Worker Threads](https://nodejs.org/api/worker_threads.html) with oRPC for type-safe inter-thread communication via the [Message Port Adapter](/docs/adapters/message-port).
## Worker Thread
Listen for a `MessagePort` sent from the main thread and upgrade it:
```ts
import { parentPort } from 'node:worker_threads'
import { RPCHandler } from '@orpc/server/message-port'
import { onError } from '@orpc/server'
const handler = new RPCHandler(router, {
interceptors: [onError(error => console.error(error))],
})
parentPort.on('message', (message) => {
if (message instanceof MessagePort) {
handler.upgrade(message, {
context: {},
})
message.start()
}
})
```
## Main Thread
Create a `MessageChannel`, send one port to the worker, use the other to initialize the client link:
```ts
import { MessageChannel, Worker } from 'node:worker_threads'
import { RPCLink } from '@orpc/client/message-port'
const { port1: clientPort, port2: serverPort } = new MessageChannel()
const worker = new Worker('some-worker.js')
worker.postMessage(serverPort, [serverPort])
const link = new RPCLink({
port: clientPort,
})
clientPort.start()
```
For full client examples, see [Client-Side Clients](/docs/client/client-side).
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!