{
  "schemaVersion": "0.1",
  "diagramFamily": "architecture",
  "scene": { "id": "saas-platform", "title": "Modern SaaS Platform", "units": "px", "canvas": { "width": 1400, "height": 1200 } },
  "elements": [
    { "id": "clients", "kind": "frame", "title": "Clients", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 30, "width": 1080, "height": 170 },
      "children": ["web", "mobile", "api_consumer"] },
    { "id": "web", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Web App", "icon": "lucide:monitor",
      "layout": { "mode": "absolute", "x": 230, "y": 75, "width": 180, "height": 110 } },
    { "id": "mobile", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Mobile App", "icon": "lucide:smartphone",
      "layout": { "mode": "absolute", "x": 490, "y": 75, "width": 180, "height": 110 } },
    { "id": "api_consumer", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Public API", "icon": "lucide:code",
      "layout": { "mode": "absolute", "x": 750, "y": 75, "width": 180, "height": 110 } },
    { "id": "edge", "kind": "frame", "title": "Edge", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 220, "width": 1080, "height": 170 },
      "children": ["cdn", "waf"] },
    { "id": "cdn", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "CDN", "icon": "lucide:globe",
      "layout": { "mode": "absolute", "x": 330, "y": 265, "width": 200, "height": 110 } },
    { "id": "waf", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "WAF", "icon": "lucide:shield",
      "layout": { "mode": "absolute", "x": 630, "y": 265, "width": 200, "height": 110 } },
    { "id": "api", "kind": "frame", "title": "API Layer", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 410, "width": 1080, "height": 170 },
      "children": ["gateway", "auth"] },
    { "id": "gateway", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "API Gateway", "icon": "lucide:network",
      "layout": { "mode": "absolute", "x": 330, "y": 455, "width": 200, "height": 110 } },
    { "id": "auth", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Auth Service", "icon": "lucide:lock",
      "layout": { "mode": "absolute", "x": 630, "y": 455, "width": 200, "height": 110 } },
    { "id": "services", "kind": "frame", "title": "Services", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 600, "width": 1080, "height": 170 },
      "children": ["users", "catalog", "orders", "payments", "notifs"] },
    { "id": "users", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Users", "icon": "lucide:users",
      "layout": { "mode": "absolute", "x": 110, "y": 645, "width": 140, "height": 110 } },
    { "id": "catalog", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Catalog", "icon": "lucide:boxes",
      "layout": { "mode": "absolute", "x": 310, "y": 645, "width": 140, "height": 110 } },
    { "id": "orders", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Orders", "icon": "lucide:package",
      "layout": { "mode": "absolute", "x": 510, "y": 645, "width": 140, "height": 110 } },
    { "id": "payments", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Payments", "icon": "lucide:layers",
      "layout": { "mode": "absolute", "x": 710, "y": 645, "width": 140, "height": 110 } },
    { "id": "notifs", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Notifications", "icon": "lucide:bell",
      "layout": { "mode": "absolute", "x": 910, "y": 645, "width": 140, "height": 110 } },
    { "id": "async", "kind": "frame", "title": "Async", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 790, "width": 1080, "height": 170 },
      "children": ["event_bus", "workers", "scheduler"] },
    { "id": "event_bus", "kind": "node", "nodeType": "queue", "shape": "roundedRect", "label": "Event Bus", "icon": "lucide:zap",
      "layout": { "mode": "absolute", "x": 230, "y": 835, "width": 180, "height": 110 } },
    { "id": "workers", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Workers", "icon": "lucide:cpu",
      "layout": { "mode": "absolute", "x": 490, "y": 835, "width": 180, "height": 110 } },
    { "id": "scheduler", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Scheduler", "icon": "lucide:clock",
      "layout": { "mode": "absolute", "x": 750, "y": 835, "width": 180, "height": 110 } },
    { "id": "data", "kind": "frame", "title": "Data Plane", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 40, "y": 980, "width": 1080, "height": 170 },
      "children": ["postgres", "redis", "search", "storage"] },
    { "id": "postgres", "kind": "node", "nodeType": "database", "shape": "cylinder", "label": "PostgreSQL", "icon": "lucide:database",
      "layout": { "mode": "absolute", "x": 170, "y": 1010, "width": 160, "height": 130 } },
    { "id": "redis", "kind": "node", "nodeType": "database", "shape": "cylinder", "label": "Redis", "icon": "lucide:database",
      "layout": { "mode": "absolute", "x": 390, "y": 1010, "width": 160, "height": 130 } },
    { "id": "search", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Search Index", "icon": "lucide:search",
      "layout": { "mode": "absolute", "x": 610, "y": 1025, "width": 160, "height": 110 } },
    { "id": "storage", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Object Storage", "icon": "lucide:hard-drive",
      "layout": { "mode": "absolute", "x": 830, "y": 1025, "width": 160, "height": 110 } },
    { "id": "observability", "kind": "frame", "title": "Observability", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 1160, "y": 30, "width": 220, "height": 550 },
      "children": ["logs", "metrics", "tracing"] },
    { "id": "logs", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Logs", "icon": "lucide:terminal",
      "layout": { "mode": "absolute", "x": 1190, "y": 90, "width": 160, "height": 110 } },
    { "id": "metrics", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Metrics", "icon": "lucide:bar-chart",
      "layout": { "mode": "absolute", "x": 1190, "y": 240, "width": 160, "height": 110 } },
    { "id": "tracing", "kind": "node", "nodeType": "service", "shape": "roundedRect", "label": "Tracing", "icon": "lucide:activity",
      "layout": { "mode": "absolute", "x": 1190, "y": 390, "width": 160, "height": 110 } },
    { "id": "external", "kind": "frame", "title": "External", "containerType": "generic",
      "style": { "fill": "rgba(255, 255, 255, 0.5)", "dash": [4, 4], "cornerRadius": 8 },
      "layout": { "mode": "absolute", "x": 1160, "y": 600, "width": 220, "height": 540 },
      "children": ["stripe", "sendgrid"] },
    { "id": "stripe", "kind": "node", "nodeType": "externalSystem", "shape": "roundedRect", "label": "Payment\nProvider", "icon": "lucide:external-link",
      "layout": { "mode": "absolute", "x": 1190, "y": 700, "width": 160, "height": 110 } },
    { "id": "sendgrid", "kind": "node", "nodeType": "externalSystem", "shape": "roundedRect", "label": "Email\nProvider", "icon": "lucide:mail",
      "layout": { "mode": "absolute", "x": 1190, "y": 880, "width": 160, "height": 110 } },
    { "id": "e_web_cdn", "kind": "edge", "from": { "elementId": "web" }, "to": { "elementId": "cdn" }, "label": "HTTPS", "router": "orthogonal" },
    { "id": "e_mob_cdn", "kind": "edge", "from": { "elementId": "mobile" }, "to": { "elementId": "cdn" }, "label": "HTTPS", "router": "orthogonal" },
    { "id": "e_api_cdn", "kind": "edge", "from": { "elementId": "api_consumer" }, "to": { "elementId": "cdn" }, "label": "HTTPS", "router": "orthogonal" },
    { "id": "e_cdn_waf", "kind": "edge", "from": { "elementId": "cdn" }, "to": { "elementId": "waf" }, "router": "orthogonal" },
    { "id": "e_waf_gw", "kind": "edge", "from": { "elementId": "waf" }, "to": { "elementId": "gateway" }, "router": "orthogonal" },
    { "id": "e_gw_auth", "kind": "edge", "from": { "elementId": "gateway" }, "to": { "elementId": "auth" }, "label": "validates", "router": "orthogonal" },
    { "id": "e_gw_users", "kind": "edge", "from": { "elementId": "gateway" }, "to": { "elementId": "users" }, "router": "orthogonal" },
    { "id": "e_gw_catalog", "kind": "edge", "from": { "elementId": "gateway" }, "to": { "elementId": "catalog" }, "router": "orthogonal" },
    { "id": "e_gw_orders", "kind": "edge", "from": { "elementId": "gateway" }, "to": { "elementId": "orders" }, "router": "orthogonal" },
    { "id": "e_orders_payments", "kind": "edge", "from": { "elementId": "orders" }, "to": { "elementId": "payments" }, "label": "triggers", "router": "orthogonal" },
    { "id": "e_users_db", "kind": "edge", "from": { "elementId": "users" }, "to": { "elementId": "postgres" }, "label": "queries", "router": "orthogonal" },
    { "id": "e_catalog_search", "kind": "edge", "from": { "elementId": "catalog" }, "to": { "elementId": "search" }, "label": "indexes", "router": "orthogonal" },
    { "id": "e_orders_db", "kind": "edge", "from": { "elementId": "orders" }, "to": { "elementId": "postgres" }, "router": "orthogonal" },
    { "id": "e_orders_redis", "kind": "edge", "from": { "elementId": "orders" }, "to": { "elementId": "redis" }, "label": "cache", "router": "orthogonal" },
    { "id": "e_orders_evt", "kind": "edge", "from": { "elementId": "orders" }, "to": { "elementId": "event_bus" }, "label": "publishes", "router": "orthogonal", "style": { "dash": [4, 4] } },
    { "id": "e_evt_workers", "kind": "edge", "from": { "elementId": "event_bus" }, "to": { "elementId": "workers" }, "label": "consumes", "router": "orthogonal", "style": { "dash": [4, 4] } },
    { "id": "e_sched_workers", "kind": "edge", "from": { "elementId": "scheduler" }, "to": { "elementId": "workers" }, "router": "orthogonal" },
    { "id": "e_workers_notifs", "kind": "edge", "from": { "elementId": "workers" }, "to": { "elementId": "notifs" }, "label": "triggers", "router": "orthogonal", "style": { "dash": [4, 4] } },
    { "id": "e_workers_storage", "kind": "edge", "from": { "elementId": "workers" }, "to": { "elementId": "storage" }, "label": "writes", "router": "orthogonal" },
    { "id": "e_payments_stripe", "kind": "edge", "from": { "elementId": "payments" }, "to": { "elementId": "stripe" }, "label": "charges", "router": "orthogonal" },
    { "id": "e_notifs_sendgrid", "kind": "edge", "from": { "elementId": "notifs" }, "to": { "elementId": "sendgrid" }, "label": "emails", "router": "orthogonal" },
    { "id": "e_services_obs", "kind": "edge", "from": { "elementId": "services" }, "to": { "elementId": "observability" }, "label": "telemetry", "router": "orthogonal" }
  ]
}
