SV-2 — Deployment Topology

Viewpoint: where the system runs and how it is deployed.

flowchart TB
  subgraph dev [Developer machine]
    repo[Git repo]
    build[npm run build → dist/]
    migrate[wrangler d1 migrations apply --remote]
  end

  subgraph cf [Cloudflare account]
    subgraph workerrt [Worker: channel-surf-tv]
      fetchh[fetch handler - API + asset serving]
      cronh["cron trigger: 0 */6 * * *"]
    end
    d1[(D1: channel-surf-tv-spots)]
    r2[(R2: channelsurf-bucket - public dev URL)]
    dns[workers.dev route - channel-surf-tv.jgpowers52.workers.dev]
  end

  gitlab[GitLab CI - test, build, SAST/secret detection]

  repo --> gitlab
  repo -->|npm run deploy| build --> workerrt
  repo --> migrate --> d1
  dns --> fetchh
  fetchh --> d1
  cronh --> d1

Deployment facts:

Item Value
Worker name channel-surf-tv (wrangler.jsonc)
Deploy command npm run deploy = build → remote D1 migrations → wrangler deploy
Static assets dist/ uploaded with the worker (ASSETS binding)
Database D1 channel-surf-tv-spots, additive migrations in migrations/
Media R2 channelsurf-bucket, public dev URL baked into API payloads
Cron 0 */6 * * * — Instagram scoring + feed cache refresh
CI GitLab: unit tests → build → SAST + secret detection (deploys are operator-run, not CI)
Secrets INSTAGRAM_ACCESS_TOKEN et al. as Worker secrets; only INSTAGRAM_USER_ID in config