Repository navigation
Host
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.
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.
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.
| 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.
- Shutdown waits for every save with no time limit; Host lifecycle has the detail.
| 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/ |
Start here
How the server works
- Server core design
- Host
- Gateway
- Owners
- Persistence
- Command layer
- Harness
- Map scheduler design
- Timer wheel design
The protocol
Working on it