The problem
After using Cloudflare Durable Objects to build event buffers, schedulers, queues, and workflows, you keep running into the same trap: too much business logic living inside each Durable Object. Durable Objects are powerful, but their API is imperative. You’re managing state, handling alarms, coordinating storage operations. The business logic gets tangled up with the infrastructure concerns. When you pick up Effect, everything clicks — composable programs, type-safe error handling, dependency injection. But bridging the gap between effectful programs and the Durable Object API isn’t straightforward. Effect wants to own the world, and Durable Objects have their own opinions about how things should work.The vision
durable-effect provides open-source abstractions on top of durable runtimes, aimed at making durable concepts more effectful. The goal: write your business logic as pure Effect programs, and let the abstractions handle the durability concerns — persistence, retries, scheduling, resumption.Experimental — APIs may change. Currently only supports Cloudflare Durable Objects as the execution engine.
The three packages
@durable-effect/workflow
Write multi-step programs that survive server restarts, network failures, and deployments. Steps cache their results and replay automatically on resume. Supports durable sleeps from seconds to months.
@durable-effect/jobs
Three job patterns — Continuous for recurring scheduled work, Debounce for batching rapid events, and Task for user-controlled event-driven state machines. Each instance runs in its own Durable Object.
@durable-effect/task
A lower-level primitive for building durable, event-driven state machines. Define typed state and event schemas, write
onEvent and onAlarm handlers, and test without Cloudflare using in-memory implementations.Which package should you use?
| Need | Package |
|---|---|
| A sequence of steps with sleeps in between | @durable-effect/workflow |
| Background work that runs on a schedule | @durable-effect/jobs (Continuous) |
| Batching many events before processing | @durable-effect/jobs (Debounce) |
| An event-driven state machine you control | @durable-effect/jobs (Task) or @durable-effect/task |
| Low-level control and in-memory testing | @durable-effect/task |
