{
  "docVersion": 1,
  "id": "template-iot-fleet-telemetry",
  "name": "IoT — fleet telemetry & control",
  "purpose": "Factory devices speak local protocols to an edge gateway; MQTT carries telemetry through a funnel into the stream and twin store; operators command devices by writing desired state that devices reconcile on reconnect.",
  "nodes": {
    "dev": {
      "type": "iot",
      "label": "Sensor Fleet",
      "x": 0,
      "y": 240,
      "runtime": "10k devices · sleepy",
      "notes": "Battery-powered, intermittently connected. Assume any device is offline at any moment — the architecture must not care."
    },
    "egw": {
      "type": "edge",
      "label": "Edge Gateway",
      "x": 260,
      "y": 240,
      "runtime": "Modbus/BLE → MQTT",
      "color": "amber",
      "patterns": [
        "standby"
      ],
      "notes": "Runs on-site: translates local protocols, buffers during WAN outages, and pre-aggregates chatty sensors."
    },
    "broker": {
      "type": "mqtt",
      "label": "MQTT Broker",
      "x": 520,
      "y": 240,
      "runtime": "QoS 1 · persistent sessions",
      "color": "purple",
      "patterns": [
        "replicated"
      ],
      "notes": "Persistent sessions queue messages for sleeping devices; backpressure slows the fleet during reconnect storms."
    },
    "funnel": {
      "type": "gateway",
      "label": "Ingestion Funnel",
      "x": 780,
      "y": 120,
      "runtime": "validate · dedup · budget",
      "patterns": [
        "stateless",
        "autoscale"
      ]
    },
    "log": {
      "type": "stream",
      "label": "Telemetry Stream",
      "x": 1040,
      "y": 120,
      "runtime": "keyed by device",
      "patterns": [
        "sharded"
      ]
    },
    "ts": {
      "type": "timeseries",
      "label": "Telemetry Store",
      "x": 1300,
      "y": 120,
      "runtime": "downsampled tiers",
      "patterns": [
        "backup"
      ]
    },
    "twin": {
      "type": "worker",
      "label": "Twin Service",
      "x": 780,
      "y": 380,
      "runtime": "desired ⇄ reported",
      "color": "blue",
      "notes": "The cloud-side shadow of every device. Commands write desired state here; devices pull the delta and reconcile when they wake."
    },
    "state": {
      "type": "keyvalue",
      "label": "Twin Store",
      "x": 1040,
      "y": 380,
      "runtime": "per-device JSON docs"
    },
    "ctl": {
      "type": "bff",
      "label": "Control API",
      "x": 780,
      "y": 600,
      "runtime": "fleet ops · rollouts"
    },
    "ops": {
      "type": "user",
      "label": "Operator",
      "x": 520,
      "y": 600,
      "runtime": "sets firmware v2 target"
    }
  },
  "edges": {
    "e1": {
      "from": "dev",
      "to": "egw",
      "fromSide": "right",
      "toSide": "left",
      "label": "Modbus / BLE",
      "animated": true
    },
    "e2": {
      "from": "egw",
      "to": "broker",
      "fromSide": "right",
      "toSide": "left",
      "label": "MQTT · QoS 1",
      "animated": true,
      "patterns": [
        "batch",
        "compressed"
      ]
    },
    "e3": {
      "from": "broker",
      "to": "funnel",
      "fromSide": "right",
      "toSide": "left",
      "label": "telemetry topics",
      "animated": true,
      "patterns": [
        "backpressure",
        "dedup"
      ]
    },
    "e4": {
      "from": "funnel",
      "to": "log",
      "fromSide": "right",
      "toSide": "left",
      "label": "admitted",
      "patterns": [
        "rate-limit"
      ]
    },
    "e5": {
      "from": "log",
      "to": "ts",
      "fromSide": "right",
      "toSide": "left",
      "label": "append",
      "patterns": [
        "idempotent"
      ]
    },
    "e6": {
      "from": "broker",
      "to": "twin",
      "fromSide": "bottom",
      "toSide": "left",
      "label": "reported state",
      "style": "dashed"
    },
    "e7": {
      "from": "twin",
      "to": "state",
      "fromSide": "right",
      "toSide": "left",
      "label": "merge report"
    },
    "e8": {
      "from": "ops",
      "to": "ctl",
      "fromSide": "right",
      "toSide": "left",
      "label": "set desired"
    },
    "e9": {
      "from": "ctl",
      "to": "twin",
      "fromSide": "top",
      "toSide": "bottom",
      "label": "desired state write",
      "patterns": [
        "authenticated",
        "idempotent"
      ]
    },
    "e10": {
      "from": "twin",
      "to": "broker",
      "fromSide": "left",
      "toSide": "right",
      "label": "delta on reconnect",
      "style": "dashed",
      "color": "green"
    }
  },
  "boxes": {
    "b1": {
      "x": -40,
      "y": 120,
      "w": 460,
      "h": 340,
      "label": "factory site — survives WAN loss",
      "color": "amber",
      "opacity": 0.04
    },
    "b2": {
      "x": 740,
      "y": 20,
      "w": 740,
      "h": 500,
      "label": "cloud — assumes devices are offline",
      "color": "blue",
      "opacity": 0.04
    }
  },
  "texts": {
    "t1": {
      "x": 0,
      "y": 560,
      "text": "commands are not RPCs here: the operator writes\nDESIRED state, the device reports ACTUAL state,\nand reconciliation happens whenever the device\nwakes up — minutes or days later.",
      "color": "green",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}