-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdev.sh
More file actions
43 lines (38 loc) · 1020 Bytes
/
Copy pathdev.sh
File metadata and controls
43 lines (38 loc) · 1020 Bytes
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
#!/usr/bin/env bash
set -eu
# Development mode: runs Vite dev server + FastAPI backend in parallel.
# Vite proxies /api requests to the backend (configured in vite.config.ts).
#
# Usage:
# ./dev.sh # Starts both servers
# ./dev.sh --backend # Backend only (port 8000)
# ./dev.sh --frontend # Frontend only (port 3000)
BACKEND_PORT="${PORT:-8000}"
FRONTEND_PORT="${FRONTEND_PORT:-3000}"
start_backend() {
echo "[backend] Starting FastAPI on port ${BACKEND_PORT}..."
uvicorn backend.main:app \
--reload \
--host 0.0.0.0 \
--port "${BACKEND_PORT}" \
--log-level info
}
start_frontend() {
echo "[frontend] Starting Vite dev server on port ${FRONTEND_PORT}..."
(cd frontend-v2 && npm install --silent 2>/dev/null && npm run dev)
}
case "${1:-}" in
--backend)
start_backend
;;
--frontend)
start_frontend
;;
*)
# Run both in parallel; kill both when either exits
trap 'kill 0' EXIT
start_backend &
start_frontend &
wait
;;
esac