effect-rpc-server

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

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-rpc-server-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-rpc-server
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-rpc-server
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-rpc-server-mpsuesser

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 lost backpressure, fatal defects, or broken streaming. ## Core Features & Use Cases - Handler Implementation: Build handlers with RpcGroup.toLayer, toLayerHandler, accessHandler, deferred responses, and Rpc.fork/Rpc.uninterruptible wrappers. - Transport & Serialization Selection: Choose between HTTP, WebSocket, TCP socket, stdio, and worker protocols paired with JSON, NDJSON, JSON-RPC, or SchemaBinary wire formats. - Middleware, Streaming & Lifecycle: Implement RpcMiddleware services, streaming handlers with backpressure, client abort detection, graceful shutdown, and in-process testing with RpcTest. - Use Case: Mount a UserRpcs group on an HttpRouter with NDJSON serialization, add an AuthMiddleware that decodes tokens into a CurrentUser service, and stream change-feed results to clients with typed errors. ## Quick Start Ask the agent to implement an Effect RPC server for a given RpcGroup contract, serving it over HTTP with NDJSON serialization and authentication middleware.

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 compose them with RpcServer.layer, a protocol layer such as layerProtocolHttp, and one RpcSerialization layer. Serve the result through HttpRouter.serve with a NodeHttpServer layer.

Which transport should I use for Effect RPC streaming?

Use WebSocket, TCP socket, stdio, or worker transports for streaming because they support acknowledgments that enable backpressure. Plain HTTP never throttles the producer, and only framed serializations like NDJSON or SchemaBinary emit response chunks incrementally.

Does Effect RPC require a separate @effect/rpc package?

No, in Effect v4 everything ships from the effect package under effect/unstable/rpc. There is no @effect/rpc package, so import RpcServer, RpcGroup, RpcMiddleware, and RpcSerialization directly from effect/unstable/rpc.

How do I add authentication middleware to an Effect RPC server?

Define a service with RpcMiddleware.Service declaring an error schema and any provided context, 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.

Why do my Effect RPC handler defects fail every in-flight request?

By default a handler defect is treated as a protocol-level fault that fails all in-flight requests on the connection. Set disableFatalDefects to true in RpcServer.layer options so the defect is delivered only as that single request's Exit.

How do I test Effect RPC handlers without a network transport?

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