{
  "docVersion": 1,
  "id": "template-food-delivery-platform",
  "name": "Food delivery platform",
  "purpose": "Order intake absorbs spikes via a leveling queue; dispatch scatters offers to drivers in geo-partitioned cells and gathers the first acceptance.",
  "nodes": {
    "app": {
      "type": "mobile",
      "label": "Customer App",
      "x": 20,
      "y": 240,
      "runtime": "order + live tracking"
    },
    "gw": {
      "type": "gateway",
      "label": "API Gateway",
      "x": 280,
      "y": 240,
      "runtime": "auth · rate limits",
      "patterns": [
        "stateless"
      ]
    },
    "ordersvc": {
      "type": "k8s",
      "label": "Order Service",
      "x": 540,
      "y": 240,
      "runtime": "validates · prices",
      "color": "blue",
      "patterns": [
        "autoscale",
        "stateless"
      ],
      "notes": "Accepts the order and returns immediately — everything after this line is asynchronous."
    },
    "odb": {
      "type": "database",
      "label": "Orders DB",
      "x": 540,
      "y": 470,
      "runtime": "geo-partitioned by city",
      "patterns": [
        "sharded",
        "backup"
      ]
    },
    "oq": {
      "type": "queue",
      "label": "OrderPlaced",
      "x": 800,
      "y": 240,
      "runtime": "at-least-once · leveled",
      "notes": "The shock absorber: lunch rush enqueues at 900/s, dispatch consumes at a rate kitchens can survive."
    },
    "dispatch": {
      "type": "worker",
      "label": "Dispatch Orchestrator",
      "x": 1060,
      "y": 240,
      "runtime": "auction per order",
      "color": "green",
      "notes": "Scatters ride offers to the K nearest drivers in the order's cell; first acceptance wins, remaining offers are revoked."
    },
    "ws": {
      "type": "websocket",
      "label": "Driver Gateway",
      "x": 1320,
      "y": 240,
      "runtime": "offer push · GPS in"
    },
    "cellA": {
      "type": "users",
      "label": "Drivers — Cell 8a2",
      "x": 1580,
      "y": 110,
      "runtime": "downtown · 214 online"
    },
    "cellB": {
      "type": "users",
      "label": "Drivers — Cell 8b7",
      "x": 1580,
      "y": 380,
      "runtime": "suburbs · 61 online"
    },
    "resto": {
      "type": "server",
      "label": "Restaurant Service",
      "x": 800,
      "y": 470,
      "runtime": "kitchen display · prep times"
    },
    "push": {
      "type": "push",
      "label": "Customer Notify",
      "x": 1060,
      "y": 470,
      "runtime": "status: driver assigned"
    }
  },
  "edges": {
    "e1": {
      "from": "app",
      "to": "gw",
      "fromSide": "right",
      "toSide": "left",
      "label": "place order",
      "animated": true,
      "patterns": [
        "timeout",
        "rate-limit"
      ]
    },
    "e2": {
      "from": "gw",
      "to": "ordersvc",
      "fromSide": "right",
      "toSide": "left",
      "animated": true,
      "patterns": [
        "retry"
      ]
    },
    "e3": {
      "from": "ordersvc",
      "to": "odb",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "write order"
    },
    "e4": {
      "from": "ordersvc",
      "to": "oq",
      "fromSide": "right",
      "toSide": "left",
      "label": "OrderPlaced",
      "animated": true
    },
    "e5": {
      "from": "oq",
      "to": "dispatch",
      "fromSide": "right",
      "toSide": "left",
      "style": "dashed",
      "patterns": [
        "backpressure"
      ]
    },
    "e6": {
      "from": "oq",
      "to": "resto",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "→ kitchen prep",
      "style": "dashed"
    },
    "e7": {
      "from": "dispatch",
      "to": "ws",
      "fromSide": "right",
      "toSide": "left",
      "label": "scatter offers · first-accept wins",
      "animated": true
    },
    "e8": {
      "from": "ws",
      "to": "cellA",
      "fromSide": "right",
      "toSide": "left",
      "label": "offer ×5",
      "style": "dashed"
    },
    "e9": {
      "from": "ws",
      "to": "cellB",
      "fromSide": "right",
      "toSide": "left",
      "style": "dashed"
    },
    "e10": {
      "from": "dispatch",
      "to": "push",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "driver assigned",
      "style": "dashed"
    }
  },
  "boxes": {
    "b1": {
      "x": 1540,
      "y": 20,
      "w": 340,
      "h": 550,
      "label": "geo-partitioned dispatch cells",
      "color": "purple",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 20,
      "y": 440,
      "text": "the auction gather:\noffer 5 nearest drivers, 8s deadline —\nfirst accept wins, others revoked.\nno accepts → widen radius, re-scatter",
      "color": "purple",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}