# Component Dependencies — Local Dev Master/Slave Setup ## Dependency Matrix | Component | Depends On | Depended On By | |---|---|---| | `SlpModularCms.Core` (incl. new `Core.Hosting`) | — | `SlpModularCms.Api`, `SlpModularCms.Api.Slave`, `Modules.Master`, `Modules.Availability`, `Modules.Identity` | | `SlpModularCms.Modules.Master` | `Core` | `SlpModularCms.Api` only | | `SlpModularCms.Modules.Availability` | `Core` | `SlpModularCms.Api`, `SlpModularCms.Api.Slave` | | `SlpModularCms.Modules.Identity` | `Core` | `SlpModularCms.Api`, `SlpModularCms.Api.Slave` | | `SlpModularCms.Api` (master host) | `Core`, `Modules.Master`, `Modules.Availability`, `Modules.Identity` | — (top-level executable) | | `SlpModularCms.Api.Slave` (new, slave host) | `Core`, `Modules.Availability`, `Modules.Identity` | — (top-level executable) | | `frontend` | Backend HTTP API (either instance, via `VITE_API_BASE_URL`) | — | ## Communication Patterns - **Build-time**: Standard MSBuild `ProjectReference` — no new communication mechanism. The exclusion of `Modules.Master` from `SlpModularCms.Api.Slave` is achieved purely by omitting that `ProjectReference`, which in turn keeps `Modules.Master.dll` out of the slave's build output, which in turn means `ModuleOrchestrator.DiscoverModules` (running inside the slave process) never finds it. - **Runtime — Master ↔ Slave**: Unchanged existing HTTP-based protocol between `Modules.Master`'s `SlaveApiClient` (master side) and `Modules.Availability`'s `MasterController` (slave side), authenticated via a per-instance API key. This feature does not touch that protocol — it only makes it possible to point one local instance at another. - **Runtime — Frontend ↔ Backend**: Standard HTTPS/CORS, `VITE_API_BASE_URL` selects which backend instance the frontend dev server talks to; `Cors:AllowedOrigins` in the target instance's `appsettings` must include the calling frontend's origin. ## Data Flow (Local Setup) ```mermaid graph LR FE["frontend (Vite dev server)"] ApiM["SlpModularCms.Api
:5284 / :7221"] ApiS["SlpModularCms.Api.Slave
:5285 / :7222"] DBM["Local DB: SlpModularCmsLocal_Master"] DBS["Local DB: SlpModularCmsLocal_Slave"] FE -- "VITE_API_BASE_URL (master mode)" --> ApiM FE -- "VITE_API_BASE_URL (slave mode)" --> ApiS ApiM -- "master/slave protocol (API key)" --> ApiS ApiM --> DBM ApiS --> DBS classDef fe fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; classDef api fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; classDef db fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; class FE fe; class ApiM,ApiS api; class DBM,DBS db; ``` Text alternative: The frontend dev server can point at either the master (5284/7221) or slave (5285/7222) backend depending on which env mode is active. The master backend talks to the slave over the existing master/slave protocol. Each backend uses its own local database, keeping master and slave data isolated.