Skip to main content
You do not need to re-architect your application, deploy new infrastructure, or rewrite your existing business logic to adopt Siglo. Because Siglo runs in-process as a standard TypeScript library, the fastest path to adoption is migrating one brittle endpoint—such as checkout, user onboarding, or webhook processing—in under 5 minutes. Running from this repository? A self-contained runnable comparison of this guide lives in examples/src/migrate-one-endpoint/migrate-one-endpoint.ts. Execute it directly from the repository root with:

1. Before: A Typical Express Controller with Manual Plumbing

Most backend endpoints start simple and gradually accumulate retry loops, manual rollback state flags, and nested try/catch blocks:

2. Step-by-Step Migration (Zero Service Changes)

Notice that inventoryService, paymentService, and shippingService are ordinary async TypeScript modules. Do not change them. Instead, wrap each call in Step.create() and attach its retry and rollback policy directly to the step.

Step A: Install @siglo/core

(Optional) Install the route adapter for your HTTP framework (@siglo/express, @siglo/fastify, or @siglo/hono):

Step B: Wrap Your Existing Service Calls in Step.create

Create workflows/checkout.workflow.ts:

Step C: Call the Flow from Your Route Handler

You can either invoke checkoutWorkflow.run() directly inside your existing controller or mount it as a one-liner using @siglo/express, @siglo/fastify, or @siglo/hono:

3. What You Just Gained (With Zero New Infrastructure)

By migrating that single endpoint:
  1. Guaranteed LIFO Rollbacks: If createShipment fails, chargeCustomer refunds the payment first, and reserveStock releases the inventory second.
  2. Instant Architecture Diagrams in PRs: Run npx @siglo/cli export workflows/checkout.workflow.ts --format=mermaid to generate an up-to-date Mermaid diagram with retry, timeout, and saga badges.
  3. Deterministic Unit Tests in <5ms: Test retries and rollbacks deterministically without hitting real APIs or waiting on real timers using @siglo/testing (createWorkflowHarness, FakeClock, mockStep).
  4. Drop-In Observability: Add @siglo/monitor for a live local DevTools waterfall (http://localhost:4000) or @siglo/opentelemetry for automatic step-level spans in Jaeger, Grafana, or Datadog.