-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart-dev.sh
More file actions
95 lines (78 loc) · 2.23 KB
/
start-dev.sh
File metadata and controls
95 lines (78 loc) · 2.23 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Professor Peter - Development Startup Script
# This script starts both the backend and frontend in development mode
echo "🚀 Starting Professor Peter Development Environment..."
echo ""
# Function to kill background processes on script exit
cleanup() {
echo ""
echo "🛑 Shutting down services..."
kill $backend_pid 2>/dev/null
kill $frontend_pid 2>/dev/null
exit 0
}
# Set up cleanup trap
trap cleanup SIGINT SIGTERM
# Check if backend directory exists
if [ ! -d "backend" ]; then
echo "❌ Backend directory not found!"
echo "Please run this script from the project root directory."
exit 1
fi
# Check if frontend directory exists
if [ ! -d "client" ]; then
echo "❌ Frontend directory not found!"
echo "Please run this script from the project root directory."
exit 1
fi
# Start Backend
echo "🔧 Starting Backend (FastAPI)..."
cd backend
# Check if .env exists, if not copy from example
if [ ! -f ".env" ]; then
echo "📝 Creating .env file from template..."
cp env.example .env
echo "✅ Please edit backend/.env with your API keys (optional for demo mode)"
fi
# Check if uv is available
if command -v uv >/dev/null 2>&1; then
echo "🐍 Using uv to start backend..."
uv run start.py &
backend_pid=$!
else
echo "🐍 Using python to start backend..."
python start.py &
backend_pid=$!
fi
cd ..
# Wait a moment for backend to start
echo "⏳ Waiting for backend to initialize..."
sleep 3
# Start Frontend
echo "🎨 Starting Frontend (Next.js)..."
cd client
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo "📦 Installing frontend dependencies..."
npm install
fi
echo "🚀 Starting Next.js development server..."
npm run dev &
frontend_pid=$!
cd ..
echo ""
echo "✅ Both services are starting!"
echo ""
echo "📍 Service URLs:"
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:8000"
echo " API Docs: http://localhost:8000/docs"
echo ""
echo "🔄 Backend Status: Check the frontend for connection indicator"
echo "📱 Demo Mode: Works without API keys"
echo "🔑 Production: Add API keys to backend/.env"
echo ""
echo "Press Ctrl+C to stop all services"
echo ""
# Wait for background processes
wait