Backend
Reference documentation for the Qubital Go backend service. The source lives at StartingQuoTechDivision/livekit-backend-go.
What the backend is
A Go HTTP server built on Gin. It is the single API surface for both the Electron desktop client and the Cloudflare office-router Worker. It owns authentication, room lifecycle, organization management, recording control, calendar sync, and all business logic. It does not handle WebSocket connections directly — those go through the Cloudflare office-router Worker, which authenticates back to the backend via JWT.
The backend runs as two separate binaries from the same codebase:
| Binary | Entry point | Purpose |
|---|---|---|
| API server | cmd/api/main.go | HTTP API, all feature handlers |
| Eventsync worker | cmd/worker/main.go | Polls WorkOS event stream, syncs org/user state to the database |
Both are containerised and deployed on Sevalla.
Codebase layout
cmd/
api/ ← API server entry point
worker/ ← Eventsync worker entry point
internal/
features/ ← Domain features (one package per bounded context)
platform/ ← External service clients (LiveKit, WorkOS, Cloudflare, Google, Grafana)
domain/ ← Shared domain types
repository/ ← Database access layer
database/ ← Connection, migrations
app/ ← Dependency wiring, env loading, boot smoke test
permissions/ ← Permission model
shared/ ← Cross-feature helpers (auth response, image upload, user context)
utils/ ← Utilities (query helpers, transaction manager)
apperr/ ← Application error types
pkg/
auth/ ← WorkOS auth service wrapper
auditlogs/ ← Audit log helpers
logger/ ← Structured logging (slog)
metrics/ ← Prometheus metrics endpoint
middleware/ ← Gin middleware (CORS, gzip, auth)
token/ ← JWT token generation and validation
uid/ ← ID generation
utils/ ← Shared utilities
Sections in this reference
| Section | What's inside |
|---|---|
features/ | One page per domain feature — what it does, its data model, its API surface, and its key dependencies |
api/rest/ | REST endpoint reference (OpenAPI spec + per-endpoint pages) |
api/websocket/ | WebSocket protocol — JWT auth handshake with the office-router Worker |
pkgsite/ | Auto-generated godoc (Tier 2, not yet wired) |
database/ | Schema overview and per-table references |
configuration.md | All environment variables, grouped by service |