Architecture and request flow

One application, several deployments

The sites deploy the same ASP.NET Core MVC web project with different startup configuration. Site selection is not per-request hostname dispatch. CodeHelper.SiteMode and CodeHelper.StyleMode are static process-wide values set at startup. Extend the common implementation when adding a deployment; duplicating a web project would split shared behavior and styling.

flowchart LR Browser[Browser] --> Web[ASP.NET Core MVC] Config[Deployment configuration] --> Startup[Program.cs] Startup --> Modes[CodeHelper site and style modes] Modes --> Routes[RouteHelper and menu selection] Routes --> Web Web --> Controllers[Controllers and models] Controllers --> Services[Thessaly services through ServiceClient] Controllers --> Views[Razor views and shared layout] Views --> Browser Browser --> Assets[Static assets and file endpoints]

Repository map

Location Responsibility
CODE.com/Program.cs Configuration bridge, logging, cookies, sessions, middleware, and startup
CODE.com/Classes/RouteHelper.cs Ordered conventional routes and deployment route selection
CODE.com/Classes/CodeHelper.cs Modes, branding, menus, area styling, common metadata, and URL helpers
CODE.com/Classes/CodeController.cs Shared MVC base with current-person, UTM, and reCAPTCHA helpers
CODE.com/Controllers HTTP endpoints, orchestration, redirects, and file delivery
CODE.com/Models Feature view models, service-backed data loading, and presentation adapters
CODE.com/Views Server-rendered Razor pages and shared partials
CODE.com/wwwroot Served styles, scripts, images, fonts, JSON menus, and Vue modules
CODE.com.Tests xUnit regression coverage for menus, reader presentation, and image behavior
docs Developer guide and design specifications

Root-level wwwroot, scratch output folders, and historical views are not automatically the active web project's runtime source. Follow the project and controller references before editing them.

Startup and middleware

Startup imports configuration, parses modes, configures optional CODE Framework database/email logging, sets the minimum password length, and records content/web root paths for helpers. It registers cookie authentication, in-memory session storage, and MVC.

The explicit middleware sequence is cookie policy; production exception handler/HSTS outside Development; session; UTM middleware; HTTPS redirection; static files; routing; authorization; route registration. Authentication services are registered through AddAuthentication().AddCookie(); the source has no explicit UseAuthentication() call. Do not copy this list as a generic ASP.NET pipeline template or silently reorder middleware while making unrelated changes.

UtmSourceMiddleware captures marketing query parameters in session. It also catches downstream exceptions, and its static-extension branch can invoke downstream middleware before the final invocation. These are current implementation details worth checking when requests behave unexpectedly; the guide does not imply that all exceptions reach the production exception handler.

A typical page

A route chooses a controller action. Controllers and, in many features, model constructors/properties load data through CODE Framework ServiceClient.Call<TService>. The action selects a Razor view and supplies its model. The view supplies page metadata and sections; _Layout.cshtml renders the shell, navigation, head metadata, scripts, and footer. Some pages then mount Vue components that call JSON endpoints.

This repository is the web tier. Thessaly service implementations and their storage are outside it. Follow the existing request/response contracts and failure handling rather than introducing a new local persistence layer.

Source references