#What it is
Dispatch is durable execution as a library. Background jobs, multi-step workflows, distributed cron and worker coordination, imported into your process rather than run as a separate service.
#What it gives you
- Jobs: typed handlers, priority enqueue, configurable retry with backoff.
- Workflows: multi-step functions with checkpointing, parallel steps and event waiting. A worker that dies mid-run resumes at the last checkpoint instead of restarting.
- Cron: leader-elected so exactly one worker fires a schedule, with per-tenant entries.
- Dead letter queue: automatic promotion once retries are exhausted, then inspect, replay or purge.
- Cluster coordination: worker registration, heartbeats, leader election and work stealing.
- Middleware: a composable chain for logging, tracing, metrics, panic recovery and scope injection.
- Observability: OpenTelemetry metrics and traces built in, and Relay integration that emits a typed webhook at every lifecycle point.
Storage is pluggable: memory, PostgreSQL via pgx, Grove, SQLite or Redis.
#The scaling caveat
Workers scale with the process they live in, which is the honest cost of the library model. Running the same binary in a worker-only mode gets most of the way there, and it is a workaround rather than a solution. If you need workers to scale entirely independently of your API tier, a separate service is the right answer and Dispatch is a reasonable way to build one.