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>
5.5 KiB
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 fromsrc/SlpModularCms.Api/Infrastructure/ModuleOrchestrator.cs, namespaceSlpModularCms.Api.Infrastructure→SlpModularCms.Core.Hosting, logic unchanged) - Create
src/SlpModularCms.Core/Hosting/ServiceCollectionExtensions.cs(moved fromsrc/SlpModularCms.Api/Extensions/ServiceCollectionExtensions.cs, namespaceSlpModularCms.Api.Extensions→SlpModularCms.Core.Hosting, logic unchanged; update its internalusing SlpModularCms.Api.Infrastructure;toSlpModularCms.Core.Hosting) - Create
src/SlpModularCms.Core/Hosting/ApiPrefixConvention.cs(moved fromsrc/SlpModularCms.Api/Infrastructure/ApiPrefixConvention.cs, namespaceSlpModularCms.Api.Infrastructure→SlpModularCms.Core.Hosting, logic unchanged) - Delete the three original files from
src/SlpModularCms.Api/ - Modify
src/SlpModularCms.Core/SlpModularCms.Core.csproj: addPackageReferenceforAsp.Versioning.Mvc(version10.0.0, matchingSlpModularCms.Api.csproj) andMicrosoft.AspNetCore.OpenApi(version10.0.9, matchingSlpModularCms.Api.csproj)
- Create
-
Step 2 — Update
SlpModularCms.Apito consume relocated code- Modify
src/SlpModularCms.Api/Program.cs: changeusing SlpModularCms.Api.Extensions;andusing SlpModularCms.Api.Infrastructure;tousing SlpModularCms.Core.Hosting;(keepusing Scalar.AspNetCore;); no other logic changes - Modify
src/SlpModularCms.Api/SlpModularCms.Api.csproj: removeAsp.Versioning.MvcandMicrosoft.AspNetCore.OpenApiPackageReferenceentries (now transitively available viaCore) — only if removing them doesn't break the build; otherwise leave them (harmless duplication is acceptable, functional correctness takes priority over cleanliness here)
- Modify
-
Step 3 — Create
SlpModularCms.Api.Slaveproject- Create
src/SlpModularCms.Api.Slave/SlpModularCms.Api.Slave.csproj:Microsoft.NET.Sdk.Web,net10.0, samePropertyGroupasSlpModularCms.Api.csproj;ProjectReferences toSlpModularCms.Core,SlpModularCms.Modules.Availability,SlpModularCms.Modules.Identity(noSlpModularCms.Modules.Masterreference);PackageReferencetoScalar.AspNetCore(2.16.3, for Development-only Scalar UI, matchingSlpModularCms.Api.csproj) andMicrosoft.EntityFrameworkCore.Design(10.0.9, matchingSlpModularCms.Api.csproj) - Create
src/SlpModularCms.Api.Slave/Program.cs: identical structure tosrc/SlpModularCms.Api/Program.cs(post Step 2), usingSlpModularCms.Core.HostingandScalar.AspNetCore
- Create
-
Step 4 — Configuration files for
SlpModularCms.Api.Slave- Create
src/SlpModularCms.Api.Slave/appsettings.json: mirrorSlpModularCms.Api/appsettings.jsonstructure; omit theMasterModulesection (not applicable — noModules.Masterloaded); placeholderConnectionStrings:DefaultConnectionforSlpModularCms Slavedatabase - Create
src/SlpModularCms.Api.Slave/appsettings.Development.json: mirrorSlpModularCms.Api/appsettings.Development.json;ConnectionStrings:DefaultConnectionpointing atDatabase=SlpModularCmsSlave(localdb, distinct from master'sSlpModularCms);Cors:AllowedOriginsincludinghttp://localhost:5174/https://localhost:5174(the slave frontend dev-server port reserved for Unit 2); omitMasterModulesection - Create
src/SlpModularCms.Api.Slave/appsettings.local.json.example(documented template, since the real file is gitignored — mirrors the pattern ofSlpModularCms.Api, which doesn't commitappsettings.local.jsonitself) - Create
src/SlpModularCms.Api.Slave/Properties/launchSettings.json:httpprofile onhttp://localhost:5285;httpsprofile onhttps://localhost:7222;http://localhost:5285; both withASPNETCORE_ENVIRONMENT=Development,launchUrl: scalar
- Create
-
Step 5 — Add
SlpModularCms.Api.Slaveto the solution- Modify
SlpModularCms.sln: add project entry forSlpModularCms.Api.Slave.csprojfollowing the existing format/GUID conventions used for other projects in the file
- Modify
-
Step 6 — Documentation summary
- Create
aidlc-docs/features/local-dev-master-slave-setup/construction/unit-1-backend-dual-instance-hosting/code/summary.mddocumenting what was created/modified, matching the Code Generation completion message content
- Create
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.jsonfor the slave (actual gitignored file with real local connection string) is created locally by the developer following the.exampletemplate — consistent with howSlpModularCms.Api/appsettings.local.jsonalready works today (present on disk, gitignored, not part of generated code deliverables in aidlc-docs).