{
  "docVersion": 1,
  "id": "template-dynamo-style-kv-store",
  "name": "Dynamo-style KV store",
  "purpose": "Leaderless key-value store: any node coordinates, writes need W=2 of RF=3, dead replicas get hints, read-repair and Merkle trees drive convergence, vector clocks flag conflicts.",
  "nodes": {
    "client": {
      "type": "user",
      "label": "Client",
      "x": 20,
      "y": 250,
      "runtime": "put(k,v) · get(k)"
    },
    "coord": {
      "type": "server",
      "label": "Coordinator",
      "x": 290,
      "y": 250,
      "runtime": "any node · ring lookup",
      "color": "blue",
      "patterns": [
        "stateless"
      ],
      "notes": "Every node can coordinate: hashes the key onto the ring, picks the RF=3 replica set, waits for W=2 acks. Attaches vector clocks so concurrent writes surface as siblings instead of being lost."
    },
    "ra": {
      "type": "keyvalue",
      "label": "Replica A",
      "x": 630,
      "y": 30,
      "runtime": "ack ✓",
      "color": "green"
    },
    "rb": {
      "type": "keyvalue",
      "label": "Replica B",
      "x": 630,
      "y": 200,
      "runtime": "ack ✓",
      "color": "green",
      "notes": "On reads, if this replica returns a stale version the coordinator writes the newest value back — read-repair heals the hot path for free."
    },
    "rc": {
      "type": "keyvalue",
      "label": "Replica C",
      "x": 630,
      "y": 370,
      "runtime": "DOWN",
      "color": "red",
      "style": "dashed"
    },
    "hint": {
      "type": "storage",
      "label": "Node D — hint store",
      "x": 630,
      "y": 540,
      "w": 190,
      "color": "amber",
      "runtime": "hint: (C, k=v)",
      "notes": "Not a replica — a mailbox. Holds C's undelivered write and replays it when C rejoins. Hints expire; Merkle repair is the guarantee beyond the window."
    }
  },
  "edges": {
    "e1": {
      "from": "client",
      "to": "coord",
      "fromSide": "right",
      "toSide": "left",
      "label": "put(k,v) · W=2",
      "animated": true,
      "patterns": [
        "timeout",
        "retry"
      ]
    },
    "e2": {
      "from": "coord",
      "to": "ra",
      "fromSide": "right",
      "toSide": "left",
      "label": "replicate",
      "animated": true
    },
    "e3": {
      "from": "coord",
      "to": "rb",
      "fromSide": "right",
      "toSide": "left",
      "label": "replicate",
      "animated": true
    },
    "e4": {
      "from": "coord",
      "to": "rc",
      "fromSide": "right",
      "toSide": "left",
      "label": "replicate ✗",
      "style": "dashed"
    },
    "e5": {
      "from": "coord",
      "to": "hint",
      "fromSide": "bottom",
      "toSide": "left",
      "label": "store hint for C",
      "style": "dashed",
      "color": "amber"
    },
    "e6": {
      "from": "hint",
      "to": "rc",
      "fromSide": "top",
      "toSide": "bottom",
      "label": "replay when C returns",
      "style": "dashed",
      "color": "amber"
    },
    "e7": {
      "from": "ra",
      "to": "rb",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "Merkle anti-entropy",
      "style": "dashed",
      "dir": "both",
      "color": "purple"
    }
  },
  "boxes": {
    "b1": {
      "x": 590,
      "y": -40,
      "w": 310,
      "h": 720,
      "label": "replica set for key k · RF=3 on the ring",
      "color": "blue",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 20,
      "y": 430,
      "text": "quorum math: W=2 + R=2 > RF=3 →\nevery read overlaps every write.\nA+B ack, so the client gets success\nwith C dead — no failover, no leader.",
      "color": "green",
      "size": 12
    },
    "t2": {
      "x": 20,
      "y": 590,
      "text": "vector clocks: concurrent puts create\nsiblings the client must reconcile —\nDynamo detects conflicts, it doesn't\ninvent a winner (LWW would).",
      "color": "purple",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}