Development
Requirements
Section titled “Requirements”- Go 1.26 or newer (pure Go, no CGO or C compiler needed)
- Node.js 22+ for the browser crypto, notification and search unit tests
- Chrome or Chromium (optional) for the headless two-browser smoke test
Build and run
Section titled “Build and run”git clone https://github.com/hytte-chat/hyttecd hyttego run .To build a release-style binary with an explicit version:
go build -ldflags "-X main.version=v0.1.0" -o hytte .Project layout
Section titled “Project layout”| Path | What’s in it |
|---|---|
main.go |
CLI flags, validation, one-shot admin commands (-u, --make-admin, --reset-mfa) |
internal/server/ |
HTTP handlers, auth, MFA, admin panel API, media proxy, embedded static assets |
internal/server/static/ |
Vanilla JS/CSS frontend (e2e.js, keystore.js, app.js, sw.js, search.js), HTML templates, fonts and icons |
internal/ws/ |
WebSocket hub, realtime broadcast, presence, typing, Giphy |
internal/chat/ |
Conversation and message orchestration |
internal/db/ |
SQLite schema, migrations and queries (modernc.org/sqlite) |
internal/push/ |
Stdlib-only Web Push (VAPID, RFC 8291) |
internal/unfurl/ |
SSRF-safe link preview fetcher, OpenGraph parser and embed fixer list |
internal/certs/ |
Self-signed TLS certificates and Let’s Encrypt (lego) |
internal/tunnel/ |
Cloudflare (cloudflared) and localhost.run tunnels |
internal/smoke/ |
Two-browser end-to-end smoke test (chromedp) |
There is no frontend build step or bundler: the files in internal/server/static/ are embedded straight into the Go binary with //go:embed.
Running tests
Section titled “Running tests”# Formatting and static checksgofmt -l .go vet ./...go vet -tags browser ./internal/smoke/
# Go unit and integration tests (with race detector)go test -race -count=1 ./...
# JavaScript tests (E2E crypto, media, MFA, notifications, search)node --test internal/server/jstest/*.test.mjs
# Two-browser smoke test (needs Chrome/Chromium)go test -tags browser -count=1 -v ./internal/smoke/Documentation
Section titled “Documentation”These docs live in hytte-chat/hytte-docs and are built with Astro Starlight.
git clone https://github.com/hytte-chat/hytte-docscd hytte-docsnpm installnpm run devScreenshots are regenerated from a fresh local hytte binary with:
HYTTE=../hytte/hytte npm run screenshots