{
  "docVersion": 1,
  "id": "template-durable-workflow-fulfillment",
  "name": "Durable workflow — fulfillment",
  "purpose": "Durable-execution reference: deterministic fulfillment workflow replayed from event history, activities with retries, durable timers, cancel signals, compensation saga.",
  "nodes": {
    "api": {
      "type": "k8s",
      "label": "Order API",
      "x": 20,
      "y": 300,
      "runtime": "starts workflows"
    },
    "wf": {
      "type": "orchestrator",
      "label": "Fulfillment Workflow",
      "x": 300,
      "y": 300,
      "w": 170,
      "runtime": "deterministic · replayable",
      "color": "purple",
      "notes": "No I/O, no clocks, no randomness in here — every side effect is an activity. That's what makes replay exact."
    },
    "hist": {
      "type": "storage",
      "label": "Event History",
      "x": 300,
      "y": 80,
      "runtime": "append-only, the truth",
      "patterns": [
        "backup"
      ]
    },
    "timer": {
      "type": "cron",
      "label": "Durable Timer",
      "x": 580,
      "y": 80,
      "runtime": "wait 24h for pickup"
    },
    "tq": {
      "type": "queue",
      "label": "Task Queues",
      "x": 580,
      "y": 300,
      "runtime": "activity dispatch · affinity"
    },
    "signal": {
      "type": "pubsub",
      "label": "Signals",
      "x": 580,
      "y": 540,
      "runtime": "cancel / address change"
    },
    "a1": {
      "type": "lambda",
      "label": "Reserve Inventory",
      "x": 860,
      "y": 80,
      "runtime": "activity · retry ×3"
    },
    "a2": {
      "type": "lambda",
      "label": "Charge Payment",
      "x": 860,
      "y": 240,
      "runtime": "activity · idempotent"
    },
    "a3": {
      "type": "lambda",
      "label": "Book Shipping",
      "x": 860,
      "y": 400,
      "runtime": "activity · retry ×5"
    },
    "a4": {
      "type": "lambda",
      "label": "Notify Customer",
      "x": 860,
      "y": 560,
      "runtime": "activity · best effort"
    },
    "comp": {
      "type": "worker",
      "label": "Compensations",
      "x": 1140,
      "y": 240,
      "runtime": "refund · release · cancel",
      "color": "amber",
      "notes": "The saga in reverse: each completed step knows how to undo itself when a later one fails for good."
    }
  },
  "edges": {
    "e1": {
      "from": "api",
      "to": "wf",
      "fromSide": "right",
      "toSide": "left",
      "label": "start(orderId)",
      "animated": true
    },
    "e2": {
      "from": "wf",
      "to": "hist",
      "fromSide": "top",
      "toSide": "bottom",
      "label": "append + replay",
      "dir": "both"
    },
    "e3": {
      "from": "wf",
      "to": "tq",
      "fromSide": "right",
      "toSide": "left",
      "label": "schedule activities",
      "animated": true
    },
    "e4": {
      "from": "tq",
      "to": "a1",
      "fromSide": "top",
      "toSide": "left",
      "patterns": [
        "retry"
      ]
    },
    "e5": {
      "from": "tq",
      "to": "a2",
      "fromSide": "right",
      "toSide": "left",
      "patterns": [
        "retry",
        "idempotent",
        "timeout"
      ]
    },
    "e6": {
      "from": "tq",
      "to": "a3",
      "fromSide": "bottom",
      "toSide": "left"
    },
    "e7": {
      "from": "tq",
      "to": "a4",
      "fromSide": "bottom",
      "toSide": "left"
    },
    "e8": {
      "from": "timer",
      "to": "wf",
      "fromSide": "left",
      "toSide": "top",
      "label": "fires as history event",
      "style": "dashed"
    },
    "e9": {
      "from": "signal",
      "to": "wf",
      "fromSide": "left",
      "toSide": "bottom",
      "label": "cancel order",
      "style": "dashed"
    },
    "e10": {
      "from": "a2",
      "to": "comp",
      "fromSide": "right",
      "toSide": "left",
      "label": "exhausted retries → unwind",
      "style": "dashed"
    },
    "e11": {
      "from": "comp",
      "to": "a1",
      "fromSide": "top",
      "toSide": "right",
      "label": "release reservation",
      "style": "dashed"
    }
  },
  "boxes": {
    "b1": {
      "x": 820,
      "y": 20,
      "w": 480,
      "h": 700,
      "label": "activities — every side effect lives here",
      "color": "blue",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 20,
      "y": 480,
      "text": "the workflow function is DETERMINISTIC:\ncrash anywhere → replay the history →\nresume mid-flow as if nothing happened",
      "color": "purple",
      "size": 12
    },
    "t2": {
      "x": 20,
      "y": 620,
      "text": "history grows per event — long-lived\nworkflows roll over with continue-as-new,\ncarrying state into a fresh run",
      "color": "gray",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}