Superpowers Brainstorming

Connected

SP1 — System Architecture

Approach 2: Standard with per-run drilldown.

Containers — green = new in SP1, gray = SP0 already deployed
                        ┌──────────────────────────┐
                        │   Internet (Cloudflare)  │
                        │  marketing.daniel...dev  │
                        └────────────┬─────────────┘
                                     ▼
                          ┌──────────────────┐
                          │     CADDY        │  (SP0)
                          └────┬─────────────┘
                               │
            ┌──────────────────┴──────────────────┐
            ▼                                     ▼
   ┌───────────────────┐               ┌──────────────────────┐
   │      web (SP0)    │               │    api (Fastify)     │
   │      nginx :80    │               │    cluster :3000     │
   │                   │               │                      │
   │   /etl page (NEW) │ ◀──/api/etl──▶│   /api/etl/* (NEW)   │
   │                   │               │     list/runs/trigger│
   └───────────────────┘               │     enable/cron      │
                                       └────┬───────────┬─────┘
                                            │           │
                  ┌─────────────────────────┘           │
                  ▼                                      ▼
       ┌──────────────────┐                  ┌──────────────────────┐
       │   POSTGRES (SP0) │                  │    REDIS (SP0)       │
       │  etl_pipelines   │ ←── new tables   │  mc:sess:* (SP0)     │
       │  etl_runs        │                  │  bull:* (NEW —       │
       │  ...SP0 tables   │                  │     BullMQ queues)   │
       └──────────────────┘                  │  cache:* (NEW —      │
                                             │     ETL output)      │
                                             └──────────┬───────────┘
                                                        │ enqueue
                                                        ▼
              ╔═══════════════════════════════════════════════════════╗
              ║   marketing-worker (NEW, separate container)          ║
              ║   ┌───────────────────────────────────────────────┐   ║
              ║   │  BullMQ Worker process                        │   ║
              ║   │  ─ scheduler emits cron jobs every minute     │   ║
              ║   │  ─ pipeline registry: 5 functions             │   ║
              ║   │     bq.reference   → BigQuery → Redis cache:* │   ║
              ║   │     bq.projects    → BigQuery → Postgres + Redis│ ║
              ║   │     ch.top_dests   → ClickHouse → Redis       │   ║
              ║   │     yespo.OVAGO    → Yespo API → Redis        │   ║
              ║   │     yespo.brand_b  → Yespo API → Redis        │   ║
              ║   │  ─ writes etl_runs row to Postgres            │   ║
              ║   │  ─ resolves creds via shared cred service     │   ║
              ║   └───────────────────────────────────────────────┘   ║
              ║   limits: 1 CPU · 512 MB                              ║
              ╚═══════════════════════════════════════════════════════╝
                                            │
                                            ▼
              ┌────────────────────────────────────────────────────┐
              │  External services                                 │
              │  ─ BigQuery  (bdi-chat-va.n8n_oss.*)               │
              │  ─ ClickHouse (data-platform-clickhouse...)        │
              │  ─ Yespo (yespo.io/api/v1/group/{groupId}/contacts)│
              └────────────────────────────────────────────────────┘

   Resource budget delta:
   ┌────────────────┬────────┬────────┬────────────────────────────┐
   │ service        │ RAM    │ CPU    │ rationale                  │
   ├────────────────┼────────┼────────┼────────────────────────────┤
   │ marketing-worker│ 512 MB │  1.0   │ BullMQ + BQ client + heap  │
   │                │        │        │  for full-table loads      │
   ├────────────────┼────────┼────────┼────────────────────────────┤
   │ TOTAL (SP1+SP0)│ ~2.7 GB│  ~6    │ still fits 4-vCPU / 4 GB   │
   └────────────────┴────────┴────────┴────────────────────────────┘

Approve in terminal — next: components, data flow, error handling, tests.

Click an option above, then return to the terminal