effect-rpc-server

Implement Effect RPC servers with handler layers, transports, serialization, and middleware.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-rpc-server-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-rpc-server
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-rpc-server
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-rpc-server-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/platform-node.

What problem does it solve? Building the server side of an Effect RPC API requires correctly composing handler layers, protocol transports, serialization formats, and middleware, and mistakes in any of these cause subtle runtime failures like broken backpressure, lost stack traces, or ungraceful shutdowns. ## Core Features & Use Cases - Handler Layers: Build handlers with RpcGroup.toLayer, toLayerHandler, or accessHandler, including deferred responses, per-request scopes, and Rpc.fork/Rpc.uninterruptible wrappers. - Transports & Serialization: Choose between HTTP, WebSocket, TCP socket, stdio, and worker protocols, paired with JSON, NDJSON, JSON-RPC, or MessagePack wire formats, with clear rules on framing and backpressure. - Middleware, Streaming & Lifecycle: Implement RpcMiddleware with typed errors and provided services, serve streaming rpcs with ack-based backpressure, handle client aborts via the ClientAbort annotation, and test servers in-process with RpcTest. - Use Case: Mount a UserRpcs group on an HttpRouter with NDJSON serialization and auth middleware, then verify handlers with RpcTest.makeClient before deploying behind NodeHttpServer. ## Quick Start Ask the assistant to implement an Effect RpcServer for your RpcGroup with HTTP transport, NDJSON serialization, and an authentication middleware layer.

Frequently Asked Questions about effect-rpc-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement an Effect RPC server for an RpcGroup?

Build handlers with RpcGroup.toLayer or toLayerHandler, then pass the group to RpcServer.layer along with a protocol layer like layerProtocolHttp and a serialization layer like layerNdjson. Serve it through HttpRouter.serve with NodeHttpServer for a full Node setup.

Which serialization format should I use for Effect RPC?

Use layerNdjson or layerMsgPack for framed formats that support streaming responses over HTTP and raw TCP sockets. Plain layerJson only works over WebSocket or buffered HTTP, since it cannot split a byte stream into messages.

How do I add authentication middleware to Effect RPC handlers?

Define an RpcMiddleware.Service with an error schema and optional provides services, then implement it as a Layer whose function wraps the handler effect. Attach it per-rpc or to the whole group, and provide the layer to RpcServer.layer.

Does Effect RPC support streaming responses with backpressure?

Yes, stream: true rpcs return a Stream or Queue and the server batches values into Chunk messages. Backpressure via client Ack messages works on WebSocket, TCP, stdio, and worker transports, but not on plain HTTP.

How do I test Effect RPC handlers without a network?

Use RpcTest.makeClient to create an in-process client wired to your handler and middleware layers with no transport. For single handlers, group.accessHandler resolves one handler with its captured services for direct unit testing.

What happens to in-flight Effect RPC requests during shutdown?

On scope close the server rejects new messages, interrupts in-flight handler fibers, and flushes each final Exit before sending ClientEnd per client. Handlers wrapped in Rpc.uninterruptible run to completion even through shutdown.