#!/usr/bin/env bash # Launch the Aperture backend (FastAPI) and frontend (Vite) together. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" echo "▶ Aperture dev launcher" # 1) ensure samples exist if [ ! -f backend/evals/datasets/invoice_acme_digital.gt.json ]; then echo " · generating sample corpus…" python3 scripts/generate_samples.py >/dev/null fi # 2) backend echo " · starting backend on :8000" ( cd backend && uvicorn app.main:app --port 8000 --reload ) & BACK=$! # 3) frontend if [ ! -d frontend/node_modules ]; then echo " · installing frontend deps (first run)…" ( cd frontend && npm install --silent ) fi echo " · starting frontend on :5173" ( cd frontend && npm run dev ) & FRONT=$! trap 'echo; echo "stopping…"; kill $BACK $FRONT 2>/dev/null || true' INT TERM echo echo " backend: http://localhost:8000/docs" echo " frontend: http://localhost:5173" echo " (Ctrl-C to stop)" wait