Architecture

How the pieces fit together

A clear data flow and a defense-in-depth security model — designed for many accounts across many VPS.

Windows VPS (MT4/MT5 + Agent)  ──facts──▶  Hub (FastAPI · decides)  ──▶  Experience (UI)
PostgreSQL ◀ store ▶ Backup · SSE ▶ realtime · nginx ▶ TLS
LayerResponsibility
IngestionAgents POST facts to the Hub; ephemeral tunnels or direct IP:8040.
DecisionRole/pairing, auto-freeze, risk/health, strategy stack (P1–P10).
PersistencePostgreSQL 16 primary · SQLite fallback · one access layer (store).
DeliveryREST + Server-Sent Events (RBAC-filtered) · nginx reverse proxy + TLS.
OperationsAudit · Observability · Metrics · Backup · DR · HA.

Security model

Defense in depth

🔑

Auth

Remote requests need a token (Bearer / query / 30-day httponly cookie); loopback is admin. Public: health & ingest only.

👥

RBAC

admin vs viewer enforced at the API; UI hides admin controls for viewers. Backend always wins on mismatch.

🛡

Edge

nginx adds security headers (X-Frame, nosniff, Referrer-Policy, CSP) and TLS (Let's Encrypt, HSTS, HTTP/2).