{
  "docVersion": 1,
  "id": "template-global-multi-leader-db",
  "name": "Global multi-leader database",
  "purpose": "Active-active database across three regions: local writes everywhere, full-mesh async replication, version vectors for conflict detection — with the LWW data-loss hazard called out.",
  "nodes": {
    "appUS": {
      "type": "k8s",
      "label": "App — US",
      "x": 40,
      "y": 40,
      "runtime": "writes locally",
      "patterns": [
        "stateless"
      ]
    },
    "dbUS": {
      "type": "database",
      "label": "Leader — US",
      "x": 40,
      "y": 260,
      "runtime": "accepts writes",
      "color": "blue",
      "patterns": [
        "multi-region"
      ],
      "notes": "Every region's leader accepts writes immediately (local latency), then streams them to the other two. Concurrent edits to the same row surface as version-vector siblings."
    },
    "appEU": {
      "type": "k8s",
      "label": "App — EU",
      "x": 520,
      "y": 40,
      "runtime": "writes locally",
      "patterns": [
        "stateless"
      ]
    },
    "dbEU": {
      "type": "database",
      "label": "Leader — EU",
      "x": 520,
      "y": 260,
      "runtime": "accepts writes",
      "color": "green",
      "patterns": [
        "multi-region"
      ]
    },
    "appAP": {
      "type": "k8s",
      "label": "App — APAC",
      "x": 1000,
      "y": 40,
      "runtime": "writes locally",
      "patterns": [
        "stateless"
      ]
    },
    "dbAP": {
      "type": "database",
      "label": "Leader — APAC",
      "x": 1000,
      "y": 260,
      "runtime": "accepts writes",
      "color": "purple",
      "patterns": [
        "multi-region"
      ]
    }
  },
  "edges": {
    "e1": {
      "from": "appUS",
      "to": "dbUS",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "write · ~5ms",
      "animated": true
    },
    "e2": {
      "from": "appEU",
      "to": "dbEU",
      "fromSide": "bottom",
      "toSide": "top",
      "animated": true
    },
    "e3": {
      "from": "appAP",
      "to": "dbAP",
      "fromSide": "bottom",
      "toSide": "top",
      "animated": true
    },
    "e4": {
      "from": "dbUS",
      "to": "dbEU",
      "fromSide": "right",
      "toSide": "left",
      "label": "async repl · version vectors",
      "style": "dashed",
      "dir": "both",
      "color": "amber"
    },
    "e5": {
      "from": "dbEU",
      "to": "dbAP",
      "fromSide": "right",
      "toSide": "left",
      "label": "async repl",
      "style": "dashed",
      "dir": "both",
      "color": "amber"
    },
    "e6": {
      "from": "dbUS",
      "to": "dbAP",
      "fromSide": "bottom",
      "toSide": "bottom",
      "label": "async repl · ~180ms RTT",
      "style": "dashed",
      "dir": "both",
      "color": "amber"
    }
  },
  "boxes": {
    "b1": {
      "x": 0,
      "y": -30,
      "w": 350,
      "h": 440,
      "label": "us-east",
      "color": "blue",
      "opacity": 0.04
    },
    "b2": {
      "x": 480,
      "y": -30,
      "w": 350,
      "h": 440,
      "label": "eu-west",
      "color": "green",
      "opacity": 0.04
    },
    "b3": {
      "x": 960,
      "y": -30,
      "w": 350,
      "h": 440,
      "label": "ap-south",
      "color": "purple",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 40,
      "y": 560,
      "text": "HAZARD — last-writer-wins: with clock skew, a write that\nhappened LATER by wall-clock can be silently discarded.\nUse version vectors + application merge for anything you\ncan't afford to lose (carts, counters, documents → CRDTs).",
      "color": "red",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}