Skip to content

Data Flow

This page documents how data moves between services: which protocols are used, how each connection is authenticated, and what data is exchanged.

FromToProtocolAuthPurpose
Cloud SPACloud BackendREST (/api/v1/*)JWT BearerAll CRUD operations
Cloud SPACloud BackendWebSocket (/api/ws/*)JWT query param ?token=Real-time security alerts, VPN sessions
Cloud BackendManagement BackendHTTP (/internal/v1/*)X-Internal-Token (shared secret)License state fetch
Management BackendCloud BackendHTTP (/internal/license/refresh)HMAC signature (CLOUD_WEBHOOK_HMAC_SECRET)License activation push
Edge ApplianceCloud BackendHTTP (/v1/devices/*, /api/v1/commands)Claim token (bootstrap); then api_key / X-Device-KeyClaim-code registration, command polling
Host Agent (planned)Edge gateway / IngestorHTTP LAN or POST /v1/ingesthost_tokenInventory snapshots (host_inventory)
Edge ApplianceIngestorHTTP (POST /v1/ingest)X-Device-Key headerTelemetry batch upload
Cloud BackendMicrosoft Entra IDOIDC (HTTP)OAuth client credentialsPlatform SSO and per-tenant OIDC
Cloud BackendAzure Communication Services (Email)HTTPManaged Identity (UAMI)Transactional email (invites, vendor OTP, maintenance)
Cloud BackendNVD / CISA / MITREHTTPAPI key (NVD) / publicCVE feed synchronization
Management SPAManagement BackendREST (/api/v1/*)JWT BearerTenant management

sequenceDiagram
    participant Browser
    participant CloudSPA as Cloud SPA
    participant API as Cloud Backend API
    participant SQL as Azure SQL

    Browser->>CloudSPA: Navigate to /incidents
    CloudSPA->>API: GET /api/v1/incidents (Bearer token)
    API->>API: Validate JWT, extract tenant_id + user_id
    API->>API: Check RBAC permission (incidents:read)
    API->>SQL: SELECT … WHERE tenant_id = SESSION_CONTEXT(...)
    SQL-->>API: Rows (RLS enforced)
    API-->>CloudSPA: 200 JSON
    CloudSPA-->>Browser: Render incidents list

sequenceDiagram
    participant Browser
    participant API as Cloud Backend API
    participant SQL as Azure SQL

    Browser->>API: WS upgrade /api/ws/security?token=<jwt>
    API->>API: Validate JWT, register connection in hub
    Note over API: hub maps tenant_id → []connections

    loop External alert arrives
        API->>SQL: INSERT security_alert (via webhook or ingestor)
        API->>API: Broadcast to all hub connections for tenant_id
        API-->>Browser: WS message { type: "alert", ... }
    end

    Browser->>API: WS close
    API->>API: Remove connection from hub

Sequence: Management → Cloud license activation

Section titled “Sequence: Management → Cloud license activation”
sequenceDiagram
    participant MgmtFE as Management SPA
    participant MgmtBE as Management Backend
    participant CloudBE as Cloud Backend

    MgmtFE->>MgmtBE: POST /api/v1/tenants/:id/license
    MgmtBE->>MgmtBE: Update tenant_licenses table (Mgmt DB)
    MgmtBE->>CloudBE: POST /internal/license/refresh (HMAC signed)
    CloudBE->>CloudBE: Verify HMAC signature
    CloudBE->>CloudBE: Update tenant_licenses + tenant_features (Cloud DB)
    CloudBE-->>MgmtBE: 200 OK
    MgmtBE-->>MgmtFE: License activated
    Note over CloudBE: Tenant active. Without activation, login is blocked.

sequenceDiagram
    participant Edge as Edge Appliance
    participant CloudBE as Cloud Backend
    participant Ingestor as Ingestor Service
    participant SQL as Azure SQL

    Edge->>CloudBE: claim-complete (api_key issued)
    Note over Edge: After monozu edge register + internal assign

    loop Telemetry batch (periodic)
        Edge->>Ingestor: POST /v1/ingest (X-Device-Key)
        Note right of Edge: body device_id + items
        Ingestor->>SQL: Route items to per-kind tables
        Ingestor-->>Edge: 200 OK
    end

    loop Command polling
        Edge->>CloudBE: GET /v1/commands
        CloudBE-->>Edge: pending commands e.g. RAUC update
    end

Note: claim assign uses POST /internal/devices/assign (Management UI TBD).


The connections above depend on these environment variables being set correctly on each service:

VariableSet onPurpose
CLOUD_INTERNAL_API_TOKENCloud Backend + Management BackendShared M2M Bearer secret
CLOUD_WEBHOOK_HMAC_SECRETCloud Backend + Management BackendHMAC signing key for license webhook
MANAGEMENT_API_URLCloud BackendURL of Management Backend (Cloud → Mgmt calls)
CLOUD_API_URLManagement BackendURL of Cloud Backend (Mgmt → Cloud webhook)
VITE_API_URLCloud FrontendCloud Backend API origin
VITE_WS_URLCloud FrontendWebSocket base URL

See Cloud Backend local dev and Management local dev for full variable lists.