Skip to content
rebaserHEAD edited this page Oct 18, 2026 · 5 revisions

explanation, committed verified 2026-10-18 bootstrap c3409ba run 2026-10-18

How the host works as built, and why: the one process that composes the server, checks its settings and the database before it listens, and starts and stops everything in order. The steps are on Host lifecycle, running it is on Running a server, and what's still to build is on Host design.

How it fits together

The shape

One process, one composition root. NexusTomorrow.Server is one ASP.NET Core process. Its composition root registers the owners, persistence, the gateway's pieces and the command layer once, and the harness builds the same host in-process with its own settings.

Settings are checked before anything else. Every settings class is checked when the host starts, before anything touches the database, so a setting it can't use stops the start with the setting's name, never its value.

Migrating is its own step. The server refuses to start while a schema has migrations pending, and NexusTomorrow.Server migrate applies them and exits.

Start-up builds from the back. The write-behind queue starts first, then the owners behind it, and only then the listeners, so nothing a client can reach runs before what it depends on. Shutdown runs the other way: stop taking work, finish the work already taken, then wait for the database (Host lifecycle).

The host keeps the clock. No code reads the system clock: the host supplies one injected clock, and the harness swaps in a fake one.

Why it's built this way

The harness builds this same host in-process, so the composition the tests drive is the one that runs. A setting checked at start turns a mistake into a refusal to start, not a failure at the first login. And the shutdown order is what keeps saves whole.

Knobs

Setting Default Sets
Cli:Enabled on Whether the console reads commands
Logging Information; Warning for ASP.NET Core and EF Core How much the server logs

Each system's own settings are on its page: Gateway, Owners, Persistence, Command layer.

Known edges

  • Shutdown waits for every save with no time limit; Host lifecycle has the detail.

Where the code lives

Piece Path
The program and the migrate verb Source/NexusTomorrow.Server/Program.cs, Source/NexusTomorrow.Server/ServerHost.cs
The composition root Source/NexusTomorrow.Server/CoreServices.cs
Start-up and shutdown Source/NexusTomorrow.Server/CoreLifetime.cs
Settings checks Source/NexusTomorrow.Server/OptionsValidation.cs
Default settings Source/NexusTomorrow.Server/appsettings.json
Tests Tests/NexusTomorrow.Server.Tests/

Clone this wiki locally