Files
slp-modular-cms/aidlc-docs/features/local-dev-master-slave-setup/inception/application-design/component-dependency.md
T
SluijsensandClaude Sonnet 5 274946dbff Adds SlpModularCms.Api.Slave for local master/slave dev testing (Unit 1)
Relocates ModuleOrchestrator, ServiceCollectionExtensions, and
ApiPrefixConvention from SlpModularCms.Api into SlpModularCms.Core.Hosting
so a new Master-less SlpModularCms.Api.Slave host project (ports 5285/7222)
can share the same bootstrap code without duplicating it. This lets a
developer run a master instance and a slave instance side by side locally
to test the master/slave connection, without touching the existing
master/slave protocol itself.

Relocates the two orchestrator/convention test files from
Modules.Identity.Tests to Core.Tests, dropping an incidental
ProjectReference to SlpModularCms.Api that existed only for those tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 02:07:35 +02:00

46 lines
3.0 KiB
Markdown

# 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<br/>:5284 / :7221"]
ApiS["SlpModularCms.Api.Slave<br/>: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.