-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-simple.sh
More file actions
executable file
·94 lines (74 loc) · 2.21 KB
/
Copy pathstart-simple.sh
File metadata and controls
executable file
·94 lines (74 loc) · 2.21 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
#!/bin/bash
# Botanic Defenders - Simple Startup Script (No Database Required)
echo "🌱 Starting Botanic Defenders (Simplified Version)..."
echo "====================================================="
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check prerequisites
echo "Checking prerequisites..."
if ! command_exists node; then
echo "❌ Node.js is not installed. Please install Node.js 18+ first."
exit 1
fi
if ! command_exists python3; then
echo "❌ Python 3 is not installed. Please install Python 3.8+ first."
exit 1
fi
echo "✅ Prerequisites check passed!"
# Start backend in background
echo ""
echo "🚀 Starting Backend Server..."
cd backend
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating Python virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
source venv/bin/activate
# Install dependencies
echo "Installing backend dependencies..."
pip install -q -r requirements.txt
# Start backend in background
echo "Starting FastAPI server on http://localhost:8002..."
python main.py &
BACKEND_PID=$!
# Wait a moment for backend to start
sleep 5
# Start frontend
echo ""
echo "🌐 Starting Frontend Server..."
cd ../frontend
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
fi
echo "Starting Next.js development server on http://localhost:3000..."
npm run dev &
FRONTEND_PID=$!
echo ""
echo "🎉 Botanic Defenders is now running!"
echo "=================================="
echo "📱 Frontend: http://localhost:3000"
echo "🔧 Backend API: http://localhost:8002"
echo "🌱 Plant Health: http://localhost:3000/plant-health"
echo "📊 Dashboard: http://localhost:3000/dashboard"
echo ""
echo "🔐 Authentication: Enter any email and password to sign in"
echo "🛑 Press Ctrl+C to stop both servers"
# Function to cleanup on exit
cleanup() {
echo ""
echo "🛑 Stopping servers..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
echo "✅ Servers stopped. Goodbye!"
exit 0
}
# Set trap to cleanup on script exit
trap cleanup SIGINT SIGTERM
# Wait for user to stop
wait