Skip to content
Back to skills

Orpc Worker Threads

ASecurity

Type-safe oRPC communication between Node.js worker threads via the Message Port adapter.

  • 8 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
toolsnodenodejsgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 12, 2026

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

Installs 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 with every re-scan.

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

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 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).

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.