Spaces:
Running
Running
File size: 1,773 Bytes
1961f74 40dee71 1961f74 40dee71 1961f74 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export PATH="/opt/homebrew/bin:/opt/homebrew/opt/python@3.12/libexec/bin:$PATH"
echo "Starting CCAI-Vibe-Demo local dev (hot reload enabled)"
echo "Project root: $ROOT"
echo ""
# Cross-project secrets (shared.env) — loaded by backend/app/config.py before .env
if [[ -n "${SHARED_ENV_PATH:-}" && -f "${SHARED_ENV_PATH}" ]]; then
echo "Using shared secrets: $SHARED_ENV_PATH"
elif [[ -f "$HOME/.secrets/shared.env" ]]; then
export SHARED_ENV_PATH="$HOME/.secrets/shared.env"
echo "Using shared secrets: $SHARED_ENV_PATH"
elif [[ -f "$HOME/Downloads/shared.env" ]]; then
export SHARED_ENV_PATH="$HOME/Downloads/shared.env"
echo "Using shared secrets: $SHARED_ENV_PATH"
fi
if [[ ! -f "$ROOT/.env" ]]; then
cp "$ROOT/.env.example" "$ROOT/.env"
echo "Created .env from .env.example — project overrides only; API keys can live in shared.env."
fi
if [[ ! -f "$ROOT/frontend/.env.development" ]]; then
echo "REACT_APP_API_URL=http://localhost:8000" > "$ROOT/frontend/.env.development"
fi
cleanup() {
echo ""
echo "Stopping dev servers..."
jobs -p | xargs kill 2>/dev/null || true
}
trap cleanup EXIT INT TERM
cd "$ROOT/backend"
PYTHON="${PYTHON:-/opt/homebrew/bin/python3.12}"
if [[ ! -d venv ]]; then
"$PYTHON" -m venv venv
source venv/bin/activate
pip install -r requirements.txt
else
source venv/bin/activate
fi
echo "→ Backend: http://localhost:8000 (uvicorn --reload)"
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
BACKEND_PID=$!
cd "$ROOT/frontend"
if [[ ! -d node_modules ]]; then
npm install
fi
echo "→ Frontend: http://localhost:3000 (react-scripts start)"
BROWSER=none npm start &
FRONTEND_PID=$!
wait $BACKEND_PID $FRONTEND_PID
|