Back to articles
I built a saga workflow engine for Bun (no Temporal, no Redis, no Kafka)
How-ToSystems

I built a saga workflow engine for Bun (no Temporal, no Redis, no Kafka)

via Dev.toEgeo Minotti

TL;DR I built a workflow engine inside bunqueue with first-class saga compensation, retries with exponential backoff, branching, parallel steps, loops, sub-workflows, and human-in-the-loop signals. It runs on Bun + SQLite. Zero external infrastructure. The DSL is plain TypeScript and reads like pseudocode. Source: bunqueue.dev/guide/workflow . The problem nobody wants to deal with Distributed transactions are the most underestimated problem in modern backend. An order comes in. You need to validate it, reserve inventory, charge the card, notify the warehouse, send a confirmation email, update analytics. Six services, six failure points. What happens if the charge succeeds but the warehouse is offline? You just took money from a customer for a product that will never ship. The academic answer is two-phase commit. The pragmatic answer, since 1987, is the Saga Pattern : split the transaction into steps, each with its own compensation, and if anything goes wrong, run the rollbacks in rever

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles