CChelar Docs
Architecture

System Architecture

High-level overview of the Chelar platform architecture.

Chelar runs on a single Hetzner AX42 bare metal server (AMD Ryzen 5 3600, 64 GB RAM, 2x 512 GB NVMe, ~EUR 47/mo).

The full architecture details are in ARCHITECTURE_NOMAD.md at the repo root. This page is a summary for quick reference.

Core Components

ComponentRoleTechnology
Go APIControl plane — tenant CRUD, Nomad orchestration, billingGo 1.22+, chi, sqlc + pgx/v5
DashboardUser-facing UI — auth, onboarding, channels, settingsNext.js 15, NextAuth, Tailwind v4
NomadContainer orchestration — schedules tenant jobsHashiCorp Nomad (single binary)
CaddyReverse proxy — wildcard TLS, per-tenant routing, auth gatingCaddy v2, Cloudflare DNS challenge
JuiceFSShared storage — tenant data dirs, encrypted at restS3 backend + Postgres metadata
PostgreSQLPlatform database — tenants, billing, sessionsSupabase-hosted PostgreSQL 16

Request Flow

User → WhatsApp/Telegram → Caddy → tenant container → AI provider

                          Go API manages lifecycle

The Go API is NOT in the message data path. Messages flow directly from Caddy to the tenant container. The API only manages lifecycle, configuration, and billing.

Gateway-per-Tenant Model

Each tenant gets a dedicated container running an AI assistant runtime:

RuntimeLanguageMemoryUse Case
OpenClawNode.js1,024 MBFull-featured, plugins, Pro tier
ZeroClawRust256 MBLightweight, secure, Free tier default

The Go API provisions the container via Nomad, creates the JuiceFS data directory, and configures the Caddy route.

Why Nomad Over Kubernetes

Kubernetes installs ~700 MB of system overhead per node (etcd, kubelet, kube-proxy, CNI, CSI, CRDs). Nomad is a single binary at ~100 MB. For single-replica containers with no service discovery or rolling updates — Nomad is the right tool.

The task driver model allows evolving isolation without changing anything else:

PhaseDriverIsolation
Phase 1 (current)DockerLinux namespaces + cgroups
Phase 2 (planned)Cloud HypervisorVM-level isolation + virtiofs
Phase 3 (future)FirecrackerMinimal attack surface

Key Design Rules

  • Minimal runtime patches — configure via config files + Nomad Variables, not code changes
  • Hybrid control — platform manages infra; users manage AI features natively
  • No user SSH — all access mediated by Go API and Caddy auth gating
  • Tenant isolation — Docker network isolation, per-tenant UID, AES-256-GCM encryption
  • No node pinning — tenant data on JuiceFS; Nomad schedules to any available node

On this page