The API server¶
The API server is the control plane's only request surface. Every CLI command, every SDK call and every node exchange arrives here, passes the same two middleware layers, and reaches a service capability that owns the decision. This page is what happens to a request before any business logic sees it.
The API server¶
flowchart LR
IN["CLI, SDK, nodes"]
subgraph SRV["API SERVER"]
direction TB
subgraph MW["Wraps every route"]
direction TB
AUTH{{"Auth middleware<br/>actor from the token"}}
TRA{{"Trace and audit middleware<br/>correlation, mutation record"}}
AUTH --> TRA
end
subgraph DOM["Service domains, one owner per action"]
direction TB
D1["tenancy, identity"]
D2["flow, project, package, build"]
D3["dispatch, agent, policy, secret"]
D4["model, observability, system"]
end
TRA --> DOM
end
ST[("Store")]
IN --> AUTH
DOM --> ST
The middleware box wraps every route, so identity and audit are the same for
every request whichever domain it reaches. The decision is made inside one
domain box, which is why a refusal that carries a domain reason came from past
the middleware, and a bare 401 came from before it. See
Request admission and scope resolution.
Startup is a hard stop¶
The server asserts its finalization invariants on startup, before it serves. A control plane whose identity latch, backend or store profile does not satisfy the contract does not start serving and then fail requests: it stops.
That is why a control plane that comes up healthy is evidence about its configuration rather than only about its process. See Control plane as source of truth for the latched values.
Authentication happens once, at the edge¶
The auth middleware resolves the actor from the authorization header and puts
the result on the request before any route runs. A request presenting a bearer
token that resolves to a rejection is answered 401 at the middleware, with
the reason and the auth mode in the body:
{
"detail": "unauthorized: <reason>",
"auth_context": { "mode": "<mode>", "rejected": "<reason>" }
}
A request with no bearer token continues, and authorisation is then decided by the capability against the action it names. Identity is established at the edge; permission is decided where the action is known.
Every mutation is traced and audited¶
The trace and audit middleware wraps every endpoint rather than being applied per route. Correlation is stamped centrally, and mutations are recorded centrally, so a capability cannot ship without audit by forgetting to add it.
Three surfaces stay in sync¶
The API server's routes, the API-CLI endpoint catalog and the UX-CLI commands are one surface in three forms, and the catalog is generated and validated from the OpenAPI document in CI rather than maintained by hand.
For a reader this means the endpoint behind a command is discoverable rather than guessed, and a command that resolves against the catalog reaches a route that exists. See The resource gateway for how a generic verb finds its endpoint.
Writes are admitted here and reconciled elsewhere¶
A write persists desired state and returns an operation reference; controllers converge toward it afterwards. A caller that needs the outcome watches the operation rather than holding the request open. See Async operations.