Skip to main content

Setup and running

Requirements​

NeedWhy
Docker (OrbStack / Docker Desktop)The whole stack: api + web UI, scorer, NATS, OSRM, VROOM, HAPI FHIR, IndicXlit, monitoring
Ollama (native app)Local LLM (gemma3:4b), the fallback when the cloud LLM is unreachable. Runs on the host so it keeps the Metal GPU
Python 3.13 + uvTests, model download and data tooling (pyproject.toml, uv.lock)
Node 20+Frontend tests and dev mode
Go 1.22+ (optional)Dispatch scorer tests
Xcode 26 + an iPhone (optional)iOS citizen and crew apps
Tailscale (optional)Reaching the Mac from the phone over the tailnet
~25 GB diskRoad graph (~6 GB), models (Whisper, IndicTrans2, Gemma), Docker images

First-time install​

make install # Python deps with every extra (dev, ml, integrations, voice) + npm ci in frontend/
cp config/env.example .env # then fill in VAAZHVU_LLM_API_KEY (DeepSeek) and VAAZHVU_CARTO_API_KEY
make osrm-data # download Geofabrik South India + build the OSRM MLD graph (long, ~6 GB)
make models # Whisper, IndicTrans2 (accept the HF terms first), fastText lid.176
make llm # native Ollama.app: 5 parallel slots, keep-alive 24h, pull gemma3:4b (restart the app once)

make models fills ~/.cache/huggingface and ~/.cache/vaazhvu-models; the api container mounts both (override with HF_CACHE / VAAZHVU_MODELS_DIR).

The generated data files are committed, so you only need these when regenerating (see Data):

make gis # backend/app/data/chennai_gis.json from the OSM extract
make hospital-profiles # LLM-profiled emergency capability per hospital
make fleet-plan # MEXCLP placement of the fleet over the profiled hospitals

Do not run uv sync --extra dev alone. uv sync is exact: it uninstalls anything outside the extras you name. With only dev, that removes torch, Whisper, Pipecat, MLX Whisper and NeuroKit2, and the voice line and IndicTrans2 stop working at the next restart. Use make install, or uv sync --extra dev --extra ml --extra integrations --extra voice. (uv run does not remove packages.)

Starting everything (daily)​

The whole stack is one Compose project:

docker compose up -d # or: make up
docker compose build # or: make build (after code changes; needs network)
docker compose down # or: make down
docker compose logs -f api # or: make logs

That starts api (backend + built web UI, :8001 and :8000), postgres (the database), scorer, nats, osrm, vroom, fhir, xlit, and the monitoring trio monitor (:9101), prometheus (:9090) and grafana (:3001). The api reads the LLM provider, model and key and the map key from .env, and reaches the other services by their compose names. Ollama is the one thing outside Docker: the api uses the native app at host.docker.internal:11434. The database is the postgres service (volume pg-data, 127.0.0.1:5432); the native api (make voice) uses the same one, so switching modes moves nothing. First time on a machine that ran the SQLite build: make db-migrate copies var/vaazhvu.db into it. After about 15 s docker compose logs api shows:

Live ops started: 37 units, 4189 hospitals, 16 zones
Voice line warmed

The api image installs the integrations ml voice extras by default (faster-whisper, IndicTrans2, Pipecat; several GB). VAAZHVU_IMAGE_EXTRAS=integrations docker compose build api builds a lite image without speech. Rebuild the api (docker compose build api && docker compose up -d) after backend or frontend changes. docker compose up -d builds only missing images, so it starts without network access; --build / make build re-check base images on Docker Hub and ghcr.io and fail when those are unreachable.

Voice line in Docker: containers on macOS have no Metal GPU and no say, so the 108 voice line uses faster-whisper on CPU (VAAZHVU_WHISPER_MODEL, default small) instead of MLX Whisper, espeak-ng instead of the Vani/Tara voices, and IndicTrans2 runs on CPU. Expect lower Tamil ASR accuracy and more latency than a host run.

