Files
slp-modular-cms/aidlc-docs/features/local-dev-master-slave-setup/construction/plans/unit-1-backend-dual-instance-hosting-code-generation-plan.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

5.5 KiB

Code Generation Plan — Unit 1: Backend Dual-Instance Hosting

Unit Context

  • Requirements covered: FR-1, FR-2, NFR-1, NFR-2, NFR-4 (see inception/requirements/requirements.md)
  • Design source: inception/application-design/components.md, component-methods.md, unit-of-work.md
  • Dependencies: None (first unit)
  • Blocks: Unit 2 (Frontend dual-instance tooling & runbook)
  • Workspace root: K:\Development\Projects\SlpModularCms (brownfield — modify existing files where noted, create new ones elsewhere)
  • Solution file: SlpModularCms.sln

Steps

  • Step 1 — Relocate shared bootstrap code into SlpModularCms.Core

    • Create src/SlpModularCms.Core/Hosting/ModuleOrchestrator.cs (moved from src/SlpModularCms.Api/Infrastructure/ModuleOrchestrator.cs, namespace SlpModularCms.Api.InfrastructureSlpModularCms.Core.Hosting, logic unchanged)
    • Create src/SlpModularCms.Core/Hosting/ServiceCollectionExtensions.cs (moved from src/SlpModularCms.Api/Extensions/ServiceCollectionExtensions.cs, namespace SlpModularCms.Api.ExtensionsSlpModularCms.Core.Hosting, logic unchanged; update its internal using SlpModularCms.Api.Infrastructure; to SlpModularCms.Core.Hosting)
    • Create src/SlpModularCms.Core/Hosting/ApiPrefixConvention.cs (moved from src/SlpModularCms.Api/Infrastructure/ApiPrefixConvention.cs, namespace SlpModularCms.Api.InfrastructureSlpModularCms.Core.Hosting, logic unchanged)
    • Delete the three original files from src/SlpModularCms.Api/
    • Modify src/SlpModularCms.Core/SlpModularCms.Core.csproj: add PackageReference for Asp.Versioning.Mvc (version 10.0.0, matching SlpModularCms.Api.csproj) and Microsoft.AspNetCore.OpenApi (version 10.0.9, matching SlpModularCms.Api.csproj)
  • Step 2 — Update SlpModularCms.Api to consume relocated code

    • Modify src/SlpModularCms.Api/Program.cs: change using SlpModularCms.Api.Extensions; and using SlpModularCms.Api.Infrastructure; to using SlpModularCms.Core.Hosting; (keep using Scalar.AspNetCore;); no other logic changes
    • Modify src/SlpModularCms.Api/SlpModularCms.Api.csproj: remove Asp.Versioning.Mvc and Microsoft.AspNetCore.OpenApi PackageReference entries (now transitively available via Core) — only if removing them doesn't break the build; otherwise leave them (harmless duplication is acceptable, functional correctness takes priority over cleanliness here)
  • Step 3 — Create SlpModularCms.Api.Slave project

    • Create src/SlpModularCms.Api.Slave/SlpModularCms.Api.Slave.csproj: Microsoft.NET.Sdk.Web, net10.0, same PropertyGroup as SlpModularCms.Api.csproj; ProjectReferences to SlpModularCms.Core, SlpModularCms.Modules.Availability, SlpModularCms.Modules.Identity (no SlpModularCms.Modules.Master reference); PackageReference to Scalar.AspNetCore (2.16.3, for Development-only Scalar UI, matching SlpModularCms.Api.csproj) and Microsoft.EntityFrameworkCore.Design (10.0.9, matching SlpModularCms.Api.csproj)
    • Create src/SlpModularCms.Api.Slave/Program.cs: identical structure to src/SlpModularCms.Api/Program.cs (post Step 2), using SlpModularCms.Core.Hosting and Scalar.AspNetCore
  • Step 4 — Configuration files for SlpModularCms.Api.Slave

    • Create src/SlpModularCms.Api.Slave/appsettings.json: mirror SlpModularCms.Api/appsettings.json structure; omit the MasterModule section (not applicable — no Modules.Master loaded); placeholder ConnectionStrings:DefaultConnection for SlpModularCms Slave database
    • Create src/SlpModularCms.Api.Slave/appsettings.Development.json: mirror SlpModularCms.Api/appsettings.Development.json; ConnectionStrings:DefaultConnection pointing at Database=SlpModularCmsSlave (localdb, distinct from master's SlpModularCms); Cors:AllowedOrigins including http://localhost:5174/https://localhost:5174 (the slave frontend dev-server port reserved for Unit 2); omit MasterModule section
    • Create src/SlpModularCms.Api.Slave/appsettings.local.json.example (documented template, since the real file is gitignored — mirrors the pattern of SlpModularCms.Api, which doesn't commit appsettings.local.json itself)
    • Create src/SlpModularCms.Api.Slave/Properties/launchSettings.json: http profile on http://localhost:5285; https profile on https://localhost:7222;http://localhost:5285; both with ASPNETCORE_ENVIRONMENT=Development, launchUrl: scalar
  • Step 5 — Add SlpModularCms.Api.Slave to the solution

    • Modify SlpModularCms.sln: add project entry for SlpModularCms.Api.Slave.csproj following the existing format/GUID conventions used for other projects in the file
  • Step 6 — Documentation summary

    • Create aidlc-docs/features/local-dev-master-slave-setup/construction/unit-1-backend-dual-instance-hosting/code/summary.md documenting what was created/modified, matching the Code Generation completion message content

Notes

  • No new business logic, no new tests required for this unit (per Unit of Work Q3 = A) — verification happens via Build and Test (does it compile, does it start, do existing test suites still pass).
  • appsettings.local.json for the slave (actual gitignored file with real local connection string) is created locally by the developer following the .example template — consistent with how SlpModularCms.Api/appsettings.local.json already works today (present on disk, gitignored, not part of generated code deliverables in aidlc-docs).