-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart-auth-servers.sh
More file actions
executable file
·93 lines (75 loc) · 2.3 KB
/
Copy pathstart-auth-servers.sh
File metadata and controls
executable file
·93 lines (75 loc) · 2.3 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
#!/bin/bash
# Circle Auth Development Server Startup Script
echo "🚀 Starting AI Builders Auth Servers..."
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo -e "${RED}❌ Python 3 is not installed${NC}"
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js is not installed${NC}"
exit 1
fi
# Check if services/backend/.env exists
if [ ! -f "services/backend/.env" ]; then
echo -e "${RED}❌ services/backend/.env not found${NC}"
echo "Please create services/backend/.env from services/backend/.env.example"
exit 1
fi
# Start backend server
echo -e "${BLUE}📦 Starting Backend Server...${NC}"
cd services/backend
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo -e "${BLUE}Creating virtual environment...${NC}"
python3 -m venv venv
fi
# Activate virtual environment and install dependencies
source venv/bin/activate
pip install -q -r requirements.txt
# Start backend in background
python main.py &
BACKEND_PID=$!
echo -e "${GREEN}✅ Backend running on http://localhost:8000 (PID: $BACKEND_PID)${NC}"
# Go back to root directory
cd ../..
# Start frontend server
echo -e "${BLUE}📦 Starting Frontend Server...${NC}"
cd services/frontend
# Install npm dependencies if needed
if [ ! -d "node_modules" ]; then
echo -e "${BLUE}Installing npm dependencies...${NC}"
npm install
fi
npm run dev &
FRONTEND_PID=$!
echo -e "${GREEN}✅ Frontend running on http://localhost:4321 (PID: $FRONTEND_PID)${NC}"
echo ""
echo -e "${GREEN}🎉 Both servers are running!${NC}"
echo ""
echo -e " Frontend: ${BLUE}http://localhost:4321${NC}"
echo -e " Backend: ${BLUE}http://localhost:8000${NC}"
echo -e " API Docs: ${BLUE}http://localhost:8000/docs${NC}"
echo ""
echo -e " Login: ${BLUE}http://localhost:4321/login${NC}"
echo ""
echo -e "${RED}Press Ctrl+C to stop all servers${NC}"
# Function to cleanup on exit
cleanup() {
echo ""
echo -e "${BLUE}🛑 Stopping servers...${NC}"
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
echo -e "${GREEN}✅ Servers stopped${NC}"
exit 0
}
# Register cleanup function
trap cleanup INT TERM
# Wait for processes
wait