StellarStack
Architecture

Architecture Overview

High-level architecture and design of StellarStack

Architecture Overview

StellarStack follows a distributed architecture with a central Control Plane managing multiple Node Daemons that run game servers in Docker containers.

High-Level Architecture

┌─────────────────────────────────────────────────────────────────────────────────┐
│                                 CONTROL PLANE                                    │
│                              (Central Infrastructure)                            │
│                                                                                  │
│    ┌──────────────┐      ┌──────────────┐      ┌──────────────┐                 │
│    │   Caddy/     │      │              │      │              │                 │
│    │   Nginx      │─────▶│   Next.js    │      │  PostgreSQL  │                 │
│    │   (Proxy)    │      │  (Frontend)  │      │   (Primary)  │                 │
│    │   :80/:443   │      │    :3000     │      │    :5432     │                 │
│    └──────┬───────┘      └──────────────┘      └──────┬───────┘                 │
│           │                                           │                          │
│           │              ┌──────────────┐             │                          │
│           └─────────────▶│    Hono      │◀────────────┘                          │
│                          │    (API)     │                                        │
│                          │    :4000     │                                        │
│                          └──────┬───────┘                                        │
│                                 │                                                │
│                          ┌──────▼───────┐                                        │
│                          │    Redis     │                                        │
│                          │   Cluster    │                                        │
│                          │    :6379     │                                        │
│                          └──────┬───────┘                                        │
└─────────────────────────────────┼────────────────────────────────────────────────┘

                    ══════════════╪══════════════  (Secure Channel - mTLS)

         ┌────────────────────────┼────────────────────────┐
         │                        │                        │
         ▼                        ▼                        ▼
┌─────────────────┐      ┌─────────────────┐      ┌─────────────────┐
│     NODE 1      │      │     NODE 2      │      │     NODE 3      │
│   us-west-1     │      │   us-east-1     │      │    eu-west-1    │
│ ┌─────────────┐ │      │ ┌─────────────┐ │      │ ┌─────────────┐ │
│ │ Rust Daemon │ │      │ │ Rust Daemon │ │      │ │ Rust Daemon │ │
│ │   :5000     │ │      │ │   :5000     │ │      │ │   :5000     │ │
│ └──────┬──────┘ │      │ └──────┬──────┘ │      │ └──────┬──────┘ │
│ ┌──────▼──────┐ │      │ ┌──────▼──────┐ │      │ ┌──────▼──────┐ │
│ │   Docker    │ │      │ │   Docker    │ │      │ │   Docker    │ │
│ │ ┌────┬────┐ │ │      │ │ ┌────┬────┐ │ │      │ │ ┌────┬────┐ │ │
│ │ │MC01│MC02│ │ │      │ │ │RS01│RS02│ │ │      │ │ │AK01│VH01│ │ │
│ │ └────┴────┘ │ │      │ │ └────┴────┘ │ │      │ │ └────┴────┘ │ │
│ └─────────────┘ │      │ └─────────────┘ │      │ └─────────────┘ │
└─────────────────┘      └─────────────────┘      └─────────────────┘

Core Components

Control Plane

The control plane is the central hub that manages everything:

ComponentTechnologyPurpose
Web FrontendNext.js 15User interface, SSR, real-time updates
API ServerHonoREST endpoints, WebSocket proxy, auth
DatabasePostgreSQLUsers, servers, configurations
Cache/Pub-SubRedisReal-time events, session storage

Node Plane

Each node runs a lightweight daemon:

ComponentTechnologyPurpose
DaemonRustContainer management, metrics
DockerDocker EngineGame server isolation
WebSocketNativeDirect console access

Data Flow Patterns

Pattern A: Dashboard Load

User ──▶ Next.js ──▶ Hono API ──▶ PostgreSQL

                         └──▶ Redis (cached metrics)

Pattern B: Server Action (Start/Stop/Restart)

User ──▶ Next.js ──▶ Hono API ──▶ Redis Pub/Sub ──▶ Daemon ──▶ Docker
                         │                              │
                         └◀──── Event Confirmation ◀────┘

Pattern C: Console Access (Direct)

User ──▶ Next.js ──▶ Hono (auth check) ──▶ Issues signed token

User ◀──────────────────────────────────────────┘

  └──▶ Direct WebSocket ──▶ Daemon ──▶ Docker Container PTY

Pattern D: Real-time Metrics

Daemon ──▶ Redis Pub/Sub ──▶ Hono ──▶ SSE/WebSocket ──▶ Next.js ──▶ User

Connection Types

Use CaseConnection PathWhy?
ConsoleFrontend → Daemon (WebSocket)Low latency, bidirectional
Server ActionsFrontend → API → Redis → DaemonAuth & audit, queued delivery
File ManagerFrontend → Daemon (WebSocket)Large file transfers
MetricsDaemon → Redis → API → Frontend (SSE)Broadcast to many users
DashboardFrontend → API → PostgreSQLStandard REST pattern
Key Insight

Console and file operations bypass the API for performance. The API only issues short-lived signed tokens for authentication.

Next Steps