Gateway is the routing layer for CodeSnack IDE's containerized development environments. It dynamically routes HTTP/WebSocket traffic to user-specific containers based on hostname patterns.
This is the first component being migrated from Node.js to Go for improved performance, lower memory footprint, and better concurrency handling under high load.
┌───────────────────────────────────────────────────────────────┐
│ Ingress Traffic │
│ (u777-8000.codesnack-ide.com/api/...) │
└──────────────────────────────┬────────────────────────────────┘
│
▼
┌───────────────────────┐
│ Gateway Server │
│ (Ingress Controller) │
└──────────┬────────────┘
│
▼
┌──────────────────────┐
│ Request Pipeline │
│ (orchestrator) │
└──────────┬───────────┘
│
┌───────────────┼───────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌────────────┐ ┌────────────┐
│ Route │ │ Context │ │ Telemetry │
│ Resolver │ │ Enrichment │ │ Tracker │
└────┬─────┘ └────┬───────┘ └──────┬─────┘
│ │ │
│ │ │
Service Discovery Header injection Instrumentation
`u<userId>-<port>` Add metadata Metrics collection
Parse tenant ID Tracing context Active sessions
Lookup backend IP │ │
│ │ │
└─────────┬───────┴───────────────────┘
│
▼
┌─────────────────┐
│ Reverse Proxy │
│ (L7 forwarding) │
└────────┬────────┘
│
▼
┌────────────────────┐
│ Workload Backend │
│ (IPC transport) │
└────────────────────┘
Build: make build
Run: make run
Test: make test