Router

Internal communication fabric for Stella Ops — microservices talk through a central gateway over efficient binary transports.

The Stella Ops Router is the internal communication infrastructure that lets microservices communicate through a central gateway using efficient binary protocols, with health-aware routing, claims-based authorization, and centralized admission control.

Why Another Gateway?

Stella Ops already has HTTP-based services. The Router exists because:

  1. Performance: Binary framing eliminates HTTP overhead for internal traffic
  2. Streaming: First-class support for large payloads (SBOMs, scan results, evidence bundles)
  3. Cancellation: Request abortion propagates across service boundaries
  4. Health-aware Routing: Automatic failover based on heartbeat and latency
  5. Claims-based Auth: Unified authorization via Authority integration
  6. Transport Flexibility: UDP for small payloads, TCP/TLS for streams, RabbitMQ for queuing
  7. Centralized Rate Limiting: Admission control at the gateway (429 + Retry-After; instance + environment scopes)

The Router generalizes the earlier HTTP-to-RabbitMQ relay pattern into a simpler, transport-agnostic design.

Architecture Overview

                                   ┌─────────────────────────────────┐
                                   │     StellaOps.Gateway.WebService│
  HTTP Clients ────────────────────►  (HTTP ingress)                 │
                                   │                                 │
                                   │  ┌─────────────────────────────┐│
                                   │  │ Endpoint Resolution         ││
                                   │  │ Authorization (Claims)      ││
                                   │  │ Routing Decision            ││
                                   │  │ Transport Dispatch          ││
                                   │  └─────────────────────────────┘│
                                   └──────────────┬──────────────────┘
                                                  │
                        ┌─────────────────────────┼─────────────────────────┐
                        │                         │                         │
                        ▼                         ▼                         ▼
              ┌─────────────────┐       ┌─────────────────┐       ┌─────────────────┐
              │ Billing         │       │ Inventory       │       │ Scanner         │
              │ Microservice    │       │ Microservice    │       │ Microservice    │
              │                 │       │                 │       │                 │
              │ TCP/TLS         │       │ InMemory        │       │ RabbitMQ        │
              └─────────────────┘       └─────────────────┘       └─────────────────┘

Components

ComponentProjectPurpose
GatewayStellaOps.Gateway.WebServiceHTTP ingress, routing, authorization
Microservice SDKStellaOps.MicroserviceSDK for building microservices
Source GeneratorStellaOps.Microservice.SourceGenCompile-time endpoint discovery
CommonStellaOps.Router.CommonShared types, frames, interfaces
ConfigStellaOps.Router.ConfigConfiguration models, YAML binding
Gateway libraryStellaOps.Router.GatewayGateway DI/composition (AddRouterGateway, UseRouterGateway), routing state, weight overrides
ASP.NET bridgeStellaOps.Router.AspNetMaps ASP.NET endpoint registrations as Router endpoints
Microservice AspNetCore bridgeStellaOps.Microservice.AspNetCoreHosts a Router microservice inside an ASP.NET Core app
InMemory TransportStellaOps.Router.Transport.InMemoryTesting transport
TCP TransportStellaOps.Router.Transport.TcpProduction TCP transport
TLS TransportStellaOps.Router.Transport.TlsEncrypted/certificate-based TCP transport (TransportType.Certificate)
UDP TransportStellaOps.Router.Transport.UdpSmall payload transport
RabbitMQ TransportStellaOps.Router.Transport.RabbitMqMessage queue transport
Messaging TransportStellaOps.Router.Transport.MessagingMessaging/RPC transport over StellaOps.Messaging (Valkey/Postgres/InMemory backends)
Unified transport pluginStellaOps.Router.Plugin.UnifiedPlugin adapter that exposes Router transports as loadable plugins

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

Gateway Control-Plane Endpoints

Beyond proxying microservice routes, the gateway (StellaOps.Gateway.WebService) hosts its own HTTP control-plane and system endpoints. These are treated as “system paths” so they bypass RouteDispatchMiddleware and resolve directly. Scope constants are declared in the gateway endpoint classes and registered in the canonical scope catalog (StellaOps.Auth.Abstractions/StellaOpsScopes.cs).

MethodPathAuthSource
GET/api/v1/router/instances (?service= filter)scope router:routing:read (policy router.routing.read)RouterInstancesEndpoints
GET/api/v1/router/routing/weightsscope router:routing:readRoutingWeightEndpoints
POST/api/v1/router/routing/weightsscope router:routing:write (policy router.routing.write)RoutingWeightEndpoints
POST/api/v1/gateway/administration/router/resyncscope router:routing:write (policy router.routing.write)RouterAdministrationEndpoints / GatewayRegistrationResyncService
GET/buildinfo.jsonanonymous (by design)BuildInfoAggregatorEndpoints
GET/api/openapi/aggregateanonymousOpenApiAggregatorEndpoints
GET/openapi.json, /openapi.yaml, /.well-known/openapianonymousOpenApiAggregatorEndpoints
GET/api/v1/operator/verify/buildinfoanonymousVerifyEndpoints
GET/api/v1/operator/verify/sbom-by-digest/{sha256}scope operator.verify.readVerifyEndpoints
GET/api/v1/operator/verify/ledger-chain/{ledgerId}scope operator.verify.readVerifyEndpoints
GET/api/v1/operator/verify/token-revocationscope operator.verify.readVerifyEndpoints
GET/api/v1/operator/verify/cra-provenance/{tenantId}scope operator.verify.readVerifyEndpoints
POST/api/v1/operator/verify/replay-comparescope operator.verify.adminVerifyEndpoints
GET/health, /health/live, /health/ready, /health/startupsystemHealthCheckMiddleware
GET/metricssystem(Prometheus scrape)

Notes:

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.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/
└── plugins/

Key Documents

Module Documentation (this directory)

DocumentPurpose
architecture.mdCanonical specification and requirements
schema-validation.mdJSON Schema validation feature
openapi-aggregation.mdOpenAPI document generation
migration-guide.mdWebService to Microservice migration
rate-limiting.mdCentralized router rate limiting (dossier)
aspnet-endpoint-bridge.mdUsing ASP.NET endpoint registration as Router endpoint registration
messaging-valkey-transport.mdMessaging transport over Valkey
timelineindexer-microservice-pilot.mdTimelineIndexer Valkey microservice transport pilot mapping and rollback
webservices-valkey-rollout-matrix.mdAll-webservices Valkey microservice migration matrix (waves, owners, rollback)
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
rollout-acceptance-20260222.mdDual-mode rollout acceptance package and evidence index

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

Quick Start

Gateway

var builder = WebApplication.CreateBuilder(args);

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

var app = builder.Build();

// Configure pipeline
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