1
Architecture
hobokenchicken edited this page 2026-06-26 14:53:00 -04:00

Architecture

Stack

Layer Technology
Backend language Go
HTTP framework chi/v5
Database PostgreSQL 16
Cache / presence Valkey 8 (Redis-compatible)
WebSocket gateway gorilla/websocket
Voice / video LiveKit (self-hosted)
TURN/STUN coturn
File storage minio
Reverse proxy Caddy
Frontend React 18 + TypeScript + Vite
Styling Tailwind CSS 3.4 (Gruvbox dark terminal theme)
State management Zustand

Service layout

                  ┌──────────────────┐
                  │     Clients      │
                  └────────┬─────────┘
                           │
            ┌──────────────────┼──────────────────┐
            │                  │                  │
      ┌─────┴──────┐   ┌──────┴──────┐
      │  Web App   │   │  TUI Client │
      │  (PWA)     │   │  (Phase 5)  │
      │  React/TS  │   │  bubbletea  │
      └─────┬──────┘   └──────┬──────┘
            │                  │
            └──────────────────┼──────────────────┘
                           │
                  ┌────────┴────────┐
                  │     Caddy       │
                  │  (TLS, proxy)   │
                  └────────┬────────┘
                           │
     ┌──────────────────┼──────────────────┐
     │                  │                  │
┌─────┴──────────┐ ┌───────┴──────────┐
│  Go API Server   │ │   LiveKit     │
│  REST + WS       │ │  voice/video  │
│                 │ │  + coturn     │
└─────────┬─────────┘ └──────────────┘
              │
 ┌────────┼───────────┐
 │ Postgres │ Valkey │ MinIO │
 └───────────────────┘

Backend structure

  • cmd/server - main API + WebSocket gateway
  • cmd/migrate - database migration CLI
  • internal/auth - password hashing, sessions, login/register
  • internal/db - PostgreSQL connection and migrations
  • internal/gateway - WebSocket hub, clients, events
  • internal/server - server CRUD
  • internal/channel - channel CRUD
  • internal/message - message CRUD with pagination
  • internal/middleware - session middleware, auth guard
  • internal/config - environment config