Router

Verified against commit 942a18727c (2026-09-26, DOC-2 of SPRINT_20260926_001). Re-verify by reading the evidence paths listed in the Evidence section of architecture.md.

Service wiring (image, database and role, compose profile, bundle presence) is generated in the service inventory; this dossier does not restate it.

Internal communication fabric for Stella Ops: the single HTTP front door (router-gateway) and the binary transports that connect it to the platform microservices.

The Stella Ops Router is the HTTP ingress and internal routing layer. The gateway (StellaOps.Gateway.WebService) terminates HTTPS, validates tokens, signs an identity envelope, serves the Angular console, and dispatches API requests to microservices over binary transports with health-aware routing, claims-based authorization and centralized admission control. It owns no database.

Why a dedicated router

  1. One routing authority: services publish their endpoints in a HELLO frame; the gateway routes to them without a per-service route-table entry.
  2. Streaming: first-class support for large payloads (SBOMs, scan results, evidence bundles).
  3. Cancellation: request abortion propagates across service boundaries (Cancel frames).
  4. Health-aware routing: instance selection uses heartbeat recency and latency.
  5. Claims-based authorization: unified enforcement at the gateway, with Authority overrides.
  6. Transport flexibility: Messaging over Valkey in the deployed estate, TLS for certificate-based streams, RabbitMQ; TCP and UDP are development-only.
  7. Centralized rate limiting: admission control at the gateway (429 + Retry-After).

Architecture Overview

                                   ┌─────────────────────────────────┐
                                   │ router-gateway                  │
  HTTP Clients ────────────────────►  (StellaOps.Gateway.WebService) │
                                   │                                 │
                                   │  ┌─────────────────────────────┐│
                                   │  │ Endpoint Resolution         ││
                                   │  │ Authorization (Claims)      ││
                                   │  │ Routing Decision            ││
                                   │  │ Transport Dispatch          ││
                                   │  └─────────────────────────────┘│
                                   └──────────────┬──────────────────┘
                                                  │ binary frames
                        ┌─────────────────────────┼─────────────────────────┐
                        ▼                         ▼                         ▼
              ┌─────────────────┐       ┌─────────────────┐       ┌─────────────────┐
              │ Microservice A  │       │ Microservice B  │       │ Microservice C  │
              │ Messaging/Valkey│       │ Messaging/Valkey│       │ TLS             │
              └─────────────────┘       └─────────────────┘       └─────────────────┘

Deployment

AttributeValue
Compose servicerouter-gateway (release bundle devops/release/bundle/docker-compose.yml; development estate devops/compose/docker-compose.stella-services.yml)
Network aliasesrouter.stella-ops.local, stella-ops.local
Container ports8080 (HTTP), 443 (HTTPS); bundle host ports STELLA_HTTP_PORT (default 8080) and STELLA_HTTPS_PORT (default 8443)
Route configurationdevops/release/bundle/config/router-gateway.json mounted as /app/appsettings.json
StateValkey (Messaging transport); no PostgreSQL
Health checkGET /health/ready must return 200

Components

ComponentProjectPurpose
GatewayStellaOps.Gateway.WebServiceHTTP ingress, routing, authorization; the router-gateway deployable
Microservice SDKStellaOps.MicroserviceSDK for building microservices
Source GeneratorStellaOps.Microservice.SourceGenCompile-time endpoint discovery
CommonStellaOps.Router.CommonShared types, frames, transport abstractions, transport plugin loader
ConfigStellaOps.Router.ConfigConfiguration models, YAML binding
Gateway libraryStellaOps.Router.GatewayGateway DI/composition (AddRouterGateway, UseRouterGateway), routing state, route model, microservice-pipeline middleware
Local harnessStellaOps.Router.Gateway.LocalInMemoryHarnessAddRouterGatewayLocalInMemoryHarness, in-memory transport for Development/Testing/Local hosts only
ASP.NET bridgeStellaOps.Router.AspNetMaps ASP.NET endpoint registrations as Router endpoints (AddRouterMicroservice)
Microservice AspNetCore bridgeStellaOps.Microservice.AspNetCoreHosts a Router microservice inside an ASP.NET Core app; identity population and trust mode
InMemory TransportStellaOps.Router.Transport.InMemoryTesting transport
TCP TransportStellaOps.Router.Transport.TcpDevelopment-only transport (insecure-transport gate)
TLS TransportStellaOps.Router.Transport.TlsCertificate-based TCP transport (TransportType.Certificate)
UDP TransportStellaOps.Router.Transport.UdpDevelopment-only small-payload transport
RabbitMQ TransportStellaOps.Router.Transport.RabbitMqMessage queue transport
Messaging TransportStellaOps.Router.Transport.MessagingMessaging/RPC transport over StellaOps.Messaging (Valkey, Postgres, InMemory backends)
MessagingStellaOps.Messaging, StellaOps.Messaging.Transport.{InMemory,Postgres,Valkey}Queue abstraction and backends
Unified transport plugin adapterStellaOps.Router.Plugin.UnifiedAdapts IRouterTransportPlugin to the unified IPlugin / ITransportCapability interfaces. No host or src/Router/StellaOps.Router.sln entry references it (it is listed only in src/StellaOps.sln).

