# High-Level Architecture Design (HLD) — Universal Enterprise Platform | Field | Value | |---|---| | **Document** | `hld.md` | | **System** | Universal Enterprise Platform (UEP) | | **Pattern** | Modular Monolith with Multi-Tenant Row-Level Security | | **Version** | 1.1.0 | | **Last CR** | `CR-001` | | **Status** | Rebaselined; pending authentication design decisions | --- ## 1. System Architecture Topology ```mermaid graph TD ClientWeb["Web Portals (React + Vite + Tailwind)"] --> NGINX["API Gateway / Reverse Proxy (NGINX)"] ClientMobile["Mobile Apps / External Consumers"] --> NGINX NGINX --> AuthFilter["Auth & Tenant Context Middleware"] AuthFilter --> Keycloak["Identity Provider (Keycloak OIDC)"] subgraph Modular Monolith Core AuthFilter --> ModAuth["IAM / Auth Module (LLD-001)"] AuthFilter --> ModDomain["Core Business Modules"] AuthFilter --> ModIntegration["Integration & Sandboxes"] end ModAuth --> PG[("PostgreSQL DB (with RLS)")] ModDomain --> PG ModAuth --> Valkey[("Valkey / Redis (Platform Cache; Auth Use TBD)")] ``` --- ## 2. Core Architectural Pillars 1. **Tenant Context and Isolation:** Tenant membership and active context are verified under `UC-019`; resource isolation and RLS are governed by `UC-017` / `UC-020`. Middleware must consume the verified context and apply the approved isolation design. This HLD does not define a client/JWT-supplied tenant as trusted context. 2. **Deterministic Wave 0 Sandboxing:** All external third-party integrations (payment gateways, identity verification, SMS/email) implement an abstract adapter with a local deterministic mock under `app/integrations/sandbox/`. 3. **Pluggable Event Stream:** Inter-module communication executes via in-process domain event dispatchers that can scale out to message queues (RabbitMQ / Kafka) as needed.