An opt-in containerised Ollama exists (docker compose --profile ollama up -d ollama, then set VAAZHVU_OLLAMA_URL=http://ollama:11434), but it is CPU-only on macOS.

Host development mode, with hot reload and the Vite dev server on :5173 proxying /api to :8000 (stop the api container first, it owns :8000):

make run

Ports​

PortService
8001api container: backend + built web UI (also published on 8000)
8000api container, or the backend in host dev mode (make run)
5173Vite dev server (make run, host dev mode only)
5001OSRM (host 5001 → container 5000; macOS AirPlay owns port 5000)
3000VROOM
4222 / 8222NATS client / monitoring
8090HAPI FHIR (/fhir)
11434Ollama (native app on the host)
8095IndicXlit transliteration service
8081Go dispatch scorer
9101Monitor exporter (/metrics, /healthz)
9090 / 3001Prometheus / Grafana (admin / GRAFANA_ADMIN_PASSWORD in .env); loopback only, like every port except the api

URLs​

URLWhat
http://localhost:8001/Dispatcher console
http://localhost:8001/hospital?h=``ER board
http://localhost:8001/ambulance?unit=A01Crew web app
http://localhost:8001/callerBrowser 108 voice line
http://localhost:8001/debug/voiceVoice line debug page
http://localhost:8001/docsSwagger API docs

The browser only allows the microphone on https or localhost. Open the voice pages on the Mac itself.

Phones over Tailscale​

The iPhone apps talk to the Mac by its tailnet name. No server is built in: set yours once per checkout in ios/Vaazhvu/Config/Local.xcconfig (git-ignored; copy Local.xcconfig.example), for example VZ_API_BASE_URL = http:/$()/<your-mac>.<tailnet>.ts.net:8001 (// starts a comment in xcconfig, hence the $()). Without it, the app opens its server settings on first launch. You can change the server in the app at any time: long-press the "vaazhvu" title (citizen app) or the "Which vehicle?" title (crew app).

  • App Transport Security: Debug builds allow plain HTTP to the local network (localhost, LAN addresses, *.local) and to *.ts.net (Tailscale already encrypts the traffic). Release builds have no exceptions and accept only https:// servers (ios/Vaazhvu/Config/*-Info.plist, preprocessed with VZ_DEBUG_ATS).
  • Check reachability: tailscale status should list the phone. curl http://<your-mac>.<tailnet>.ts.net:8001/api/ops/state from another tailnet device should return 200.
  • Relayed connections: if the Mac uses an exit node, or tailscale status shows a relay ("relay MH") instead of "direct", expect higher latency. Make sure the Tailscale client and daemon versions match.

iOS apps​

Project: ios/Vaazhvu/Vaazhvu.xcodeproj. There are two app targets, which share Shared/:

SchemeAppBundle id
VaazhvuCitizen appin.vaazhvu.citizen
VaazhvuCrewAmbulance crew appin.vaazhvu.crew

Build and install on a connected iPhone (Developer Mode on, signed with your Personal Team):

cd ios/Vaazhvu
xcodebuild -project Vaazhvu.xcodeproj -scheme Vaazhvu -destination 'id=<device UDID>' \
-derivedDataPath /tmp/vz-dd -allowProvisioningUpdates DEVELOPMENT_TEAM=<team id> build
xcrun devicectl device install app --device <device UDID> /tmp/vz-dd/Build/Products/Debug-iphoneos/Vaazhvu.app
# same with -scheme VaazhvuCrew / VaazhvuCrew.app

To find the UDID, run xcrun devicectl list devices. To build for the simulator only, run make ios-apps. To open the project in Xcode, run make ios-open.

Device test hook: launching the citizen app with -autocall YES opens the voice line immediately. For example: xcrun devicectl device process launch --console --device <udid> in.vaazhvu.citizen -- -autocall YES. The [voice] lines in the console trace the call.

Tests​

make test # pytest: 70+ tests, no external services needed (LLM replaced by ScriptedLLM)
make test-go # Go scorer
make test-web # frontend unit tests (vitest: hotkeys, palette search, queue order, caller questionnaire)
make lint # compileall + vite build + go vet
uv run pytest tests/test_ops.py::test_sms_is_two_way_and_threads_by_number -q # one test

tests/conftest.py disables every external service, injects a scripted LLM for triage, and uses an in-memory database.

Browser smoke test (system Chrome via puppeteer-core): build the frontend, start a scratch backend, then run it against that backend:

cd frontend && npm run build
VAAZHVU_DB=/tmp/vz-smoke.db PYTHONPATH=backend uv run uvicorn app.main:app --port 8012 # from the repo root
cd frontend && BASE=http://127.0.0.1:8012 npm run test:smoke # terminal demo + j/k + ?, and /caller questionnaire at 390 px

Other checks:

make eval # dispatch evaluation (needs OSRM; see docs/eval/README.md)
uv run python scripts/voice_call_sim.py a.wav b.wav --url "ws://localhost:8001/api/ops/voice/ws?caller=sim&lang=ta"
# simulated voice call from WAV files, prints timings
make demo # legacy CLI dry run

Troubleshooting​

SymptomCause / fix
Live ops failed to startOSRM not up (docker compose ps osrm) or infra/osrm graph missing (make osrm-data). Without VAAZHVU_OSRM_URL it falls back to Haversine distance.
make up / docker compose up --build fails: failed to fetch anonymous token, connection reset by peerDocker Hub / ghcr.io unreachable. --build re-checks base images online even when nothing changed. Use docker compose up -d (make up), which builds only missing images; run make build when the network is back.
Image build stalls at apt-get update or uv pip installSlow or blocked Debian / PyPI mirrors. Retry later; the running containers keep the last good image.
Replies slow (5–6 s) and the log says gemma3:4bDeepSeek unreachable (DNS or exit node). Check curl https://api.deepseek.com/models. The local fallback works but its Tamil is weaker.
HTTP 402 … Insufficient Balance in docker compose logs apiThe DeepSeek account is out of credit; every call falls back to gemma3:4b. Top up, then nothing to restart.
Log says the fallback LLM is unreachableOllama.app is not running on the Mac. Start it; the api reaches it at host.docker.internal:11434.
Port already allocated on docker compose upA host process still owns the port (8000/8001/8095/9101 used to be host-run). lsof -nP -iTCP:<port> -sTCP:LISTEN, stop it, then docker compose up -d again.
keep-warm ping failed: nodename nor servname / read operation timed outNo DNS (Tailscale exit node or network), or Ollama is busy with a long request.
Voice line: transcript in the wrong script / nonsenseWhisper misheard. The agent drops non-Tamil/Latin output and asks the caller to repeat (unclear message).
iOS call stuck on "connecting"Check the console for [voice] socket open. If the server log shows the WebSocket accepted but the phone never opens, check Tailscale (tailscale ping <phone ip>).
iOS: AURemoteIO … -66635, microphone output 0 Hz onceiOS reports no audio format while the route settles. The app retries and continues; harmless if audio up follows.
iOS: no AI audioLook for audio up … voice processing … and microphone audio flowing. If both are missing, see the audio attempt N failed reason.
Browser mic blockedUse http://localhost:8001, not the tailnet name (mic needs a secure origin).
HF downloads hangHF_HUB_DISABLE_XET=1 (already set in make models).
Voice upload returns 503 / no voice lineThe api image was built without the ml voice extras (lite). make build builds the full image by default.
OSRM 403 on :5000macOS AirPlay Receiver owns port 5000. OSRM is mapped to 5001.

HTTPS for phones​

Browsers give geolocation (the web crew app's GPS) and service workers only to secure pages, so phones on the LAN or the tailnet should open https://<host>:8443, not http://<host>:8001. make up starts the https service (Caddy, infra/https/Caddyfile) in front of the api; SSE and the voice WebSocket pass through unbuffered.

  • List the names the phones use in .env, each with :8443: VAAZHVU_TLS_SITES="localhost:8443, 192.168.1.20:8443, mac.tail1234.ts.net:8443", then docker compose up -d https.
  • Tailscale certificates (no phone setup): tailscale cert mac.tail1234.ts.net, put the files in infra/https/certs/, and set VAAZHVU_TLS_CERT=/certs/mac.tail1234.ts.net.crt and VAAZHVU_TLS_KEY=/certs/mac.tail1234.ts.net.key.
  • Otherwise Caddy signs with its own local CA: make https-ca writes var/https-root.crt; install it on each phone once (iOS: open the profile, then Settings › General › About › Certificate Trust Settings).