-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·111 lines (87 loc) · 2.29 KB
/
start.sh
File metadata and controls
executable file
·111 lines (87 loc) · 2.29 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# Write Aid - Development Startup Script
echo "🚀 Starting Write Aid Development Environment"
echo "============================================="
# Check if we're in the right directory
if [ ! -f "README.md" ]; then
echo "❌ Please run this script from the write-aid root directory"
exit 1
fi
# Function to check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check prerequisites
echo "📋 Checking prerequisites..."
if ! command_exists python3; then
echo "❌ Python 3 is required but not installed"
exit 1
fi
if ! command_exists node; then
echo "❌ Node.js is required but not installed"
exit 1
fi
if ! command_exists npm; then
echo "❌ npm is required but not installed"
exit 1
fi
echo "✅ Prerequisites check passed"
# Setup backend
echo ""
echo "🐍 Setting up Python backend..."
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
echo "Activating virtual environment..."
source venv/bin/activate
# Install dependencies
echo "Installing Python dependencies..."
pip install -r requirements.txt
echo "✅ Backend setup complete"
# Setup frontend in parallel
echo ""
echo "⚛️ Setting up React frontend..."
cd ../frontend
# Install dependencies if node_modules doesn't exist
if [ ! -d "node_modules" ]; then
echo "Installing Node.js dependencies..."
npm install
else
echo "Node.js dependencies already installed"
fi
echo "✅ Frontend setup complete"
# Start both servers
echo ""
echo "🎯 Starting development servers..."
echo "Backend will be available at: http://localhost:5001"
echo "Frontend will be available at: http://localhost:3000"
echo ""
echo "Press Ctrl+C to stop both servers"
echo ""
# Function to cleanup on exit
cleanup() {
echo ""
echo "🛑 Stopping servers..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
exit 0
}
# Set trap to cleanup on exit
trap cleanup INT TERM
# Start backend in background
cd ../backend
source venv/bin/activate
python app.py &
BACKEND_PID=$!
# Wait a moment for backend to start
sleep 3
# Start frontend in background
cd ../frontend
npm start &
FRONTEND_PID=$!
# Wait for both processes
wait