-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dev.sh
More file actions
executable file
·61 lines (52 loc) · 1.64 KB
/
start-dev.sh
File metadata and controls
executable file
·61 lines (52 loc) · 1.64 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
#!/bin/bash
# YieldGuard Lite - Development Startup Script
# Run this to start both backend and frontend
set -e
echo "🚀 Starting YieldGuard Lite Development Environment"
echo "=================================================="
# Check for required environment variables
if [ -z "$GROQ_API_KEY" ]; then
echo "⚠️ GROQ_API_KEY not set. AI recommendations will use fallback logic."
echo " Set it with: export GROQ_API_KEY='your-key-here'"
fi
# Start backend
echo ""
echo "📡 Starting Backend API..."
cd backend
if [ ! -d "venv" ]; then
echo " Creating virtual environment..."
python3 -m venv venv
fi
source venv/bin/activate
pip3 install -q -r requirements.txt
# Run in background
uvicorn main:app --reload --port 8000 &
BACKEND_PID=$!
echo " Backend started on http://localhost:8000 (PID: $BACKEND_PID)"
# Wait for backend to be ready
echo " Waiting for backend..."
sleep 3
# Start frontend
echo ""
echo "🎨 Starting Frontend..."
cd ../frontend
if [ ! -d "node_modules" ]; then
echo " Installing dependencies..."
npm install
fi
npm run dev &
FRONTEND_PID=$!
echo " Frontend started on http://localhost:3000 (PID: $FRONTEND_PID)"
echo ""
echo "=================================================="
echo "✅ YieldGuard Lite is running!"
echo ""
echo " Backend API: http://localhost:8000"
echo " Frontend UI: http://localhost:3000"
echo " API Docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop both servers"
echo "=================================================="
# Wait and handle shutdown
trap "echo ''; echo 'Shutting down...'; kill $BACKEND_PID $FRONTEND_PID 2>/dev/null; exit 0" INT TERM
wait