-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-start.sh
More file actions
executable file
·85 lines (73 loc) · 2.42 KB
/
Copy pathdev-start.sh
File metadata and controls
executable file
·85 lines (73 loc) · 2.42 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
#!/bin/bash
# VSP MVP Development Startup Script
# This script starts both backend and frontend in development mode
echo "🚀 Starting VSP Chatbot Development Environment..."
# Check if backend/.env exists
if [ ! -f backend/.env ]; then
echo "❌ Error: backend/.env file not found!"
echo "Please copy backend/.env.example to backend/.env and configure it"
echo "See QUICK_START.md for details"
exit 1
fi
# Check if frontend/.env.local exists
if [ ! -f frontend/.env.local ]; then
echo "📝 Creating frontend/.env.local from example..."
if [ -f frontend/.env.example ]; then
cp frontend/.env.example frontend/.env.local
echo "⚠️ Please edit frontend/.env.local and add your NEXTAUTH_SECRET"
else
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > frontend/.env.local
echo "NEXTAUTH_SECRET=change-this-secret" >> frontend/.env.local
echo "NEXTAUTH_URL=http://localhost:3000" >> frontend/.env.local
echo "⚠️ Please edit frontend/.env.local and configure it properly"
fi
fi
# Function to cleanup on exit
cleanup() {
echo "\n🛑 Shutting down..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit
}
trap cleanup INT TERM
# Start Backend
echo "🔧 Starting Backend (FastAPI)..."
cd backend
if [ ! -d "venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv venv
source venv/bin/activate
echo "Installing Python dependencies..."
pip install -r requirements.txt
else
source venv/bin/activate
fi
cd ..
echo "Starting backend server..."
source backend/venv/bin/activate
python -m uvicorn backend.main:app --reload --port 8000 &
BACKEND_PID=$!
echo "✅ Backend started (PID: $BACKEND_PID) on http://localhost:8000"
# Wait for backend to start
sleep 3
# Start Frontend
echo "⚛️ Starting Frontend (Next.js)..."
cd frontend
if [ ! -d "node_modules" ]; then
echo "Installing npm dependencies..."
npm install
fi
npm run dev &
FRONTEND_PID=$!
echo "✅ Frontend started (PID: $FRONTEND_PID) on http://localhost:3000"
echo ""
echo "=================================="
echo "🎉 VSP Chatbot is ready!"
echo "=================================="
echo "Frontend: http://localhost:3000"
echo "Backend: http://localhost:8000"
echo "API Docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop all services"
echo "=================================="
# Wait for both processes
wait $BACKEND_PID $FRONTEND_PID