#!/usr/bin/env bash # build.sh — Build the React frontend and start the FastAPI server # Usage: ./build.sh [--port 7860] set -e PORT=${2:-7860} echo "=== SQL Analyzer Build Script ===" echo "" # 1. Install Python deps echo "[1/3] Installing Python dependencies..." pip install -r requirements.txt --quiet # 2. Build the React frontend echo "[2/3] Building React frontend..." cd frontend pnpm install --frozen-lockfile --silent pnpm build --silent cd .. echo " → Built to api/static/" # 3. Start the server echo "[3/3] Starting FastAPI server on port $PORT..." echo " → Open http://localhost:$PORT" echo "" cd api exec uvicorn main:app --host 0.0.0.0 --port "$PORT"