Skip to main content

Architecture Overview

STOA Platform is designed as a cloud-native, multi-tenant gateway platform built for both traditional APIs and AI agents.

High-Level Architecture​

STOA follows a Control Plane / Data Plane separation pattern, similar to Kubernetes and Istio.

Control Plane vs Data Plane​

AspectControl PlaneData Plane
RoleConfiguration, Catalog & GovernanceTraffic Execution & Policy Enforcement
ComponentsControl Plane API, Portal, Console, stoa-operatorstoa-gateway (Rust, maintenance) & Upstream Envoy + stoa-connect (STOA Link, ADR-073)
LatencyHuman-scale (ms OK)Machine-scale (low-ms)
ScalingModerateHigh (per-request, horizontal)
Architecture Decisions

This separation and data plane evolution are documented in ADR-001: API Exposure Strategy and ADR-073: Adopt Envoy as Primary Data Plane.

Core Components​

Control Plane API​

The central management API built with Python and FastAPI (control-plane-api/).

AspectDetails
LanguagePython 3.11 (requires-python >= 3.11)
FrameworkFastAPI (async)
DatabasePostgreSQL 15 / 16 + SQLAlchemy (shared schema scoped by tenant_id)
Event StreamingRedpanda / Kafka (ADR-005)
AuthKeycloak OIDC (stoa realm, ADR-074)

Responsibilities:

  • Subscription and API catalog management
  • Tenant provisioning (setup_tenant_group in Keycloak)
  • Signed Ed25519 gateway policy bundle issuance (ADR-070)
  • Multi-gateway orchestration across 6 Control Plane adapters: Kong, Gravitee, webMethods, Apigee, AWS API Gateway, and Azure APIM (ADR-035)
  • Usage tracking and audit trails

STOA Gateway & Envoy Data Plane​

STOA operates a production Rust gateway while converging the L4/L7 proxy layer onto upstream Envoy (ADR-073):

AspectCurrent Production (stoa-gateway)Target Data Plane (Envoy + STOA Link)
ImplementationRust (Tokio + axum)Upstream Envoy + stoa-connect (Go xDS ADS) + Rust ext_authz gRPC
LifecycleProduction / MaintenanceOpt-in runtime blocks implemented; topology cut-over in progress
Policy EngineSigned Ed25519 policy bundles (ADR-070) + OPAEnvoy native filters (cors, rate_limit, ip_filter) + gRPC ExtAuthzService (JWT, tenant_id, audience/scopes & DecisionEngine; MCP tool permissions remain separate per ADR-070)
ProtocolsMCP (POST /mcp, /mcp/sse, opt-in /mcp/ws), REST, A2AHTTP/1.1, HTTP/2, gRPC, MCP module behind Envoy

Delivered building blocks on main:

  • Rust stoa-gateway handles MCP protocol sessions, REST contract routes, fail-closed tenant policy enforcement, and supervises an optional gRPC envoy.service.auth.v3.Authorization server (ExtAuthzService, enabled via STOA_EXT_AUTHZ_GRPC_ADDR, STOA_EXT_AUTHZ_AUDIENCE, and non-empty STOA_EXT_AUTHZ_REQUIRED_SCOPES in prod).
  • STOA Link (stoa-connect) opens an outbound SSE stream (ADR-059) to the Control Plane to receive deployment notifications, and embeds an explicit opt-in loopback mTLS ADS server (STOA_GATEWAY_TYPE=envoy) alongside its Go route adapters for Kong, Gravitee, and webMethods (Link policy application is rejected as unsupported for Kong and Gravitee in policy_contract.go, while the broader 6-adapter set runs in the Control Plane). Full policy parity and default topology migration remain distinct milestones (Data Plane Architecture).

Portal UI​

Self-service developer portal built with React 19 and TypeScript (portal/).

Features:

  • API and MCP tool catalog browsing
  • Subscription and API key management
  • Usage dashboards and interactive documentation

Console UI​

Admin management console built with React 19 and TypeScript (control-plane-ui/).

Features:

  • Tenant and user administration
  • Gateway instance and binding management
  • Policy configuration, system monitoring, and audit logs

Security Layer​

Keycloak​

Identity and access management (ADR-074) providing:

  • Single shared stoa realm (KEYCLOAK_REALM=stoa) with one Keycloak group per tenant
  • OIDC/OAuth2 authentication, PKCE, and verified tenant_id JWT claims
  • Platform and tenant-scoped RBAC (cpi-admin, tenant-admin, devops, viewer)
  • Multi-IdP brokering demonstrated in the separate federation topology (deploy/docker-compose/ profile federation)

