-
Notifications
You must be signed in to change notification settings - Fork 2
Architecture
joshuaaferguson edited this page Apr 25, 2026
·
3 revisions
This page describes the runtime architecture of a StreamSpace deployment. For the full technical reference (CRDs, sequence diagrams, security boundaries) see docs/ARCHITECTURE.md in the main repo.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Control Plane (single deployment, multi-pod) β
β ββββββββββ ββββββββββββββββ ββββββββββββββββββββββββββββ β
β β Web UI β β API (Gin) β β Agent WebSocket Hub β β
β ββββββββββ β REST + WS β β Heartbeats, commands, β β
β β β β status updates β β
β β Selkies β ββββββββββββββββββββββββββββ β
β β HTTP/WebRTC β β
β β Proxy β ββββββββββββββββββββββββββββ β
β ββββββββββββββββ β PostgreSQL (sessions, β β
β β β users, templates) β β
β β ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ
β WebSocket (wss://)
βββββββββ΄ββββββββ
βΌ βΌ
ββββββββββββ ββββββββββββ
β K8s Agentβ β Docker Agβ
ββββββ¬ββββββ ββββββ¬ββββββ
β β
βΌ βΌ
βββββββββββ βββββββββββ
β Session β β Session β
β Pod β β Containerβ
β Selkies β β Selkies β
β :8080 β β :8080 β
βββββββββββ βββββββββββ
- Auth β JWT issuance/refresh, MFA, SSO bridges (SAML/OIDC/OAuth2)
- Session orchestration β CRUD on Session resources, dispatching commands to the right agent based on the session's chosen platform
- Agent WebSocket Hub β bidirectional channel: control plane β agent (commands), agent β control plane (heartbeats, status, lifecycle events)
-
Selkies HTTP/WebRTC proxy β
/api/v1/http/<session-id>/validates the bearer token, looks up the session's in-cluster Service, and reverse-proxies to the Selkies endpoint on port 8080 - Multi-tenancy β every request is org-scoped via JWT claims; cross-tenant access is rejected at the handler
- Watches a
SessionCRD for new sessions, materializes them into Deployment/Service/PVC - Manages the session lifecycle: create, hibernate, wake, terminate
- Reports back via the WebSocket Hub:
streamingReadyonce the Selkies endpoint is up - Leader election for HA (multi-replica deployment)
- Equivalent of the K8s Agent for Docker hosts
- HA via swappable backend: file, Redis, or Docker Swarm
- React + TypeScript + Material-UI
- Embeds the Selkies stream via
<iframe src="/api/v1/http/<session-id>/?token=β¦"> - Admin pages: users, agents, plugins, templates, audit log, monitoring
- PostgreSQL β single source of truth for sessions, users, templates, tokens, audit events
- Redis β optional, used by the Agent Hub when the control plane runs multi-pod (for cross-pod agent routing)
1. User opens session in the UI
2. UI requests /api/v1/http/<session>/?token=<jwt>
3. API validates the token, looks up the session's in-cluster Service
4. API reverse-proxies the HTTP request to the session pod (Selkies UI assets)
5. Browser establishes a WebRTC peer connection (signaling through the proxy)
6. Once connected, video/audio/input flow browser β pod directly via WebRTC
The control plane never sees raw video frames. Its job is auth, signaling, and asset delivery.
- Control Plane β multi-pod deployment behind a load balancer with sticky sessions (required for the WebSocket hub and the Selkies signaling channel)
- K8s Agent β multi-replica with leader election; only one acts on commands, others stand by
- Docker Agent β file/Redis/Swarm backend selectable per environment
- Database β standard PostgreSQL HA (your provider of choice)
- Browser β API β TLS-enforced ingress, JWT-authenticated, rate-limited
- API β Agent β outbound WebSocket from agent (firewall-friendly), API key or mTLS authentication
- API β Session pod β in-cluster only; the Selkies proxy never exposes a session's address externally
- Network policies β sessions cannot reach each other or the control plane unless explicitly allowed
-
docs/ARCHITECTURE.mdβ the full technical doc -
docs/design/architecture/β ADRs (decision records) -
docs/historical/β frozen v2 snapshots, including the originalV2_ARCHITECTURE.md