SaaS architecture (Phase 8 — designed, not deployed)

Principles

Components

[Desktop app] --sync (opt-in)--> [API gateway (FastAPI, same routers)] --> [Postgres + TimescaleDB]
                                         |                                   (observations hypertable,
                                         +--> [Worker: collectors, engines]   continuous aggregates)
                                         +--> [Notifier: email, webhooks]
                                         +--> [Billing: Stripe] [Auth: OIDC (Battle.net login optional)]

Migration path

  1. Extract routers from api.py into routers/ with a get_user() dependency (local: always 'local').
  2. Swap db.connect for SQLAlchemy Core with dialect switch (SQLite local / Postgres SaaS); schema identical, hypertable on observations(observed_at).
  3. Add sync endpoints: desktop pushes ledger deltas (event-sourced, idempotent by client UUID), pulls shared market history.
  4. Deploy: one container (API+worker) + managed Postgres; scale workers horizontally only when needed (no premature microservices).

Pricing

Tiers listed above; prices to be tested with the community as requested — not fixed here.