End-to-end composition guides
For architecture, durable handoffs, and diagrams of failure and recovery, start with:
- Recurring billing: a renewal clock and independently retried charges.
- Email delivery and archive: routing, independent fanout targets, and dead-letter redrive.
- Live job dashboard: authoritative jobs, a durable projection, and browser synchronization.
- Account-wide concurrency: shared admission across job objects and recovery of lost releases.
- Replayable event stream: partitioned logs, independent consumers, and cold storage.
See composition design for how to choose object boundaries and recovery paths.
Source examples
The repository’s examples/ workspace is typechecked with the libraries. The getting-started example is self-contained. The other examples are integration recipes and may need application authentication, external service bindings, R2/KV resources, or build-time wiring before deployment.
| Example | Demonstrates | Source |
|---|---|---|
| Getting started | Self-contained word-count jobs, stable IDs, HTTP acceptance, and result lookup | Worker |
| Image jobs | Operation registration, upstream idempotency keys, result polling, and terminal failures | Worker |
| Subscription renewals | Shared scheduler, named alarms, and operation chaining | Worker |
| Email queue | Routing, independent fanout, archive storage, DLQ, and redrive | Worker and Vite config |
| Event topics | Retained log, consumer positions, retention, and cold storage | Worker |
| Realtime todos | Authenticated socket boundary, typed RPC, events, and TanStack DB | Worker and browser client |
| Job dashboard | Tracking across objects, fanout push, and RPC handles that wait | Worker |
| Account concurrency | Semaphore holder, admission queue, and permit lifecycle | Worker |
| RPC transforms | Typed caller/callee wrapping and context propagation | Worker |
Read each example’s configuration and the repository example catalog for required bindings. Example snippets are not a promise that an external side effect is exactly once.
Validate examples locally
From the repository root:
pnpm install
pnpm build
pnpm --filter durability-examples typecheckThe typecheck verifies API usage, not service credentials, production resources, or external business behavior. The library’s unit and Worker integration tests run separately:
pnpm --filter durability testWorker integration tests run locally through @cloudflare/vitest-pool-workers without Cloudflare credentials.