PRO

Effect Outbox Replicator

A durable replication path plus leak-proof fiber lifecycles. The business record and its outbox entry commit in one atomic Ref.update, closing the dual-write gap where a row is acknowledged to the client but the follow-up publish is lost to a crash. A replicator drains the outbox with a cursor that advances only after a durable apply, giving at-least-once delivery across restarts, and the apply is idempotent on sequence number so the inevitable re-delivery after a crash does not double-apply. Every background worker is forked into a FiberSet owned by a Scope with ensuring finalizers, so no consumer or subscription can be orphaned when its owner shuts down, and a Metric gauge acts as a leak canary that catches a detached fiber that outlived its scope. Solves data loss and memory leaks. Pinned to effect 4.0.0-beta.98.

Install
npx shadcn@latest add https://ui.aryank.space/r/effect-outbox-replicator.json

Installs from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.

Visualization
write path
db insert
Effect<void>
publish
OutboxEntry
await db.insert(order); await bus.publish(event) // gap = data loss

The row commits, the client gets its 200, and then the process dies before the publish. The event is simply gone: the database says the order exists, every downstream consumer says it never happened, and nothing will ever retry it.

Files

Dependencies