Transport selection is driven by the StellaOps.Router.Common.Enums.TransportType enum: InMemory, Udp, Tcp, Certificate (TLS/mTLS), RabbitMq, and Messaging. HTTP is excluded by design (see Invariants).

Gateway-owned endpoints

Beyond proxying microservice routes, the gateway hosts health, metrics, OpenAPI and build-info aggregation, product-security metadata, Doctor checks, plugin diagnostics, routing administration (router:routing:read / router:routing:write) and the operator verify surface (operator.verify.read / operator.verify.admin). The complete table with scopes and sources is in architecture.md, Gateway-owned HTTP endpoints.

Solution Structure

The solution file is src/Router/StellaOps.Router.sln. Libraries live under src/Router/__Libraries/ and tests under src/Router/__Tests/.

src/Router/
├── StellaOps.Router.sln
├── StellaOps.Gateway.WebService/      (HTTP ingress / gateway host)
├── StellaOps.Router.Plugin.Unified/   (unified transport plugin adapter)
├── __Libraries/
│   ├── StellaOps.Router.Common/
│   ├── StellaOps.Router.Config/
│   ├── StellaOps.Router.Gateway/
│   ├── StellaOps.Router.Gateway.LocalInMemoryHarness/
│   ├── StellaOps.Router.AspNet/
│   ├── StellaOps.Router.Transport.InMemory/
│   ├── StellaOps.Router.Transport.Tcp/
│   ├── StellaOps.Router.Transport.Tls/
│   ├── StellaOps.Router.Transport.Udp/
│   ├── StellaOps.Router.Transport.RabbitMq/
│   ├── StellaOps.Router.Transport.Messaging/
│   ├── StellaOps.Microservice/
│   ├── StellaOps.Microservice.AspNetCore/
│   ├── StellaOps.Microservice.SourceGen/
│   ├── StellaOps.Messaging/
│   ├── StellaOps.Messaging.Transport.InMemory/
│   ├── StellaOps.Messaging.Transport.Postgres/
│   └── StellaOps.Messaging.Transport.Valkey/
├── __Tests/
│   └── (test projects)
└── examples/

Key Documents

Module Documentation (this directory)

DocumentPurpose
architecture.mdCanonical specification
schema-validation.mdJSON Schema validation feature
openapi-aggregation.mdOpenAPI document generation
migration-guide.mdWebService to Microservice migration
rate-limiting.mdCentralized router rate limiting
aspnet-endpoint-bridge.mdUsing ASP.NET endpoint registration as Router endpoint registration
aspnet-request-cancellation.mdRequest cancellation through the ASP.NET bridge
messaging-valkey-transport.mdMessaging transport over Valkey
microservice-transport-guardrails.mdPlugin-only transport guardrails and migration PR checklist
authority-gateway-enforcement-runbook.mdOperations runbook for gateway-enforced auth and signed identity envelope trust
IDENTITY_ENVELOPE_MIDDLEWARE.mdSigned identity-envelope middleware (HMAC-SHA256) reference
webservice-integration-guide.mdIntegrating an existing ASP.NET WebService behind the gateway
transports/README.mdTransport plugin reference
timelineindexer-microservice-pilot.mdHistorical: TimelineIndexer Valkey transport pilot (the TimelineIndexer hosts are retired)
webservices-valkey-rollout-matrix.mdHistorical: all-webservices Valkey migration matrix
rollout-acceptance-20260222.mdHistorical: dual-mode rollout acceptance package (2026-02-22)

Implementation Guides (docs/modules/router/guides/)

DocumentPurpose
GETTING_STARTED.mdStep-by-step setup guide
rate-limiting-config.mdRate limiting configuration guide
rate-limiting-routes.mdPer-route rate-limiting configuration

Runbooks

Quick Start

Gateway (library composition)

The deployable gateway is StellaOps.Gateway.WebService. A custom host composes the gateway library like this; the in-memory harness is registered only for Development, Testing or Local environments:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRouterGateway(builder.Configuration);
builder.Services.AddRouterGatewayLocalInMemoryHarness(builder.Environment); // local harness only

var app = builder.Build();
app.UseRouterGateway();

await app.RunAsync();

Microservice

var builder = Host.CreateApplicationBuilder(args);

builder.Services.AddStellaMicroservice(options =>
{
    options.ServiceName = "billing";
    options.Version = "1.0.0";
    options.Region = "us-east-1";
});

builder.Services.AddInMemoryTransportClient();

await builder.Build().RunAsync();

Endpoint Definition

[StellaEndpoint("POST", "/invoices")]
[ValidateSchema(Summary = "Create invoice")]
public sealed class CreateInvoiceEndpoint : IStellaEndpoint<CreateInvoiceRequest, CreateInvoiceResponse>
{
    public Task<CreateInvoiceResponse> HandleAsync(
        CreateInvoiceRequest request,
        CancellationToken ct)
    {
        return Task.FromResult(new CreateInvoiceResponse
        {
            InvoiceId = Guid.NewGuid().ToString()
        });
    }
}

Invariants

These are non-negotiable design constraints:

Building

# Build router solution
dotnet build src/Router/StellaOps.Router.sln

# Run tests
dotnet test src/Router/StellaOps.Router.sln

# Run gateway
dotnet run --project src/Router/StellaOps.Gateway.WebService