Skip to content

System Architecture

Monozu Cloud is a multi-tenant SaaS platform built for Managed Service Providers (MSP/MSSP). It provides CMDB, ITSM, Security SOC, VPN, and Backup capabilities through a cohesive web application backed by Go APIs and Azure SQL.

flowchart LR
    SPA[Cloud SPA] -->|REST /api/v1| API[Cloud Backend API]
    SPA -->|WebSocket /api/ws| API
    MgmtSPA[Management SPA] -->|REST /api/v1| MgmtAPI[Management Backend]
    Edge[Edge Appliance] -->|POST /v1/ingest| Ingestor[Ingestor Service]
    Edge -->|GET /api/v1/commands| API
    API -->|SQL + RLS| SQL[(Azure SQL Server)]
    API -->|M2M Bearer| MgmtAPI
    MgmtAPI -->|HMAC webhook| API
    MgmtAPI --> SQL
    Ingestor --> SQL
    API -->|OIDC| Entra[Microsoft Entra ID]
    MgmtAPI -->|OIDC| Entra
    API -->|email| Resend[Resend]
    API -->|CVE feeds| NVD[NVD / CISA / MITRE]
    API -->|OTel OTLP| AppInsights[Application Insights]
    CF[Cloudflare Pages] --> SPA
    KV[Azure Key Vault] -->|secrets| API
    KV -->|secrets| MgmtAPI
    ACR[Azure Container Registry] -->|Docker pull| API
    ACR -->|Docker pull| MgmtAPI
DecisionChoiceRationale
Multi-tenancyRow-Level Security (Azure SQL)Isolation without separate databases per tenant
Backend patternDomain-Driven Design, ~35 bounded contextsClear ownership, testability
AuthJWT (access) + HttpOnly cookie (refresh)Secure stateless auth with CSRF protection
Real-timeWebSocket (/api/ws/security, /api/ws/vpn)Push-based updates for SOC and VPN sessions
Frontend stateTanStack Query (server) + Zustand (client)Clear separation of server and UI state
Optional featuresEnvironment-variable feature flagsSame codebase, different deployments
CI/CDAzure DevOps → Docker → ACR → App ServiceContainerized, reproducible deployments
flowchart LR
    A[Browser / Edge Device] --> B[Cloudflare CDN/Workers]
    B --> C[Go API - Fiber v3]
    C --> D[Domain handlers]
    D --> E[Azure SQL - sqlx]
    D --> F[Background jobs]
    F --> G[External APIs - NVD / CISA / Resend]
    C --> H[OpenTelemetry - App Insights]
  1. Browser sends Authorization: Bearer <access_token> to /api/v1/*
  2. auth middleware validates JWT, extracts tenant_id and user_id
  3. RBAC middleware checks required permission against user’s groups
  4. Domain handler runs business logic via sqlx queries on Azure SQL
  5. Azure SQL enforces RLS using SESSION_CONTEXT('tenant_id') set at connection time
  6. Response returned; audit log written for mutating operations
  1. Browser opens ws://api/ws/security?token=<access_token> or ws://api/ws/vpn?token=<access_token>
  2. Backend validates token on upgrade, registers connection in WebSocket hub
  3. Events (security alerts, VPN session updates) are broadcast to matching connections
LayerTechnology
Cloud BackendGo 1.26, Fiber v3, sqlx, zerolog, OpenTelemetry
Management BackendGo 1.26, Fiber v3, sqlx
Cloud FrontendReact 18, Vite 8, TypeScript, React Router 6, TanStack Query v5, Zustand, shadcn/Radix UI, Tailwind CSS
Management FrontendReact 18, Vite 8, TypeScript
DatabaseAzure SQL Server, Flyway migrations (V1–V28)
AuthJWT (HS256), bcrypt, TOTP, OIDC (Microsoft Entra ID)
HostingAzure App Service (backends), Cloudflare Pages (SPAs), Cloudflare Workers (contact form)
ObservabilityOpenTelemetry → Azure Application Insights
SecretsAzure Key Vault (production), .env files (local dev)