Secrets Backend (OpenBao)​

Reached through the Vault HTTP API: OpenBao 2.7.2 by default, or an existing HashiCorp Vault (ADR-075, partial rollout across platform components). Used for:

  • API key and credential encryption
  • Gateway adapter credentials
  • TLS material and service tokens

Data Layer​

PostgreSQL​

Primary relational store using a shared schema scoped by tenant_id (ADR-074):

  • Tenants, users, and subscriptions
  • APIs, contracts, and MCP server/tool definitions
  • Control-plane audit logs

(Note: STOA does not use Redis; rate-limit and token caches run in-process.)

Redpanda (Kafka API)​

Asynchronous event backbone (ADR-005) for:

  • Metering and usage events
  • Audit and error snapshot pipelines
  • Asynchronous cross-service notifications
Internal Only

Redpanda/Kafka is strictly internal with zero external exposure (ADR-005). All external client and agent integrations use HTTPS/gRPC APIs.

Observability Stack​

ComponentPurpose
PrometheusMetrics scraping and alerting rules
GrafanaDashboards and per-tenant visualization
OpenSearch (+ Data Prepper / Fluent Bit)Structured logs, analytics, and audit search
TempoDistributed OpenTelemetry trace storage
AlertmanagerAlert routing

Request Flow​

  1. AI Agent sends a POST /mcp (tools/call) request with a Keycloak Bearer JWT
  2. STOA Gateway validates the RS256 signature against cached JWKS, audience (STOA_MCP_AUDIENCE), and tenant_id claim (ADR-074)
  3. Gateway evaluates the signed per-tenant policy artifact fail-closed (ADR-070) and OPA rules
  4. Gateway forwards the authorized call to the upstream backend or MCP server
  5. Gateway returns the JSON-RPC response and records telemetry

Deployment​

STOA Platform runs on Kubernetes (or Docker Compose for local evaluation):

  • Helm Charts: Located in charts/stoa-platform (gateway-scoped workload + 5 CRDs; Control Plane, UIs, Keycloak, PostgreSQL, Redpanda, and OpenBao are deployed separately) and charts/stoa-observability in stoa-platform/stoa
  • GitOps: ArgoCD compatible
  • IaC: Terraform modules planned (infra/terraform)

Kubernetes Namespace​

Gateway workloads default to the stoa-system namespace:

kubectl get pods -n stoa-system

Ingress Endpoints​

ServiceURL Pattern
Portalportal.<domain>
Consoleconsole.<domain>
Control Plane APIapi.<domain>
Gatewaymcp.<domain> / gateway.<domain>
Authauth.<domain>

Technology Stack Summary​

LayerTechnologyNotes
Control PlanePython 3.11, FastAPIManagement API (control-plane-api/)
Data Plane (current)Rust, Tokio, axumstoa-gateway (maintenance, MCP + REST + ext_authz gRPC)
Data Plane (target)Upstream Envoy + Go (stoa-connect)Loopback mTLS xDS ADS + external services (ADR-073)
Kubernetes OperatorPython, Kopfstoa-operator (Beta, reconciles GatewayInstance / GatewayBinding)
CLI & Link AgentGo 1.25stoactl & stoa-connect (stoa-go/)
FrontendReact 19, TypeScript, TailwindDeveloper Portal & Admin Console
DatabasePostgreSQL 15 / 1615 in full Compose / prod catalog, 16 in minimal R1; shared schema scoped by tenant_id (ADR-074)
Event StreamingRedpanda (Kafka API)Internal event backbone (ADR-005)
AuthKeycloak 26Single stoa realm + per-tenant groups (ADR-074)
SecretsOpenBao 2.7.2 / HashiCorp VaultVault HTTP API (ADR-075, partial rollout)
ObservabilityPrometheus, Grafana, OpenSearch, TempoMetrics, logs, traces
InfrastructureKubernetes, Helm, ArgoCDDeclarative deployment

Next Steps​

Cookies and privacy

With your permission, we use cookies to measure visits and understand navigation to improve the site.

Learn more

Google Analytics measures visits and useful clicks. Microsoft Clarity provides masked interaction replays. No advertising use. Your choice is saved for six months. You can change or withdraw it at any time using the “Cookies” button.

Read the audience measurement details