{
  "docVersion": 1,
  "id": "template-api-platform",
  "name": "API platform",
  "purpose": "Public API reference: REST gateway aggregation and GraphQL federation as alternative composition styles, idempotent writes, batched reads, signed webhook delivery.",
  "nodes": {
    "dev": {
      "type": "user",
      "label": "API Consumers",
      "x": 20,
      "y": 300,
      "runtime": "partners + apps"
    },
    "gw": {
      "type": "gateway",
      "label": "REST Gateway",
      "x": 280,
      "y": 420,
      "runtime": "aggregation · rate limits",
      "patterns": [
        "stateless"
      ]
    },
    "fed": {
      "type": "graphql",
      "label": "GraphQL Federation",
      "x": 280,
      "y": 100,
      "runtime": "one graph, many subgraphs",
      "color": "purple",
      "notes": "Each service owns its subgraph; the router composes one schema. Clients ask for exactly what they need."
    },
    "loader": {
      "type": "worker",
      "label": "DataLoader Layer",
      "x": 540,
      "y": 100,
      "runtime": "batch + dedupe per request",
      "patterns": [
        "stateless"
      ]
    },
    "svc1": {
      "type": "k8s",
      "label": "Orders API",
      "x": 800,
      "y": 180,
      "runtime": "subgraph + REST",
      "patterns": [
        "stateless",
        "autoscale"
      ]
    },
    "svc2": {
      "type": "k8s",
      "label": "Users API",
      "x": 800,
      "y": 380,
      "runtime": "subgraph + REST",
      "patterns": [
        "stateless"
      ]
    },
    "idem": {
      "type": "keyvalue",
      "label": "Idempotency Store",
      "x": 540,
      "y": 560,
      "runtime": "key → response, TTL 24h"
    },
    "hooks": {
      "type": "webhook",
      "label": "Webhook Dispatcher",
      "x": 800,
      "y": 620,
      "runtime": "signed · retried · dead-lettered",
      "color": "green",
      "notes": "Signs payloads (HMAC + timestamp), retries with backoff, gives up into a DLQ with replay tooling."
    },
    "ext": {
      "type": "partnerapi",
      "label": "Partner Endpoint",
      "x": 1060,
      "y": 620,
      "runtime": "their infrastructure, their bugs"
    }
  },
  "edges": {
    "e1": {
      "from": "dev",
      "to": "fed",
      "fromSide": "top",
      "toSide": "left",
      "label": "GraphQL — one query",
      "animated": true
    },
    "e2": {
      "from": "dev",
      "to": "gw",
      "fromSide": "bottom",
      "toSide": "left",
      "label": "REST · Idempotency-Key",
      "animated": true,
      "patterns": [
        "idempotent",
        "rate-limit"
      ]
    },
    "e3": {
      "from": "fed",
      "to": "loader",
      "fromSide": "right",
      "toSide": "left",
      "label": "batched resolvers",
      "patterns": [
        "batch"
      ]
    },
    "e4": {
      "from": "loader",
      "to": "svc1",
      "fromSide": "right",
      "toSide": "left",
      "label": "one query for N ids"
    },
    "e5": {
      "from": "loader",
      "to": "svc2",
      "fromSide": "right",
      "toSide": "left"
    },
    "e6": {
      "from": "gw",
      "to": "svc1",
      "fromSide": "right",
      "toSide": "left",
      "label": "aggregate"
    },
    "e7": {
      "from": "gw",
      "to": "svc2",
      "fromSide": "right",
      "toSide": "left"
    },
    "e8": {
      "from": "gw",
      "to": "idem",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "dedupe writes",
      "style": "dashed"
    },
    "e9": {
      "from": "svc1",
      "to": "hooks",
      "fromSide": "bottom",
      "toSide": "top",
      "label": "domain events",
      "style": "dashed"
    },
    "e10": {
      "from": "hooks",
      "to": "ext",
      "fromSide": "right",
      "toSide": "left",
      "label": "signed webhook",
      "animated": true,
      "patterns": [
        "retry",
        "authenticated",
        "timeout"
      ]
    }
  },
  "texts": {
    "t1": {
      "x": 20,
      "y": 520,
      "text": "pick ONE composition style per client\nclass — running both for the same\nclients doubles every schema change",
      "color": "purple",
      "size": 12
    },
    "t2": {
      "x": 1060,
      "y": 480,
      "text": "webhook contract:\nHMAC signature + timestamp window\n(replay protection), retries with\nbackoff, DLQ + manual replay",
      "color": "green",
      "size": 12
    }
  },
  "meta": {
    "createdAt": "2026-07-13T09:00:00.000Z",
    "modifiedAt": "2026-07-13T09:00:00.000Z"
  }
}