-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·63 lines (52 loc) · 1.75 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.75 KB
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
63
#!/bin/bash
# Rehab AI Development Script
# This script runs both the Python backend and the React frontend concurrently.
# Function to handle cleanup on exit
cleanup() {
echo ""
echo "Stopping services..."
# Kill all background processes started by this script
kill $(jobs -p) 2>/dev/null
exit
}
# Trap SIGINT (Ctrl+C) and SIGTERM
trap cleanup SIGINT SIGTERM
echo "🚀 Starting Rehab AI Development Environment..."
# 1. Check for .env files
if [ ! -f "python-server/.env" ]; then
echo "⚠️ Warning: python-server/.env not found."
if [ -f "python-server/.env.example" ]; then
echo " Creating .env from .env.example..."
cp python-server/.env.example python-server/.env
fi
fi
if [ ! -f "web-client/.env" ]; then
echo "⚠️ Warning: web-client/.env not found."
if [ -f "web-client/.env.example" ]; then
echo " Creating .env from .env.example..."
cp web-client/.env.example web-client/.env
fi
fi
# 2. Check if MongoDB is running (optional but helpful)
if ! nc -z localhost 27017 2>/dev/null; then
echo "ℹ️ MongoDB is not running on localhost:27017."
echo " Starting MongoDB container via Docker..."
(cd python-server && docker compose up -d mongodb)
else
echo "✅ MongoDB is already running."
fi
# 3. Start Backend
echo "📡 Starting Backend API (port 8000)..."
(cd python-server && uv run uvicorn api_server.main:app --reload --port 8000) &
BACKEND_PID=$!
# 4. Start Frontend
echo "💻 Starting Frontend Web Client (port 5173)..."
(cd web-client && npm run dev) &
FRONTEND_PID=$!
echo "---"
echo "API Docs: http://localhost:8000/docs"
echo "Web App: http://localhost:5173"
echo "Press Ctrl+C to stop both services."
echo "---"
# Wait for background processes
wait