gMAS / web_ui /start.sh
Артём Боярских
chore: initial commit
3193174
#!/bin/bash
# Start both backend and frontend dev servers
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$DIR/.." && pwd)"
VENV="$ROOT/.venv"
echo "Starting gMAS Web UI..."
echo ""
# Use the project root .venv (has torch, rustworkx, uvicorn, etc.)
if [ ! -f "$VENV/bin/python" ]; then
echo "Error: project .venv not found at $VENV" >&2
echo "Run 'uv sync' in the project root first." >&2
exit 1
fi
# Ensure frontend deps are installed
if [ ! -d "$DIR/frontend/node_modules" ]; then
echo "[Frontend] Installing dependencies..."
(cd "$DIR/frontend" && npm ci)
fi
# Start backend
echo "[Backend] Starting FastAPI on http://localhost:8000"
cd "$DIR"
PYTHONPATH="$DIR" "$VENV/bin/uvicorn" backend.main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
# Start frontend
echo "[Frontend] Starting Vite on http://localhost:5173"
cd "$DIR/frontend"
npx vite --host &
FRONTEND_PID=$!
echo ""
echo "gMAS Web UI is running!"
echo " Frontend: http://localhost:5173"
echo " Backend: http://localhost:8000"
echo " API Docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop both servers."
trap "kill $BACKEND_PID $FRONTEND_PID 2>/dev/null" EXIT
wait