# Components: cms-api-foundation Repository: **CMS** = `K:\Development\Projects\SlpModularCms`, **WEB** = this repo. Components marked "new" do not exist yet; "changed" exist and get an additive change. Everything under CMS is built by the CMS session in its own AIDLC; it may rename types, the responsibilities and interfaces are the contract. ## CMS repo ### C1. `SlpModularCms.Api.AndreaSlopFotografie` (new, client host) - **Purpose**: The deployable host for Andrea's site: admin, API and the prerendered website in one process. - **Responsibilities**: - Thin `Program.cs` on the shared `CmsHost`, like `Api.SlpSoftware`. - Module composition: references `Core` and only the module projects Andrea needs. `Offerings` is not referenced. Which other modules are required (Identity, and possibly Availability) is a Functional Design finding of the CMS session. - Sets `CmsHostOptions.WebsiteMode = PrerenderedPages`. - Own appsettings (three-file pattern), own database, own dev port. - Security header configuration: `SecurityHeaders:DefaultPolicy = StrictSite` and `AllowedScriptOrigins` / `AllowedConnectOrigins` for Umami and Sentry. - Website indexing setting (`Website:NoIndex`) per environment. - **Interfaces**: the shared `CmsHost.ConfigureServices` / `ConfigurePipeline` calls; configuration sections `SecurityHeaders`, `Website`. ### C2. `CmsHostOptions` (changed, in Core) - **Purpose**: The documented extension point for per-client differences. - **Responsibilities**: carries `WebsiteMode` (`SpaFallback` default, `PrerenderedPages`). The default keeps `Api` and `Api.SlpSoftware` unchanged. - **Interface**: `WebsiteMode WebsiteMode { get; init; }`. ### C3. Prerendered website serving (new, in Core `Hosting`) Four parts, replacing the website half of `UseCmsStaticContent` and `MapCmsSpaFallbacks` when `WebsiteMode = PrerenderedPages`: - **C3a `PrerenderedPathResolver`** (pure function, no I/O beyond a file-existence predicate): maps a request path to one of `Serve(file)`, `Redirect(canonicalPath)`, `NotFound`. Rules: `/` serves `index.html`; `/x` serves `x.html` (also `x/index.html` if present); canonical form is lowercase, without `.html`, without trailing slash, query preserved; paths that look like a file are served as files or 404; traversal attempts never leave the website root; reserved prefixes (`/admin`, `/api/v1`, `/health`) are never handled here. - **C3b `PrerenderedSiteMiddleware`**: applies the resolver, serves files, answers `404.html` with status 404 for unknown paths (never `index.html`), issues canonical 301 redirects, and excludes reserved prefixes so an unknown `/api/v1/x` stays a plain API 404, not the website's 404 page. - **C3c `WebsiteCachePolicy`**: `Cache-Control: no-cache` for pages, long-lived immutable for hashed `/assets`. - **C3d `WebsiteIndexingPolicy`**: when `Website:NoIndex` is true, adds `X-Robots-Tag: noindex, nofollow` and serves `/robots.txt` as "disallow all". Off by default. - **Compression** uses the built-in ASP.NET response compression for the same text types as `web/config/compressibleTypes.ts`; no new dependency. ### C4. `CspPolicyCatalog.StrictSite` (changed, in Core `Hosting/Security`) - **Purpose**: The third code-defined policy for a strict, script-from-self public site. - **Responsibilities**: `Strict` directives plus configured script origins in `script-src` and configured connect origins in `connect-src`; `X-Frame-Options: DENY`; `frame-ancestors 'none'`. `Strict` and `Relaxed` do not change. `PathPolicyRule` and startup validation accept the new name (unknown names still fail startup). - **Interface**: `CspPolicyCatalog.Build("StrictSite", scriptOrigins, connectOrigins) -> SecurityHeaderSet`. ### C5. Admin theming (changed, CMS `frontend/`) - **Purpose**: Make the admin match a site's identity without per-site code. - **Responsibilities**: - Default theme = today's tokens in `index.css`. - A theme folder `frontend/themes//` with a CSS file overriding the tokens (colours, radius, font) and the assets (logo, favicon). - `VITE_THEME` selects the folder at build time; `VITE_APP_TITLE` already names the app; a new build-time `VITE_DEFAULT_LANGUAGE` sets the default admin language (NL for Andrea, EN remains selectable). - First theme: `themes/andreaslop/` from the site's identity (source: `design/andreaslop-static/` and the web theme in this repo). - **Interface**: build-time environment variables only. No API. ### C6. CMS CI/CD (changed, `.gitea/workflows/continuous_integration.yaml`, `deploy-scp.yaml`) - **Purpose**: Build and deploy Andrea's host. - **Responsibilities**: build the admin once per deployable client with its `VITE_THEME` / `VITE_DEFAULT_LANGUAGE` / `VITE_APP_TITLE`; publish `Api.AndreaSlopFotografie`; deploy to the test host with the existing atomic release switch; keep `wwwroot/web/` outside the swapped release directory. ## WEB repo (this repo) ### C7. Site delivery (new) - **Purpose**: Get the prerendered build onto Andrea's CMS host. - **Responsibilities**: a CI job that builds the site and delivers the output (`index.html`, `*.html`, `404.html`, `assets/`, `robots`/sitemap files as built) to `wwwroot/web/` of the test host; keeps the old nginx deployment until the new route passes; afterwards retires the static test site. - **Interface**: file delivery into `wwwroot/web/` (the contract in the CMS repo's `WEBSITE_WORKSPACE.md`). ### C8. Deployment verification (changed, `web/deploy/verify-deployment.sh`) - **Purpose**: Prove the new host serves the site as the old one did, and guard CSP drift. - **Responsibilities**: assert the exact CSP from `contentSecurityPolicy('production')` (`web/config/securityHeaders.ts`) and the other security headers; assert canonical redirects, `404.html` with status 404, caching and `noindex` on test; assert that `/admin`, `/api/v1/System/capabilities` and `/health` respond. ## Process component ### C9. Hand-off (new, documents) - **Purpose**: Moves a feature brief to the CMS session and brings the result back. - **Responsibilities**: the brief is written in this repo's AIDLC folder and a copy is placed in the CMS repo's AIDLC folder (owner decision). The CMS session runs its own AIDLC. The hand-back is a changelog plus the changed contract, verified here by the C8 checks.