Skip to content

Hot-reload dev loop

Quick start

nix run .#dev

Öffnet eine Zellij-Session mit drei Panes — Go-Server (air, oben), Python-Sidecar (entr, unten links) und Vite-WebUI (unten rechts). Maus-Navigation zwischen Panes funktioniert out of the box. Kein manuelles Setup — envprep, GPU-Wheels und Modell-Downloads laufen selbst. Browser auf http://127.0.0.1:5602 — der Server proxied nicht-API-Routen zu Vite (--webui-dev-proxy), ein Port für alles.


Restarting the full stack on every Go change is expensive — the sidecar holds Parakeet, Gemma, and the TTS voices in VRAM. Cold start is ~10 s on a warm cache and longer when models still need to download.

The trick: decouple the two processes during dev. Run the sidecar standalone, run the server with air, and tell the server to dial the already-running sidecar instead of spawning one. Go restarts stay fast; VRAM only churns when *.py changes.

Run the dev loop (manual fallback)

If nix run .#dev is not available, use two terminals:

# terminal A — Python sidecar, restarts only on *.py change
task dev-sidecar

# terminal B — Go server, rebuilds + restarts on every *.go change
task dev-server

The server in terminal B redials the sidecar in terminal A on every restart. Models stay loaded across Go iterations.

For Python changes the sidecar still cold-restarts — Python doesn't hot-swap torch modules without trouble, so we don't try.

task dev-sidecar needs the venv provisioned once: cd packages/aleph/server && go build -o aleph ./cmd/aleph/ && ./aleph sidecar, Ctrl-C once it's listening.

Vite for the webui (manual fallback)

When not using nix run .#dev, start Vite separately:

cd packages/aleph/webui && bun run dev

task dev-server already passes --webui-dev-proxy http://127.0.0.1:5173 (see .air.toml), so the server proxies to Vite once it's up — browse http://127.0.0.1:5602. Vite's own port also works directly and proxies API calls back to the Go server.

Caveats

  • air only watches Go sources under packages/aleph/server/. Changes to the proto-generated stubs trigger a rebuild via task proto — that change is also picked up by air since the stubs land under the server's internal/pb/ tree.
  • If the sidecar exits while the server is up the server marks the sidecar component as not-ready and keeps polling. Start the sidecar again and the server will reconnect on its own.