WebApp Deployment

WebApp Deployment
Figure 4. WebApp Deployment
Diagram source
Diagram JSON
{
  "shapes": [
    {
      "shapes": [],
      "id": "stepkey-b35f6v~e1793153987183",
      "category": "Always available",
      "type": "markdown",
      "props": {
        "markdown": "### The request path\n\n1. **Browser → Cloudflare** — HTTPS + WebSocket to app.drawmode.ai; the engine and other unchanging files answered from the edge cache\n2. **Cloudflare → Northflank edge** — Full (strict) TLS, the socket passed through\n3. **Edge → a web replica** — HTTP :8080, least traffic, no session affinity\n4. **Web app ↔ Postgres** — everything durable\n5. **Web app ↔ Redis** — live state: the canonical, presence, the relay between replicas",
        "fill": "#ffffff",
        "outline": "#d0d7de",
        "magnification": 1
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": 858,
      "y": 1908,
      "w": 519,
      "h": 237
    },
    {
      "shapes": [],
      "id": "prompt-2sk7be~e1793153987184",
      "category": "Always available",
      "type": "markdown",
      "props": {
        "markdown": "# Explanation\nThe prompt: \n> “create me a diagram using the Any Cloud infra category showing the Northflank web app deployment of DrawMode”",
        "fill": "#eaf2fd",
        "outline": "#2f7de1",
        "magnification": 1.3
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": 206,
      "y": 1909,
      "w": 642,
      "h": 191
    },
    {
      "shapes": [],
      "id": "clients-8kw28a~e1793153987177",
      "category": "Shapes",
      "type": "image",
      "props": {
        "name": "Coding agents",
        "namePos": "obc",
        "stroke": "#a0a0a0",
        "fill": "#ffffff",
        "angle": 0,
        "img": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij4KICA8IS0tIFRoZSBDb2RleCB0YWIncyBtYXJrIChkb2NzL2NsYXVkZS1jb2RlLXRhYi5tZCDCp0NvZGV4KTogQ29kZXgncyBvd24gaWNvbiBhcyB0aGUgQ2hhdEdQVCBhcHAgc2hpcHMgaXQg4oCUIGEgc2NhbGxvcGVkCiAgICAgICBjbG91ZCwgbGF2ZW5kZXIgYXQgdGhlIHRvcCB0byBibHVlLXZpb2xldCBhdCB0aGUgZm9vdCwgd2l0aCBhIHdoaXRlIHByb21wdCDigJQgZHJhd24gaGVyZSwgYXMgdGhlIENsYXVkZSBtYXJrIGlzIG91cgogICAgICAgZHJhd2luZyBvZiBDbGF1ZGUncyBzdGFyYnVyc3QgKEFuZHJldywgMjAyNi0xMC0xNDogImNhbiB3ZSBoYXZlIHVzZSB0aGUgY29kZXggaWNvbiIpLiB3aWRnZXRfaGVhZGVyJ3MKICAgICAgIF9DT0RFWF9NQVJLIGlzIHRoZSBzYW1lIGRyYXdpbmcuIC0tPgogIDxkZWZzPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJjb2RleENsb3VkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjEyIiB5MT0iMiIgeDI9IjEyIiB5Mj0iMjIiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNjNGIzZmIiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9IiM3Yzk1ZjciLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjM2EyZmY1Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBmaWxsPSJ1cmwoI2NvZGV4Q2xvdWQpIj4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjcuNCIvPgogICAgPGNpcmNsZSBjeD0iMTIiIGN5PSI1LjYiIHI9IjQiLz4KICAgIDxjaXJjbGUgY3g9IjE2LjUiIGN5PSI3LjUiIHI9IjQiLz4KICAgIDxjaXJjbGUgY3g9IjE4LjQiIGN5PSIxMiIgcj0iNCIvPgogICAgPGNpcmNsZSBjeD0iMTYuNSIgY3k9IjE2LjUiIHI9IjQiLz4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTguNCIgcj0iNCIvPgogICAgPGNpcmNsZSBjeD0iNy41IiBjeT0iMTYuNSIgcj0iNCIvPgogICAgPGNpcmNsZSBjeD0iNS42IiBjeT0iMTIiIHI9IjQiLz4KICAgIDxjaXJjbGUgY3g9IjcuNSIgY3k9IjcuNSIgcj0iNCIvPgogIDwvZz4KICA8cGF0aCBkPSJNOC40IDkuM2wyLjcgMi43LTIuNyAyLjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjkiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIKICAgICAgICBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CiAgPGxpbmUgeDE9IjEyLjkiIHkxPSIxNC43IiB4Mj0iMTYiIHkyPSIxNC43IiBzdHJva2U9IiNmZmYiIHN0cm9rZS13aWR0aD0iMS45IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPC9zdmc+Cg=="
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": -101,
      "y": 778,
      "w": 64,
      "h": 64
    },
    {
      "shapes": [
        {
          "shapes": [],
          "id": "proxy-86v74c~e1793153987148",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Proxy + edge cache",
            "service": "cloud:cdn",
            "subtitle": "app.drawmode.ai · Full (strict)",
            "description": "app.drawmode.ai is proxied since 2026-10-08: the direct path to Northflank ran ~120 KB/s per connection, so a cold load waited 8.6 s on the 891 KB engine; from the edge cache 0.35 s. A pull-through cache of unchanging files only — the fingerprinted engine, NiceGUI's versioned files, /vendor, /images — never pages, the socket, /api, /mcp or /sm-img. One Skip rule lets through acme-challenge, /api/, /mcp, /showcase/api and /showcase/<address>/verify. Plain HTTP is cut at 100 s. The Northflank origin still answers directly."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": "tools/cloudflare/app-proxy.sh",
          "fileLinkDesc": "The one switch: status | on | off flips only app.drawmode.ai's proxy flag (~5 min to take); on refuses unless SSL is Full (strict) and the live app trusts Cloudflare's ranges.",
          "smGroup": null,
          "deleted": false,
          "x": 285,
          "y": 951,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "worker-3n1xct~e1793153987149",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Showcase Worker",
            "service": "cloud:edge-function",
            "subtitle": "showcase.drawmode.ai",
            "description": "Worker drawmode-showcase at showcase.drawmode.ai (showcase.modebit.ai → 301). Per request it reads the pointer, the manifest (each cached 10 s) and the file from the bucket — the origin leaves the read path, so unprotected sites keep serving if the app is down. Only password verify, the Report page and publishing reach the app. Deployed by hand with wrangler deploy; secrets survive a deploy."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": "packages/drawmode/showcase-worker/worker.js",
          "fileLinkDesc": "The Worker: serves published sites from the R2 binding and mirrors drawcore/showcase.py's serve_decision (one shared test table keeps the two in step); a password login POSTs to the app's verify route with the shared token.",
          "smGroup": null,
          "deleted": false,
          "x": 125,
          "y": 1247,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "r2-2kgc5j~e1793153987150",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "R2 bucket",
            "service": "cloud:bucket",
            "subtitle": "drawmode-showcase · S3 API",
            "description": "Private bucket (no r2.dev URL) holding Showcase files only. The app writes with a SigV4 signer over httpx (DRAWCORE_BLOBS=s3, a token scoped to this bucket); the Worker reads through its BUCKET binding. Stored image bytes and uploaded document sources are in Postgres, not here."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": "packages/drawcore/src/modebit/drawcore/persistence/blobs_s3.py",
          "fileLinkDesc": "BlobsInS3: the wrapper make_store composes in when DRAWCORE_BLOBS=s3 — the five blob methods over the S3 API to R2, everything else delegated to the store.",
          "smGroup": null,
          "deleted": false,
          "x": 285,
          "y": 1247,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "pages-dm9qtw~e1793153987151",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Pages site",
            "service": "cloud:static-site",
            "subtitle": "drawmode.ai",
            "description": "The static website on Cloudflare Pages (project modebit): drawmode.ai canonical, www and the modebit.ai pair 301 per path through _worker.js. Deployed by hand from main: npx wrangler pages deploy website/site --project-name=modebit. Links to the app's /login and /auth/register; the download form POSTs to app.drawmode.ai/api/desktop/download."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": "website/site/_worker.js",
          "fileLinkDesc": "The site's host redirect: any hostname but drawmode.ai (except *.pages.dev and localhost) 301s to the same path and query on drawmode.ai; files are served through env.ASSETS.",
          "smGroup": null,
          "deleted": false,
          "x": 125,
          "y": 1407,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "dns-25b5z~e1793153987152",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "DNS + registrar",
            "service": "cloud:dns",
            "subtitle": "drawmode.ai · only app. proxied",
            "description": "Both zones on Cloudflare Registrar + DNS. Only app.drawmode.ai is proxied; auth.drawmode.ai stays DNS-only (Northflank issues its certificate only for a DNS-only record); showcase.drawmode.ai is the Worker's custom domain; the apex and www are the Pages site. The app's CNAME points at Northflank with the proxy flag on."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": "docs/cloudflare-front.md",
          "fileLinkDesc": "Why Cloudflare is in front, the switch, what is set once and right either way (trusted ranges, Full (strict), the Skip rule), what it keeps, the 100 s limit.",
          "smGroup": null,
          "deleted": false,
          "x": 285,
          "y": 1407,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "s2-1qh4oo~e1793153987153",
          "category": "Any cloud",
          "type": "cloud_step",
          "props": {
            "name": "2"
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 343,
          "y": 923,
          "w": null,
          "h": null
        },
        {
          "id": "47ec6efd-74e8-41ae-a6aa-6d7fa4c9c543",
          "category": "Any cloud",
          "type": "cloud_flow",
          "props": {
            "name": "reads"
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "source": "worker-3n1xct~e1793153987149",
          "target": "r2-2kgc5j~e1793153987150",
          "vertices": [
            [
              71,
              -1
            ]
          ],
          "straight": false,
          "bezier": false,
          "noAvoid": null,
          "vrel": true,
          "labMove": false,
          "labOff": {},
          "subtitle": "R2 binding",
          "description": null,
          "animation": null
        },
        {
          "id": "b0c10d66-c311-498f-9206-36477ed73213",
          "category": "Any cloud",
          "type": "cloud_flow",
          "props": {
            "name": "verifies site passwords",
            "dashed": true
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "source": "worker-3n1xct~e1793153987149",
          "target": "proxy-86v74c~e1793153987148",
          "vertices": [
            [
              -2,
              -144
            ],
            [
              158,
              -144
            ]
          ],
          "straight": false,
          "bezier": false,
          "noAvoid": null,
          "vrel": true,
          "labMove": false,
          "labOff": {},
          "subtitle": "POST …/verify · token",
          "description": "The only reads that reach the app from a published site: a password login (10 a minute per address, 100 per site), the Report page, and publishing. The hash never leaves the app; the Worker holds only the cookie secret.",
          "animation": null
        }
      ],
      "id": "cf-4b0ns9~e1793153987147",
      "category": "Any cloud",
      "type": "cloud_provider",
      "props": {
        "name": "Cloudflare",
        "subtitle": "edge · Workers · R2 · Pages · DNS",
        "description": "In front of the app since 2026-10-08 and the home of everything static: the proxy + cache for app.drawmode.ai, the Showcase Worker over its R2 bucket, the Pages website, and DNS + registrar for both zones (drawmode.ai, modebit.ai). SSL Full (strict); Bot Fight Mode off.",
        "badge": "cloud:cdn"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": 72,
      "y": 727,
      "w": 360,
      "h": 817
    },
    {
      "shapes": [
        {
          "shapes": [
            {
              "shapes": [
                {
                  "shapes": [
                    {
                      "shapes": [],
                      "id": "rep1-1evurm~e1793153987158",
                      "category": "Any cloud",
                      "type": "cloud_service",
                      "props": {
                        "name": "web app",
                        "service": "cloud:replica",
                        "subtitle": "1 vCPU / 2 GB",
                        "description": "Python 3.12 · NiceGUI / FastAPI · Socket.IO. Serves the pages and the socket, /api/…, the MCP door /mcp, /showcase/<address>/verify and Stripe's webhook. Replicas reach each other by pod IP on :8079 with a signed /internal/fleet-call (browser-bound MCP tools run on the replica holding the person's tab). Edge guard 1200 requests a minute per address; API fence 300 a minute per caller, counted in Redis."
                      },
                      "smZ": null,
                      "smTab": null,
                      "fileLink": null,
                      "fileLinkDesc": null,
                      "smGroup": null,
                      "deleted": false,
                      "x": 565,
                      "y": 1229,
                      "w": null,
                      "h": null
                    },
                    {
                      "shapes": [],
                      "id": "rep2-2u2xsb~e1793153987159",
                      "category": "Any cloud",
                      "type": "cloud_service",
                      "props": {
                        "name": "web app",
                        "service": "cloud:replica",
                        "subtitle": "1 vCPU / 2 GB",
                        "description": "Python 3.12 · NiceGUI / FastAPI · Socket.IO. Serves the pages and the socket, /api/…, the MCP door /mcp, /showcase/<address>/verify and Stripe's webhook. Replicas reach each other by pod IP on :8079 with a signed /internal/fleet-call (browser-bound MCP tools run on the replica holding the person's tab). Edge guard 1200 requests a minute per address; API fence 300 a minute per caller, counted in Redis."
                      },
                      "smZ": null,
                      "smTab": null,
                      "fileLink": null,
                      "fileLinkDesc": null,
                      "smGroup": null,
                      "deleted": false,
                      "x": 745,
                      "y": 1229,
                      "w": null,
                      "h": null
                    }
                  ],
                  "id": "svc-8zngkr~e1793153987157",
                  "category": "Any cloud",
                  "type": "cloud_generic_group",
                  "props": {
                    "name": "drawmode",
                    "subtitle": "2 × nf-compute-100-2 · fixed",
                    "color": "5",
                    "description": "The drawmode combined service: every push to main rebuilds and redeploys it. Two replicas is the redundancy floor — one must absorb everyone during a failover or a rolling deploy — and is never dropped to one; 'fewer, bigger' governs growth. Northflank has no session affinity: a reconnect landing on the other replica reloads the page. Ports 8080 public, 8079 private health. Runtime: DRAWCORE_STORE=sql, TEAM_BACKEND=redis, AUTH_MODE=zitadel (native login), BLOBS=s3, SOCKETIO_TRANSPORTS=websocket, TRUSTED_PROXIES=Cloudflare's ranges, AICORE_VECTOR_JOBS=queued, LOCAL_VENDOR=1.",
                    "badge": "cloud:container"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "tools/northflank/drawmode-service.json",
                  "fileLinkDesc": "The combined service: 2 × nf-compute-100-2 (1 vCPU / 2 GB), built from packages/drawmode/Dockerfile at the repo root on main; its comment records the measured sizing and why two fixed replicas.",
                  "smGroup": null,
                  "deleted": false,
                  "x": 537,
                  "y": 1105,
                  "w": 313,
                  "h": 244
                },
                {
                  "shapes": [],
                  "id": "lb-au2swl~e1793153987160",
                  "category": "Any cloud",
                  "type": "cloud_service",
                  "props": {
                    "name": "Northflank edge",
                    "service": "cloud:load-balancer",
                    "subtitle": "TLS · no affinity",
                    "description": "Northflank's load balancer + TLS termination: least-traffic routing, no session affinity, WebSocket on :8080, Northflank's own certificate (renewed via acme-challenge, which the Cloudflare Skip rule lets through). Fronts app.drawmode.ai and draw.modebit.ai (still attached: the 0.1.63 desktop and old MCP configs name it) on the drawmode service, and auth.drawmode.ai on zitadel. The app reads the caller from X-Forwarded-For right-to-left past its own hops."
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "tools/northflank/drawmode-ports.json",
                  "fileLinkDesc": "The ports the edge fronts: http 8080 public on app.drawmode.ai and draw.modebit.ai, health 8079 private.",
                  "smGroup": null,
                  "deleted": false,
                  "x": 645,
                  "y": 968,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "zitadel-10n925~e1793153987161",
                  "category": "Any cloud",
                  "type": "cloud_service",
                  "props": {
                    "name": "zitadel",
                    "service": "cloud:identity-provider",
                    "subtitle": "auth.drawmode.ai",
                    "description": "Zitadel v4.16.1 (OIDC) on nf-compute-50 (0.5 vCPU / 1 GB), a fresh instance since 2026-10-04 on its own database zitadel2 in the shared Postgres addon. The app renders its own login, register, 2FA and reset screens and calls Zitadel server-side (Session v2 / User v2 APIs with a machine user's PAT) through the public issuer; social sign-in hops browser → provider → auth.drawmode.ai/idps/callback → app /auth/idp. One replica on purpose: start-from-init runs the schema migrations. Probes on 8080: /debug/healthz and /debug/ready."
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "tools/northflank/zitadel-service.json",
                  "fileLinkDesc": "Zitadel as an external-image deployment service (ghcr.io/zitadel/zitadel:v4.16.1) on nf-compute-50, start-from-init --masterkeyFromEnv --tlsMode external; one replica until the command becomes plain start.",
                  "smGroup": null,
                  "deleted": false,
                  "x": 957,
                  "y": 953,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "pg-f8fw9h~e1793153987162",
                  "category": "Any cloud",
                  "type": "cloud_service",
                  "props": {
                    "name": "postgres",
                    "service": "cloud:replicated-database",
                    "subtitle": "PG 18 · 2 × 2 vCPU / 4 GB · 20 GB",
                    "description": "Private, TLS on, pgvector shipped. Read back from Northflank 2026-10-09: Postgres 18, 2 replicas × nf-compute-200-4 (2 vCPU / 4 GB), 20 GB NVMe — whether the second replica fails over automatically is still to confirm. Databases: drawmode (accounts + plans, sessions, projects, orgs, shares, diagrams, snapshots, modifications, team chat, settings KV, the AI ledger, vector jobs + chunks with HNSW, image bytes, Showcase metadata) and zitadel2 (Zitadel's own; the old zitadel database is kept until dropped)."
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "docs/deploy-northflank-runbook.md",
                  "fileLinkDesc": "The runbook's 'What runs today' line is the record of the addons' sizes; every other doc defers to it.",
                  "smGroup": null,
                  "deleted": false,
                  "x": 957,
                  "y": 1249,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "redis-688331~e1793153987163",
                  "category": "Any cloud",
                  "type": "cloud_service",
                  "props": {
                    "name": "redis",
                    "service": "cloud:cache",
                    "subtitle": "1 vCPU / 1 GB · TLS",
                    "description": "Single node, not cluster mode; Sentinel HA deferred. rediss:// via DRAWCORE_REDIS_URL (REDIS_MASTER_URL aliased in the keys group). Holds the live canonical per open diagram + its lock, presence, cursors, the pub/sub relay (team:bcast), the server registry (team:servers) and fleet counters (API fence, MCP budgets, Showcase throttles, the purge claim). Never sessions, the AI ledger, the job queue or settings — those are in Postgres. An outage degrades each diagram to memory (ResilientTeamUpdates); readiness does not ping it."
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "tools/northflank/secret-link-redis-app.json",
                  "fileLinkDesc": "The Redis addon's URL aliased into the app as DRAWCORE_REDIS_URL — the quiet one: absent, the team provider falls back to memory and two replicas silently stop collaborating.",
                  "smGroup": null,
                  "deleted": false,
                  "x": 618,
                  "y": 1480,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "vectors-2hdy4f~e1793153987164",
                  "category": "Any cloud",
                  "type": "cloud_service",
                  "props": {
                    "name": "drawmode-vectors",
                    "service": "cloud:worker",
                    "subtitle": "worker · 1 × 1 vCPU / 2 GB",
                    "description": "A replica that ingests and serves nothing: claims vector_documents with FOR UPDATE SKIP LOCKED + a lease, then extracts, captions, chunks and embeds; runs purge_closed_accounts hourly (Stripe, Zitadel, R2, mail). Same image as drawmode, run as modebit-vector-worker; health on :8079 only — no public port, no domain. Heartbeats into team:servers like a web replica (shown on /admin ▸ Servers). Scaling out is just the instance count."
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": "tools/northflank/drawmode-vectors-service.json",
                  "fileLinkDesc": "The worker service: the same repo, branch and Dockerfile as drawmode, customCommand modebit-vector-worker, one nf-compute-100-2 instance (0.5 vCPU would OOM on the wrong PDF).",
                  "smGroup": null,
                  "deleted": false,
                  "x": 796,
                  "y": 1480,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "s3-dv1lf~e1793153987165",
                  "category": "Any cloud",
                  "type": "cloud_step",
                  "props": {
                    "name": "3"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "x": 814,
                  "y": 1080,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "s4-d985or~e1793153987166",
                  "category": "Any cloud",
                  "type": "cloud_step",
                  "props": {
                    "name": "4"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "x": 858,
                  "y": 1229,
                  "w": null,
                  "h": null
                },
                {
                  "shapes": [],
                  "id": "s5-23xvkw~e1793153987167",
                  "category": "Any cloud",
                  "type": "cloud_step",
                  "props": {
                    "name": "5"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "x": 662,
                  "y": 1380,
                  "w": null,
                  "h": null
                },
                {
                  "id": "0c62802a-0be4-490b-a664-23e972c1cf3d",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "logs people in"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "svc-8zngkr~e1793153987157",
                  "target": "zitadel-10n925~e1793153987161",
                  "vertices": [
                    [
                      158,
                      -234
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": "Session v2 / User v2 APIs · PAT",
                  "description": "Native login: the app's own screens, calling Zitadel server-side through the public issuer with the machine user iam-delete's PAT (roles ORG_USER_MANAGER + IAM_LOGIN_CLIENT). The hosted OIDC code+PKCE flow is also supported.",
                  "animation": {
                    "kind": "balls",
                    "color": "#8c4fff",
                    "size": 12,
                    "spacing": 100,
                    "speed": 100
                  }
                },
                {
                  "id": "10f8db4c-0475-4844-b01c-ea6d87f4c263",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "zitadel2 database"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "zitadel-10n925~e1793153987161",
                  "target": "pg-f8fw9h~e1793153987162",
                  "vertices": [
                    [
                      -5,
                      119
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": null,
                  "description": "Credentials by alias from the addon (secret-link-postgres-zitadel.json); the primary endpoint, never the read replica.",
                  "animation": null
                },
                {
                  "id": "713b09a5-6e57-4860-8c33-34c7f6e0e631",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": ""
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "lb-au2swl~e1793153987160",
                  "target": "rep2-2u2xsb~e1793153987159",
                  "vertices": [
                    [
                      79,
                      98
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": true,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": null,
                  "description": null,
                  "animation": {
                    "kind": "balls",
                    "color": "#2f7de1",
                    "size": 12,
                    "spacing": 60,
                    "speed": 34
                  }
                },
                {
                  "id": "74fbb05d-b460-42a1-b908-4aaf83c07add",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "auth.drawmode.ai"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "lb-au2swl~e1793153987160",
                  "target": "zitadel-10n925~e1793153987161",
                  "vertices": [
                    [
                      55,
                      -73
                    ],
                    [
                      226,
                      -73
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": "DNS-only · not proxied",
                  "description": "auth.drawmode.ai reaches the edge directly (Cloudflare DNS-only, so Northflank's certificate renews). Only the social-login redirects come from the browser; the login screens are the app's own.",
                  "animation": null
                },
                {
                  "id": "76d7c07c-9d8b-4f80-baba-78106eab543e",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "live state"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "svc-8zngkr~e1793153987157",
                  "target": "redis-688331~e1793153987163",
                  "vertices": [
                    [
                      -57,
                      166
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": null,
                  "description": "The team provider: the live canonical per diagram and its lock, presence, cursors, the delta relay between replicas, fleet counters. Held to one store write per diagram per 5 s.",
                  "animation": {
                    "kind": "balls",
                    "color": "#2f7de1",
                    "size": 12,
                    "spacing": 60,
                    "speed": 34
                  }
                },
                {
                  "id": "c24e5520-6447-43dd-b8a3-40adea165ad3",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "heartbeats",
                    "dashed": true
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "vectors-2hdy4f~e1793153987164",
                  "target": "redis-688331~e1793153987163",
                  "vertices": [
                    [
                      -114,
                      -3
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": "team:servers",
                  "description": null,
                  "animation": null
                },
                {
                  "id": "d92b6f0d-ade0-4cfc-9ec2-9cdc52650945",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "reads / writes"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "svc-8zngkr~e1793153987157",
                  "target": "pg-f8fw9h~e1793153987162",
                  "vertices": [
                    [
                      204,
                      46
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": true,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": "SQLAlchemy",
                  "description": "Everything durable, through IPersistence: diagrams, projects, accounts, sessions, the AI ledger (atomic increments), settings, images, the vector job queue, Showcase metadata.",
                  "animation": {
                    "kind": "balls",
                    "color": "#2f7de1",
                    "size": 12,
                    "spacing": 100,
                    "speed": 68
                  }
                },
                {
                  "id": "e15d75fd-cd0f-42bf-932c-8207d0dd6dff",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "HTTP :8080"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "lb-au2swl~e1793153987160",
                  "target": "rep1-1evurm~e1793153987158",
                  "vertices": [
                    [
                      -80,
                      91
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": true,
                  "vrel": true,
                  "labMove": true,
                  "labOff": {
                    "m0": {
                      "x": 78,
                      "y": 53
                    }
                  },
                  "subtitle": null,
                  "description": "Whichever replica the balancer picks renders the page; its socket then stays on that replica for its life.",
                  "animation": {
                    "kind": "balls",
                    "color": "#2f7de1",
                    "size": 12,
                    "spacing": 60,
                    "speed": 34
                  }
                },
                {
                  "id": "fab5caed-4588-4b53-998b-6cf8290a5d2d",
                  "category": "Any cloud",
                  "type": "cloud_flow",
                  "props": {
                    "name": "claims jobs · writes chunks"
                  },
                  "smZ": null,
                  "smTab": null,
                  "fileLink": null,
                  "fileLinkDesc": null,
                  "smGroup": null,
                  "deleted": false,
                  "source": "vectors-2hdy4f~e1793153987164",
                  "target": "pg-f8fw9h~e1793153987162",
                  "vertices": [
                    [
                      161,
                      -23
                    ]
                  ],
                  "straight": false,
                  "bezier": false,
                  "noAvoid": null,
                  "vrel": true,
                  "labMove": false,
                  "labOff": {},
                  "subtitle": "FOR UPDATE SKIP LOCKED · pgvector",
                  "description": "vector_documents is the queue: pending → processing → ready|error, chunks_done after every embed batch; the Documents view polls those rows, so a job in another container shows up with no UI change.",
                  "animation": null
                }
              ],
              "id": "region-72ys97~e1793153987156",
              "category": "Any cloud",
              "type": "cloud_region",
              "props": {
                "name": "us-central1",
                "subtitle": "Google Cloud",
                "description": "Northflank's region in Google Cloud us-central1 — the origin Cloudflare reaches (35.188.57.196)."
              },
              "smZ": null,
              "smTab": null,
              "fileLink": null,
              "fileLinkDesc": null,
              "smGroup": null,
              "deleted": false,
              "x": 521,
              "y": 885,
              "w": 616,
              "h": 731
            },
            {
              "shapes": [],
              "id": "build-7aoop~e1793153987168",
              "category": "Any cloud",
              "type": "cloud_service",
              "props": {
                "name": "CI build",
                "service": "cloud:build",
                "subtitle": "main → one image",
                "description": "Combined build+deploy: every push to main rebuilds packages/drawmode/Dockerfile from the repo root for drawmode AND drawmode-vectors (two builds of one image; the two can sit at different SHAs for the length of a deploy — harmless, both run the same migrations under an advisory lock). Path ignore rules: website/ docs/ .claude-memory/ desktop/ .github/ *.md."
              },
              "smZ": null,
              "smTab": null,
              "fileLink": "packages/drawmode/Dockerfile",
              "fileLinkDesc": "The one image both services build: it COPYs pyproject.toml and packages/*, so the build context must be the repo root; drawmode runs the default command, drawmode-vectors runs modebit-vector-worker.",
              "smGroup": null,
              "deleted": false,
              "x": 561,
              "y": 1719,
              "w": null,
              "h": null
            },
            {
              "shapes": [],
              "id": "secrets-fxbv0m~e1793153987169",
              "category": "Any cloud",
              "type": "cloud_service",
              "props": {
                "name": "Secret groups",
                "service": "cloud:secrets",
                "subtitle": "keys · zitadel · showcase",
                "description": "keys: the storage secret (signs the session cookie — the app refuses to boot without it), DB + Redis URLs aliased from the addons, the AI keys, the plan signing key, Stripe, the Zitadel PAT, SMTP. zitadel: its Postgres credentials by alias + the masterkey. showcase: the S3 key/secret, the cookie secret and the Worker token."
              },
              "smZ": null,
              "smTab": null,
              "fileLink": "tools/northflank/drawmode-env.json",
              "fileLinkDesc": "The non-secret runtime environment applied to drawmode and drawmode-vectors alike (store, team backend, auth mode, trusted proxies, public URL, Showcase URLs, blobs=s3).",
              "smGroup": null,
              "deleted": false,
              "x": 721,
              "y": 1719,
              "w": null,
              "h": null
            },
            {
              "shapes": [],
              "id": "logs-bwqukm~e1793153987170",
              "category": "Any cloud",
              "type": "cloud_service",
              "props": {
                "name": "Logs",
                "service": "cloud:logs",
                "subtitle": "Northflank",
                "description": "Logs live in Northflank; there is no error tracker. The app logs its own slow boots (specmode.boot, any 'Preparing…' over 5 s) and Redis outages to Postgres (redis_events)."
              },
              "smZ": null,
              "smTab": null,
              "fileLink": null,
              "fileLinkDesc": null,
              "smGroup": null,
              "deleted": false,
              "x": 881,
              "y": 1719,
              "w": null,
              "h": null
            },
            {
              "shapes": [],
              "id": "probes-2634jt~e1793153987171",
              "category": "Any cloud",
              "type": "cloud_service",
              "props": {
                "name": "Health probes",
                "service": "cloud:monitoring",
                "subtitle": "/healthz · /readyz :8079",
                "description": "On the private health port 8079, never 8080: startup /healthz (15 s delay, 60 × 10 s — covers first-boot schema creation), readiness /readyz = a real SELECT 1 against the database only, liveness /healthz every 15 s. Redis is deliberately not checked, so a Redis blip never de-pools every replica."
              },
              "smZ": null,
              "smTab": null,
              "fileLink": "tools/northflank/drawmode-health-checks.json",
              "fileLinkDesc": "The three probes on the private health port and the rationale: liveness dependency-free, readiness = the database answering, Redis never pinged.",
              "smGroup": null,
              "deleted": false,
              "x": 1041,
              "y": 1719,
              "w": null,
              "h": null
            }
          ],
          "id": "proj-42r2mm~e1793153987155",
          "category": "Any cloud",
          "type": "cloud_project",
          "props": {
            "name": "drawmode",
            "subtitle": "production",
            "description": "Northflank project drawmode: three services (drawmode, drawmode-vectors, zitadel) and two addons (postgres, redis). Secret groups keys, zitadel and showcase; the same drawmode-env.json is applied to drawmode and drawmode-vectors."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 505,
          "y": 797,
          "w": 661,
          "h": 1042
        }
      ],
      "id": "nf-8mocqn~e1793153987154",
      "category": "Any cloud",
      "type": "cloud_provider",
      "props": {
        "name": "Northflank",
        "subtitle": "builds from GitHub · one image, two commands",
        "description": "The platform that builds and runs the app: combined build+deploy services from GitHub, managed Postgres and Redis addons, a load balancer with TLS and no session affinity. No persistent volume — all state is in Postgres, Redis and R2."
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": 489,
      "y": 729,
      "w": 693,
      "h": 1130
    },
    {
      "shapes": [
        {
          "shapes": [],
          "id": "idps-8i07wp~e1793153987173",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Google · GitHub",
            "service": "cloud:user-auth",
            "subtitle": "social sign-in",
            "description": "Google and GitHub OAuth, federated through Zitadel: callback auth.drawmode.ai/idps/callback, then the app's /auth/idp. Passwordless sign-in is possible this way."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 1326,
          "y": 951,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "stripe-26f5xt~e1793153987174",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Stripe",
            "service": "cloud:payment-provider",
            "subtitle": "Checkout · Portal · webhook",
            "description": "Checkout (subscriptions: $15/mo, $120/yr, $25 a seat for a Company) + the Customer Portal, plain HTTPS to api.stripe.com, no SDK. The signed webhook lands on /api/billing/webhook/stripe — never refused by the API fence, passed by Cloudflare's /api/ skip."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 1326,
          "y": 1103,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "openai-8hekml~e1793153987175",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "DeepSeek · OpenAI · Serper",
            "service": "cloud:ai-service",
            "subtitle": "AI + web search",
            "description": "The web assistant runs on DeepSeek alone since 2026-10-23 (saas AICORE_CHAT_PROVIDERS=deepseek: DeepSeek Flash chats and looks at the pictures in a conversation; no model choice is shown). OpenAI does what DeepSeek cannot: text-embedding-3-small embeds documents and every library-search query, and GPT-6 Luna captions document pictures at vectorize time and answers the MCP door's images. Serper is the web-search tool. The Anthropic code path exists but is not offered. The privacy page names DeepSeek and OpenAI as the AI processors."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 1326,
          "y": 1501,
          "w": null,
          "h": null
        },
        {
          "shapes": [],
          "id": "mail-83j83d~e1793153987176",
          "category": "Any cloud",
          "type": "cloud_service",
          "props": {
            "name": "Google Workspace",
            "service": "cloud:email-provider",
            "subtitle": "SMTP · info@drawmode.ai",
            "description": "Mail as DrawMode <info@drawmode.ai>: the app's DRAWCORE_SMTP_* and Zitadel's SMTP provider (verification and recovery mail). The Workspace tenant is modebit.ai with drawmode.ai an alias domain (MX, SPF, DKIM, DMARC on the zone)."
          },
          "smZ": null,
          "smTab": null,
          "fileLink": null,
          "fileLinkDesc": null,
          "smGroup": null,
          "deleted": false,
          "x": 1326,
          "y": 1653,
          "w": null,
          "h": null
        }
      ],
      "id": "saas-4idpci~e1793153987172",
      "category": "Any cloud",
      "type": "cloud_generic_group",
      "props": {
        "name": "Third-party services",
        "description": "Outside APIs the app, the worker and Zitadel call over HTTPS.",
        "badge": "cloud:saas"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": 1220,
      "y": 727,
      "w": 259,
      "h": 1130
    },
    {
      "shapes": [],
      "id": "users-bm0jsb~e1793153987178",
      "category": "Any cloud",
      "type": "cloud_service",
      "props": {
        "name": "People",
        "service": "cloud:users",
        "subtitle": "browsers",
        "description": "Anyone using DrawMode on the web: the editor at app.drawmode.ai (a NiceGUI page and one Socket.IO socket to the replica that served it — editing, AI chat and uploads all ride the socket), the website at drawmode.ai, and published Showcase sites."
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": -83,
      "y": 951,
      "w": null,
      "h": null
    },
    {
      "shapes": [],
      "id": "github-16n7g3~e1793153987179",
      "category": "Any cloud",
      "type": "cloud_service",
      "props": {
        "name": "GitHub",
        "service": "cloud:git-host",
        "subtitle": "drawmode-ai/specmode · main",
        "description": "The Northflank GitHub App builds both app services on every push to main (CI on; a commit message that even quotes [skip ci] skips the whole push). drawmode-releases feeds the desktop's update check."
      },
      "smZ": null,
      "smTab": null,
      "fileLink": "tools/northflank/apply-drawmode.sh",
      "fileLinkDesc": "Applying the drawmode service: checks the GitHub App can see drawmode-ai/specmode and that the keys group holds what the app cannot boot without, then creates or updates the service in four calls.",
      "smGroup": null,
      "deleted": false,
      "x": 186,
      "y": 1717,
      "w": null,
      "h": null
    },
    {
      "shapes": [],
      "id": "s1-21l6xq~e1793153987180",
      "category": "Any cloud",
      "type": "cloud_step",
      "props": {
        "name": "1"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "x": -25,
      "y": 923,
      "w": null,
      "h": null
    },
    {
      "id": "1250115f-4e62-42b9-95ea-cf050e3a0406",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "HTTPS Full (strict)"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "proxy-86v74c~e1793153987148",
      "target": "lb-au2swl~e1793153987160",
      "vertices": [
        [
          180,
          0
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "WebSocket passed through",
      "description": "Cloudflare checks Northflank's certificate. Unchanging files (the engine, NiceGUI's versioned files, /vendor) are kept at the edge; pages, the socket, /api and /mcp always go through.",
      "animation": {
        "kind": "balls",
        "color": "#2f7de1",
        "size": 12,
        "spacing": 60,
        "speed": 34
      }
    },
    {
      "id": "32c9f7ca-e4b0-4251-8ed6-5793c5b6f47d",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "Checkout · Portal",
        "arrows": "both"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "svc-8zngkr~e1793153987157",
      "target": "stripe-26f5xt~e1793153987174",
      "vertices": [
        [
          293,
          -100
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "webhook → /api/billing/webhook/stripe",
      "description": null,
      "animation": null
    },
    {
      "id": "33defeec-16f3-41bc-a3c8-f1c85e84a6a3",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "mail",
        "dashed": true
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "svc-8zngkr~e1793153987157",
      "target": "mail-83j83d~e1793153987176",
      "vertices": [
        [
          32,
          432
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "SMTP · info@drawmode.ai",
      "description": "Invitations, approval and account mail from the app; Zitadel sends its verification and recovery mail through the same tenant.",
      "animation": null
    },
    {
      "id": "51e245cb-c7d1-469c-ad55-e50d8ed12bdb",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "HTTPS"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "users-bm0jsb~e1793153987178",
      "target": "pages-dm9qtw~e1793153987151",
      "vertices": [
        [
          0,
          456
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": true,
      "labOff": {
        "m0": {
          "x": 45,
          "y": 89
        }
      },
      "subtitle": "drawmode.ai",
      "description": "The website; Cloudflare Web Analytics, cookieless.",
      "animation": null
    },
    {
      "id": "5bc9e95c-65c6-4fbf-8786-31f720fcccce",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "push to main → build"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "github-16n7g3~e1793153987179",
      "target": "build-7aoop~e1793153987168",
      "vertices": [],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": false,
      "labMove": false,
      "labOff": {},
      "subtitle": "Northflank GitHub App · both services rebuild",
      "description": null,
      "animation": null
    },
    {
      "id": "692185cb-b844-463a-ae34-e6a6bcaec862",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "federates"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "zitadel-10n925~e1793153987161",
      "target": "idps-8i07wp~e1793153987173",
      "vertices": [
        [
          165,
          -2
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "OIDC / OAuth · /idps/callback",
      "description": null,
      "animation": null
    },
    {
      "id": "7dcf667a-9b07-4992-920c-a422df2d1abf",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "HTTPS"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "users-bm0jsb~e1793153987178",
      "target": "worker-3n1xct~e1793153987149",
      "vertices": [
        [
          0,
          296
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": true,
      "labOff": {
        "m0": {
          "x": 64,
          "y": 0
        }
      },
      "subtitle": "showcase.drawmode.ai",
      "description": "Published sites, served from the edge: no request reaches Northflank unless a password is checked.",
      "animation": null
    },
    {
      "id": "ad032a91-b29c-4f71-8059-c9b4aa1ad10a",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "embeds + captions"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "vectors-2hdy4f~e1793153987164",
      "target": "openai-8hekml~e1793153987175",
      "vertices": [
        [
          360,
          10
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "OpenAI — DeepSeek has no embeddings",
      "description": "Documents are chunked and embedded with text-embedding-3-small and their pictures captioned by GPT-6 Luna, all on OpenAI's key: DeepSeek has no embeddings endpoint, so moving captions to it would buy nothing. The embedding quota is the worker's real ceiling.",
      "animation": null
    },
    {
      "id": "cf334568-7671-4c4d-bd17-57ead54f5d7c",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "publishes"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "svc-8zngkr~e1793153987157",
      "target": "r2-2kgc5j~e1793153987150",
      "vertices": [
        [
          -279,
          42
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "S3 API",
      "description": "At publish time the app writes the site's files and manifest to the bucket; a republish replaces the set, a revoke purges it. Its part ends there — the Worker serves.",
      "animation": null
    },
    {
      "id": "e1889cec-8f54-4859-bec6-1364f4547068",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "chat · search · query embeddings"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "svc-8zngkr~e1793153987157",
      "target": "openai-8hekml~e1793153987175",
      "vertices": [
        [
          110,
          192
        ],
        [
          647,
          192
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": true,
      "labOff": {
        "m0": {
          "x": 64,
          "y": -1
        }
      },
      "subtitle": "DeepSeek · Serper · OpenAI",
      "description": "The assistant's conversations and their pictures go to DeepSeek Flash; the web-search tool to Serper; each library-search query is embedded by OpenAI on this tier (and the MCP door's analyze_image goes to Luna). Vectorizing documents is queued to the worker.",
      "animation": null
    },
    {
      "id": "e96ea4aa-59f3-4af8-9fd6-fae4e8b30864",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "HTTPS + WebSocket"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "users-bm0jsb~e1793153987178",
      "target": "proxy-86v74c~e1793153987148",
      "vertices": [
        [
          159,
          0
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": true,
      "labOff": {
        "m0": {
          "x": 32,
          "y": -1
        }
      },
      "subtitle": "app.drawmode.ai",
      "description": "The page and its Socket.IO socket (/_nicegui_ws/socket.io, websocket transport only). Session cookie drawmode-session signed with DRAWMODE_STORAGE_SECRET; sessions live in Postgres, so no affinity is needed.",
      "animation": {
        "kind": "balls",
        "color": "#2f7de1",
        "size": 12,
        "spacing": 54,
        "speed": 34
      }
    },
    {
      "id": "ea2e22a8-02d8-4ded-94bd-708b5c2472cb",
      "category": "Any cloud",
      "type": "cloud_flow",
      "props": {
        "name": "HTTP"
      },
      "smZ": null,
      "smTab": null,
      "fileLink": null,
      "fileLinkDesc": null,
      "smGroup": null,
      "deleted": false,
      "source": "clients-8kw28a~e1793153987177",
      "target": "proxy-86v74c~e1793153987148",
      "vertices": [
        [
          357,
          13
        ]
      ],
      "straight": false,
      "bezier": false,
      "noAvoid": null,
      "vrel": true,
      "labMove": false,
      "labOff": {},
      "subtitle": "/api · /mcp",
      "description": "Callers that are not browsers and cannot answer a challenge: the Skip rule lets them past the WAF and Browser Integrity Check. Plain HTTP, cut at 100 s by Cloudflare.",
      "animation": {
        "kind": "balls",
        "color": "#1fa65a",
        "size": 12,
        "spacing": 80,
        "speed": 34
      }
    }
  ],
  "id": "df3a10826",
  "name": "WebApp Deployment",
  "category": "domain",
  "description": "",
  "tags": [],
  "order": null,
  "publish_ignore": false,
  "ai_guidance": "",
  "deleted": false,
  "open": false,
  "view": {},
  "stamp": {
    "epoch": 0.0,
    "user": "",
    "nonce": 0
  },
  "touched_ms": 0.0,
  "last_editor": "",
  "schema_version": 1,
  "variables": [],
  "projection": "iso"
}
Pure model
{
  "elements": [
    {
      "id": "stepkey-b35f6v~e1793153987183",
      "category": "Notes",
      "kind": "markdown",
      "text": "### The request path\n\n1. **Browser → Cloudflare** — HTTPS + WebSocket to app.drawmode.ai; the engine and other unchanging files answered from the edge cache\n2. **Cloudflare → Northflank edge** — Full (strict) TLS, the socket passed through\n3. **Edge → a web replica** — HTTP :8080, least traffic, no session affinity\n4. **Web app ↔ Postgres** — everything durable\n5. **Web app ↔ Redis** — live state: the canonical, presence, the relay between replicas"
    },
    {
      "id": "prompt-2sk7be~e1793153987184",
      "category": "Notes",
      "kind": "markdown",
      "text": "# Explanation\nThe prompt: \n> “create me a diagram using the Any Cloud infra category showing the Northflank web app deployment of DrawMode”"
    },
    {
      "id": "cf-4b0ns9~e1793153987147",
      "category": "Any cloud",
      "kind": "provider",
      "name": "Cloudflare",
      "subtitle": "edge · Workers · R2 · Pages · DNS",
      "badge": "cloud:cdn",
      "description": "In front of the app since 2026-10-08 and the home of everything static: the proxy + cache for app.drawmode.ai, the Showcase Worker over its R2 bucket, the Pages website, and DNS + registrar for both zones (drawmode.ai, modebit.ai). SSL Full (strict); Bot Fight Mode off.",
      "elements": [
        {
          "id": "proxy-86v74c~e1793153987148",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:cdn",
          "service_name": "CDN / edge proxy",
          "name": "Proxy + edge cache",
          "subtitle": "app.drawmode.ai · Full (strict)",
          "description": "app.drawmode.ai is proxied since 2026-10-08: the direct path to Northflank ran ~120 KB/s per connection, so a cold load waited 8.6 s on the 891 KB engine; from the edge cache 0.35 s. A pull-through cache of unchanging files only — the fingerprinted engine, NiceGUI's versioned files, /vendor, /images — never pages, the socket, /api, /mcp or /sm-img. One Skip rule lets through acme-challenge, /api/, /mcp, /showcase/api and /showcase/<address>/verify. Plain HTTP is cut at 100 s. The Northflank origin still answers directly."
        },
        {
          "id": "worker-3n1xct~e1793153987149",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:edge-function",
          "service_name": "Edge function",
          "name": "Showcase Worker",
          "subtitle": "showcase.drawmode.ai",
          "description": "Worker drawmode-showcase at showcase.drawmode.ai (showcase.modebit.ai → 301). Per request it reads the pointer, the manifest (each cached 10 s) and the file from the bucket — the origin leaves the read path, so unprotected sites keep serving if the app is down. Only password verify, the Report page and publishing reach the app. Deployed by hand with wrangler deploy; secrets survive a deploy."
        },
        {
          "id": "r2-2kgc5j~e1793153987150",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:bucket",
          "service_name": "Bucket",
          "name": "R2 bucket",
          "subtitle": "drawmode-showcase · S3 API",
          "description": "Private bucket (no r2.dev URL) holding Showcase files only. The app writes with a SigV4 signer over httpx (DRAWCORE_BLOBS=s3, a token scoped to this bucket); the Worker reads through its BUCKET binding. Stored image bytes and uploaded document sources are in Postgres, not here."
        },
        {
          "id": "pages-dm9qtw~e1793153987151",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:static-site",
          "service_name": "Static site",
          "name": "Pages site",
          "subtitle": "drawmode.ai",
          "description": "The static website on Cloudflare Pages (project modebit): drawmode.ai canonical, www and the modebit.ai pair 301 per path through _worker.js. Deployed by hand from main: npx wrangler pages deploy website/site --project-name=modebit. Links to the app's /login and /auth/register; the download form POSTs to app.drawmode.ai/api/desktop/download."
        },
        {
          "id": "dns-25b5z~e1793153987152",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:dns",
          "service_name": "DNS",
          "name": "DNS + registrar",
          "subtitle": "drawmode.ai · only app. proxied",
          "description": "Both zones on Cloudflare Registrar + DNS. Only app.drawmode.ai is proxied; auth.drawmode.ai stays DNS-only (Northflank issues its certificate only for a DNS-only record); showcase.drawmode.ai is the Worker's custom domain; the apex and www are the Pages site. The app's CNAME points at Northflank with the proxy flag on."
        },
        {
          "id": "s2-1qh4oo~e1793153987153",
          "category": "Any cloud",
          "kind": "step",
          "number": "2"
        }
      ]
    },
    {
      "id": "nf-8mocqn~e1793153987154",
      "category": "Any cloud",
      "kind": "provider",
      "name": "Northflank",
      "subtitle": "builds from GitHub · one image, two commands",
      "description": "The platform that builds and runs the app: combined build+deploy services from GitHub, managed Postgres and Redis addons, a load balancer with TLS and no session affinity. No persistent volume — all state is in Postgres, Redis and R2.",
      "elements": [
        {
          "id": "proj-42r2mm~e1793153987155",
          "category": "Any cloud",
          "kind": "project",
          "name": "drawmode",
          "subtitle": "production",
          "description": "Northflank project drawmode: three services (drawmode, drawmode-vectors, zitadel) and two addons (postgres, redis). Secret groups keys, zitadel and showcase; the same drawmode-env.json is applied to drawmode and drawmode-vectors.",
          "elements": [
            {
              "id": "region-72ys97~e1793153987156",
              "category": "Any cloud",
              "kind": "region",
              "name": "us-central1",
              "subtitle": "Google Cloud",
              "description": "Northflank's region in Google Cloud us-central1 — the origin Cloudflare reaches (35.188.57.196).",
              "elements": [
                {
                  "id": "svc-8zngkr~e1793153987157",
                  "category": "Any cloud",
                  "kind": "generic_group",
                  "name": "drawmode",
                  "subtitle": "2 × nf-compute-100-2 · fixed",
                  "badge": "cloud:container",
                  "description": "The drawmode combined service: every push to main rebuilds and redeploys it. Two replicas is the redundancy floor — one must absorb everyone during a failover or a rolling deploy — and is never dropped to one; 'fewer, bigger' governs growth. Northflank has no session affinity: a reconnect landing on the other replica reloads the page. Ports 8080 public, 8079 private health. Runtime: DRAWCORE_STORE=sql, TEAM_BACKEND=redis, AUTH_MODE=zitadel (native login), BLOBS=s3, SOCKETIO_TRANSPORTS=websocket, TRUSTED_PROXIES=Cloudflare's ranges, AICORE_VECTOR_JOBS=queued, LOCAL_VENDOR=1.",
                  "elements": [
                    {
                      "id": "rep1-1evurm~e1793153987158",
                      "category": "Any cloud",
                      "kind": "service",
                      "service": "cloud:replica",
                      "service_name": "Replica (instance / task / pod)",
                      "name": "web app",
                      "subtitle": "1 vCPU / 2 GB",
                      "description": "Python 3.12 · NiceGUI / FastAPI · Socket.IO. Serves the pages and the socket, /api/…, the MCP door /mcp, /showcase/<address>/verify and Stripe's webhook. Replicas reach each other by pod IP on :8079 with a signed /internal/fleet-call (browser-bound MCP tools run on the replica holding the person's tab). Edge guard 1200 requests a minute per address; API fence 300 a minute per caller, counted in Redis."
                    },
                    {
                      "id": "rep2-2u2xsb~e1793153987159",
                      "category": "Any cloud",
                      "kind": "service",
                      "service": "cloud:replica",
                      "service_name": "Replica (instance / task / pod)",
                      "name": "web app",
                      "subtitle": "1 vCPU / 2 GB",
                      "description": "Python 3.12 · NiceGUI / FastAPI · Socket.IO. Serves the pages and the socket, /api/…, the MCP door /mcp, /showcase/<address>/verify and Stripe's webhook. Replicas reach each other by pod IP on :8079 with a signed /internal/fleet-call (browser-bound MCP tools run on the replica holding the person's tab). Edge guard 1200 requests a minute per address; API fence 300 a minute per caller, counted in Redis."
                    }
                  ]
                },
                {
                  "id": "lb-au2swl~e1793153987160",
                  "category": "Any cloud",
                  "kind": "service",
                  "service": "cloud:load-balancer",
                  "service_name": "Load balancer",
                  "name": "Northflank edge",
                  "subtitle": "TLS · no affinity",
                  "description": "Northflank's load balancer + TLS termination: least-traffic routing, no session affinity, WebSocket on :8080, Northflank's own certificate (renewed via acme-challenge, which the Cloudflare Skip rule lets through). Fronts app.drawmode.ai and draw.modebit.ai (still attached: the 0.1.63 desktop and old MCP configs name it) on the drawmode service, and auth.drawmode.ai on zitadel. The app reads the caller from X-Forwarded-For right-to-left past its own hops."
                },
                {
                  "id": "zitadel-10n925~e1793153987161",
                  "category": "Any cloud",
                  "kind": "service",
                  "service": "cloud:identity-provider",
                  "service_name": "Identity provider (SSO)",
                  "name": "zitadel",
                  "subtitle": "auth.drawmode.ai",
                  "description": "Zitadel v4.16.1 (OIDC) on nf-compute-50 (0.5 vCPU / 1 GB), a fresh instance since 2026-10-04 on its own database zitadel2 in the shared Postgres addon. The app renders its own login, register, 2FA and reset screens and calls Zitadel server-side (Session v2 / User v2 APIs with a machine user's PAT) through the public issuer; social sign-in hops browser → provider → auth.drawmode.ai/idps/callback → app /auth/idp. One replica on purpose: start-from-init runs the schema migrations. Probes on 8080: /debug/healthz and /debug/ready."
                },
                {
                  "id": "pg-f8fw9h~e1793153987162",
                  "category": "Any cloud",
                  "kind": "service",
                  "service": "cloud:replicated-database",
                  "service_name": "Replicated database (primary + replicas)",
                  "name": "postgres",
                  "subtitle": "PG 18 · 2 × 2 vCPU / 4 GB · 20 GB",
                  "description": "Private, TLS on, pgvector shipped. Read back from Northflank 2026-10-09: Postgres 18, 2 replicas × nf-compute-200-4 (2 vCPU / 4 GB), 20 GB NVMe — whether the second replica fails over automatically is still to confirm. Databases: drawmode (accounts + plans, sessions, projects, orgs, shares, diagrams, snapshots, modifications, team chat, settings KV, the AI ledger, vector jobs + chunks with HNSW, image bytes, Showcase metadata) and zitadel2 (Zitadel's own; the old zitadel database is kept until dropped)."
                },
                {
                  "id": "redis-688331~e1793153987163",
                  "category": "Any cloud",
                  "kind": "service",
                  "service": "cloud:cache",
                  "service_name": "In-memory cache / key-value store",
                  "name": "redis",
                  "subtitle": "1 vCPU / 1 GB · TLS",
                  "description": "Single node, not cluster mode; Sentinel HA deferred. rediss:// via DRAWCORE_REDIS_URL (REDIS_MASTER_URL aliased in the keys group). Holds the live canonical per open diagram + its lock, presence, cursors, the pub/sub relay (team:bcast), the server registry (team:servers) and fleet counters (API fence, MCP budgets, Showcase throttles, the purge claim). Never sessions, the AI ledger, the job queue or settings — those are in Postgres. An outage degrades each diagram to memory (ResilientTeamUpdates); readiness does not ping it."
                },
                {
                  "id": "vectors-2hdy4f~e1793153987164",
                  "category": "Any cloud",
                  "kind": "service",
                  "service": "cloud:worker",
                  "service_name": "Background worker",
                  "name": "drawmode-vectors",
                  "subtitle": "worker · 1 × 1 vCPU / 2 GB",
                  "description": "A replica that ingests and serves nothing: claims vector_documents with FOR UPDATE SKIP LOCKED + a lease, then extracts, captions, chunks and embeds; runs purge_closed_accounts hourly (Stripe, Zitadel, R2, mail). Same image as drawmode, run as modebit-vector-worker; health on :8079 only — no public port, no domain. Heartbeats into team:servers like a web replica (shown on /admin ▸ Servers). Scaling out is just the instance count."
                },
                {
                  "id": "s3-dv1lf~e1793153987165",
                  "category": "Any cloud",
                  "kind": "step",
                  "number": "3"
                },
                {
                  "id": "s4-d985or~e1793153987166",
                  "category": "Any cloud",
                  "kind": "step",
                  "number": "4"
                },
                {
                  "id": "s5-23xvkw~e1793153987167",
                  "category": "Any cloud",
                  "kind": "step",
                  "number": "5"
                }
              ]
            },
            {
              "id": "build-7aoop~e1793153987168",
              "category": "Any cloud",
              "kind": "service",
              "service": "cloud:build",
              "service_name": "Build",
              "name": "CI build",
              "subtitle": "main → one image",
              "description": "Combined build+deploy: every push to main rebuilds packages/drawmode/Dockerfile from the repo root for drawmode AND drawmode-vectors (two builds of one image; the two can sit at different SHAs for the length of a deploy — harmless, both run the same migrations under an advisory lock). Path ignore rules: website/ docs/ .claude-memory/ desktop/ .github/ *.md."
            },
            {
              "id": "secrets-fxbv0m~e1793153987169",
              "category": "Any cloud",
              "kind": "service",
              "service": "cloud:secrets",
              "service_name": "Secrets manager",
              "name": "Secret groups",
              "subtitle": "keys · zitadel · showcase",
              "description": "keys: the storage secret (signs the session cookie — the app refuses to boot without it), DB + Redis URLs aliased from the addons, the AI keys, the plan signing key, Stripe, the Zitadel PAT, SMTP. zitadel: its Postgres credentials by alias + the masterkey. showcase: the S3 key/secret, the cookie secret and the Worker token."
            },
            {
              "id": "logs-bwqukm~e1793153987170",
              "category": "Any cloud",
              "kind": "service",
              "service": "cloud:logs",
              "service_name": "Logs",
              "name": "Logs",
              "subtitle": "Northflank",
              "description": "Logs live in Northflank; there is no error tracker. The app logs its own slow boots (specmode.boot, any 'Preparing…' over 5 s) and Redis outages to Postgres (redis_events)."
            },
            {
              "id": "probes-2634jt~e1793153987171",
              "category": "Any cloud",
              "kind": "service",
              "service": "cloud:monitoring",
              "service_name": "Monitoring",
              "name": "Health probes",
              "subtitle": "/healthz · /readyz :8079",
              "description": "On the private health port 8079, never 8080: startup /healthz (15 s delay, 60 × 10 s — covers first-boot schema creation), readiness /readyz = a real SELECT 1 against the database only, liveness /healthz every 15 s. Redis is deliberately not checked, so a Redis blip never de-pools every replica."
            }
          ]
        }
      ]
    },
    {
      "id": "saas-4idpci~e1793153987172",
      "category": "Any cloud",
      "kind": "generic_group",
      "name": "Third-party services",
      "badge": "cloud:saas",
      "description": "Outside APIs the app, the worker and Zitadel call over HTTPS.",
      "elements": [
        {
          "id": "idps-8i07wp~e1793153987173",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:user-auth",
          "service_name": "User sign-in (customer identity)",
          "name": "Google · GitHub",
          "subtitle": "social sign-in",
          "description": "Google and GitHub OAuth, federated through Zitadel: callback auth.drawmode.ai/idps/callback, then the app's /auth/idp. Passwordless sign-in is possible this way."
        },
        {
          "id": "stripe-26f5xt~e1793153987174",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:payment-provider",
          "service_name": "Payment provider",
          "name": "Stripe",
          "subtitle": "Checkout · Portal · webhook",
          "description": "Checkout (subscriptions: $15/mo, $120/yr, $25 a seat for a Company) + the Customer Portal, plain HTTPS to api.stripe.com, no SDK. The signed webhook lands on /api/billing/webhook/stripe — never refused by the API fence, passed by Cloudflare's /api/ skip."
        },
        {
          "id": "openai-8hekml~e1793153987175",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:ai-service",
          "service_name": "AI service (vision / speech / language)",
          "name": "DeepSeek · OpenAI · Serper",
          "subtitle": "AI + web search",
          "description": "The web assistant runs on DeepSeek alone since 2026-10-23 (saas AICORE_CHAT_PROVIDERS=deepseek: DeepSeek Flash chats and looks at the pictures in a conversation; no model choice is shown). OpenAI does what DeepSeek cannot: text-embedding-3-small embeds documents and every library-search query, and GPT-6 Luna captions document pictures at vectorize time and answers the MCP door's images. Serper is the web-search tool. The Anthropic code path exists but is not offered. The privacy page names DeepSeek and OpenAI as the AI processors."
        },
        {
          "id": "mail-83j83d~e1793153987176",
          "category": "Any cloud",
          "kind": "service",
          "service": "cloud:email-provider",
          "service_name": "Email provider",
          "name": "Google Workspace",
          "subtitle": "SMTP · info@drawmode.ai",
          "description": "Mail as DrawMode <info@drawmode.ai>: the app's DRAWCORE_SMTP_* and Zitadel's SMTP provider (verification and recovery mail). The Workspace tenant is modebit.ai with drawmode.ai an alias domain (MX, SPF, DKIM, DMARC on the zone)."
        }
      ]
    },
    {
      "id": "users-bm0jsb~e1793153987178",
      "category": "Any cloud",
      "kind": "service",
      "service": "cloud:users",
      "service_name": "Users",
      "name": "People",
      "subtitle": "browsers",
      "description": "Anyone using DrawMode on the web: the editor at app.drawmode.ai (a NiceGUI page and one Socket.IO socket to the replica that served it — editing, AI chat and uploads all ride the socket), the website at drawmode.ai, and published Showcase sites."
    },
    {
      "id": "github-16n7g3~e1793153987179",
      "category": "Any cloud",
      "kind": "service",
      "service": "cloud:git-host",
      "service_name": "Git host / repository",
      "name": "GitHub",
      "subtitle": "drawmode-ai/specmode · main",
      "description": "The Northflank GitHub App builds both app services on every push to main (CI on; a commit message that even quotes [skip ci] skips the whole push). drawmode-releases feeds the desktop's update check."
    },
    {
      "id": "s1-21l6xq~e1793153987180",
      "category": "Any cloud",
      "kind": "step",
      "number": "1"
    }
  ],
  "links": [
    {
      "id": "47ec6efd-74e8-41ae-a6aa-6d7fa4c9c543",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "worker-3n1xct~e1793153987149",
      "target": "r2-2kgc5j~e1793153987150",
      "label": "reads",
      "subtitle": "R2 binding"
    },
    {
      "id": "b0c10d66-c311-498f-9206-36477ed73213",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "worker-3n1xct~e1793153987149",
      "target": "proxy-86v74c~e1793153987148",
      "label": "verifies site passwords",
      "dashed": true,
      "subtitle": "POST …/verify · token",
      "description": "The only reads that reach the app from a published site: a password login (10 a minute per address, 100 per site), the Report page, and publishing. The hash never leaves the app; the Worker holds only the cookie secret."
    },
    {
      "id": "0c62802a-0be4-490b-a664-23e972c1cf3d",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "zitadel-10n925~e1793153987161",
      "label": "logs people in",
      "subtitle": "Session v2 / User v2 APIs · PAT",
      "description": "Native login: the app's own screens, calling Zitadel server-side through the public issuer with the machine user iam-delete's PAT (roles ORG_USER_MANAGER + IAM_LOGIN_CLIENT). The hosted OIDC code+PKCE flow is also supported."
    },
    {
      "id": "10f8db4c-0475-4844-b01c-ea6d87f4c263",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "zitadel-10n925~e1793153987161",
      "target": "pg-f8fw9h~e1793153987162",
      "label": "zitadel2 database",
      "description": "Credentials by alias from the addon (secret-link-postgres-zitadel.json); the primary endpoint, never the read replica."
    },
    {
      "id": "713b09a5-6e57-4860-8c33-34c7f6e0e631",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "lb-au2swl~e1793153987160",
      "target": "rep2-2u2xsb~e1793153987159"
    },
    {
      "id": "74fbb05d-b460-42a1-b908-4aaf83c07add",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "lb-au2swl~e1793153987160",
      "target": "zitadel-10n925~e1793153987161",
      "label": "auth.drawmode.ai",
      "subtitle": "DNS-only · not proxied",
      "description": "auth.drawmode.ai reaches the edge directly (Cloudflare DNS-only, so Northflank's certificate renews). Only the social-login redirects come from the browser; the login screens are the app's own."
    },
    {
      "id": "76d7c07c-9d8b-4f80-baba-78106eab543e",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "redis-688331~e1793153987163",
      "label": "live state",
      "description": "The team provider: the live canonical per diagram and its lock, presence, cursors, the delta relay between replicas, fleet counters. Held to one store write per diagram per 5 s."
    },
    {
      "id": "c24e5520-6447-43dd-b8a3-40adea165ad3",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "vectors-2hdy4f~e1793153987164",
      "target": "redis-688331~e1793153987163",
      "label": "heartbeats",
      "dashed": true,
      "subtitle": "team:servers"
    },
    {
      "id": "d92b6f0d-ade0-4cfc-9ec2-9cdc52650945",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "pg-f8fw9h~e1793153987162",
      "label": "reads / writes",
      "subtitle": "SQLAlchemy",
      "description": "Everything durable, through IPersistence: diagrams, projects, accounts, sessions, the AI ledger (atomic increments), settings, images, the vector job queue, Showcase metadata."
    },
    {
      "id": "e15d75fd-cd0f-42bf-932c-8207d0dd6dff",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "lb-au2swl~e1793153987160",
      "target": "rep1-1evurm~e1793153987158",
      "label": "HTTP :8080",
      "description": "Whichever replica the balancer picks renders the page; its socket then stays on that replica for its life."
    },
    {
      "id": "fab5caed-4588-4b53-998b-6cf8290a5d2d",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "vectors-2hdy4f~e1793153987164",
      "target": "pg-f8fw9h~e1793153987162",
      "label": "claims jobs · writes chunks",
      "subtitle": "FOR UPDATE SKIP LOCKED · pgvector",
      "description": "vector_documents is the queue: pending → processing → ready|error, chunks_done after every embed batch; the Documents view polls those rows, so a job in another container shows up with no UI change."
    },
    {
      "id": "1250115f-4e62-42b9-95ea-cf050e3a0406",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "proxy-86v74c~e1793153987148",
      "target": "lb-au2swl~e1793153987160",
      "label": "HTTPS Full (strict)",
      "subtitle": "WebSocket passed through",
      "description": "Cloudflare checks Northflank's certificate. Unchanging files (the engine, NiceGUI's versioned files, /vendor) are kept at the edge; pages, the socket, /api and /mcp always go through."
    },
    {
      "id": "32c9f7ca-e4b0-4251-8ed6-5793c5b6f47d",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "stripe-26f5xt~e1793153987174",
      "label": "Checkout · Portal",
      "arrows": "both",
      "subtitle": "webhook → /api/billing/webhook/stripe"
    },
    {
      "id": "33defeec-16f3-41bc-a3c8-f1c85e84a6a3",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "mail-83j83d~e1793153987176",
      "label": "mail",
      "dashed": true,
      "subtitle": "SMTP · info@drawmode.ai",
      "description": "Invitations, approval and account mail from the app; Zitadel sends its verification and recovery mail through the same tenant."
    },
    {
      "id": "51e245cb-c7d1-469c-ad55-e50d8ed12bdb",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "users-bm0jsb~e1793153987178",
      "target": "pages-dm9qtw~e1793153987151",
      "label": "HTTPS",
      "subtitle": "drawmode.ai",
      "description": "The website; Cloudflare Web Analytics, cookieless."
    },
    {
      "id": "5bc9e95c-65c6-4fbf-8786-31f720fcccce",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "github-16n7g3~e1793153987179",
      "target": "build-7aoop~e1793153987168",
      "label": "push to main → build",
      "subtitle": "Northflank GitHub App · both services rebuild"
    },
    {
      "id": "692185cb-b844-463a-ae34-e6a6bcaec862",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "zitadel-10n925~e1793153987161",
      "target": "idps-8i07wp~e1793153987173",
      "label": "federates",
      "subtitle": "OIDC / OAuth · /idps/callback"
    },
    {
      "id": "7dcf667a-9b07-4992-920c-a422df2d1abf",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "users-bm0jsb~e1793153987178",
      "target": "worker-3n1xct~e1793153987149",
      "label": "HTTPS",
      "subtitle": "showcase.drawmode.ai",
      "description": "Published sites, served from the edge: no request reaches Northflank unless a password is checked."
    },
    {
      "id": "ad032a91-b29c-4f71-8059-c9b4aa1ad10a",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "vectors-2hdy4f~e1793153987164",
      "target": "openai-8hekml~e1793153987175",
      "label": "embeds + captions",
      "subtitle": "OpenAI — DeepSeek has no embeddings",
      "description": "Documents are chunked and embedded with text-embedding-3-small and their pictures captioned by GPT-6 Luna, all on OpenAI's key: DeepSeek has no embeddings endpoint, so moving captions to it would buy nothing. The embedding quota is the worker's real ceiling."
    },
    {
      "id": "cf334568-7671-4c4d-bd17-57ead54f5d7c",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "r2-2kgc5j~e1793153987150",
      "label": "publishes",
      "subtitle": "S3 API",
      "description": "At publish time the app writes the site's files and manifest to the bucket; a republish replaces the set, a revoke purges it. Its part ends there — the Worker serves."
    },
    {
      "id": "e1889cec-8f54-4859-bec6-1364f4547068",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "svc-8zngkr~e1793153987157",
      "target": "openai-8hekml~e1793153987175",
      "label": "chat · search · query embeddings",
      "subtitle": "DeepSeek · Serper · OpenAI",
      "description": "The assistant's conversations and their pictures go to DeepSeek Flash; the web-search tool to Serper; each library-search query is embedded by OpenAI on this tier (and the MCP door's analyze_image goes to Luna). Vectorizing documents is queued to the worker."
    },
    {
      "id": "e96ea4aa-59f3-4af8-9fd6-fae4e8b30864",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "users-bm0jsb~e1793153987178",
      "target": "proxy-86v74c~e1793153987148",
      "label": "HTTPS + WebSocket",
      "subtitle": "app.drawmode.ai",
      "description": "The page and its Socket.IO socket (/_nicegui_ws/socket.io, websocket transport only). Session cookie drawmode-session signed with DRAWMODE_STORAGE_SECRET; sessions live in Postgres, so no affinity is needed."
    },
    {
      "id": "ea2e22a8-02d8-4ded-94bd-708b5c2472cb",
      "category": "Any cloud",
      "kind": "cloud_flow",
      "source": "clients-8kw28a~e1793153987177",
      "target": "proxy-86v74c~e1793153987148",
      "label": "HTTP",
      "subtitle": "/api · /mcp",
      "description": "Callers that are not browsers and cannot answer a challenge: the Skip rule lets them past the WAF and Browser Integrity Check. Plain HTTP, cut at 100 s by Cloudflare."
    }
  ]
}

Figure code: drawmode:p7bc9c303/df3a10826

Explanation

The prompt:

“create me a diagram using the Any Cloud infra category showing the Northflank web app deployment of DrawMode”