67 lines
1.9 KiB
Bash
Executable File
67 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# FitMop Orchestrator Script
|
|
# Starts the backend and frontend for Fitness Antigravity
|
|
|
|
# Set colors
|
|
BLUE='\033[0;34m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${BLUE}🚀 Starting FitMop Environment...${NC}"
|
|
|
|
# Pre-flight checks
|
|
echo -e "${BLUE}🔍 Running Pre-flight Checks...${NC}"
|
|
|
|
# Check for .env_gemini
|
|
if [ ! -f ".env_gemini" ]; then
|
|
echo -e "${RED}⚠️ Warning: .env_gemini not found.${NC}"
|
|
echo -e "${BLUE}Gemini AI features will be unavailable until set in the UI.${NC}"
|
|
fi
|
|
|
|
# Check for uv
|
|
if ! command -v uv &> /dev/null; then
|
|
echo -e "${RED}❌ Error: 'uv' is not installed.${NC}"
|
|
echo -e "${BLUE}Please install it: curl -LsSf https://astral.sh/uv/install.sh | sh${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Kill any existing processes on ports 8000 and 5173
|
|
lsof -ti:8000 | xargs kill -9 2>/dev/null
|
|
lsof -ti:5173 | xargs kill -9 2>/dev/null
|
|
|
|
# Start Backend
|
|
echo -e "${BLUE}📦 Starting Backend API (Port 8000)...${NC}"
|
|
cd backend
|
|
export PYTHONPATH=$PYTHONPATH:$(pwd)/src
|
|
uv run uvicorn main:app --port 8000 > ../backend.log 2>&1 &
|
|
BACKEND_PID=$!
|
|
|
|
# Wait for backend to be ready
|
|
echo -e "${BLUE}⏳ Waiting for Backend...${NC}"
|
|
until curl -s http://localhost:8000/health > /dev/null; do
|
|
sleep 1
|
|
done
|
|
echo -e "${BLUE}✅ Backend is Ready!${NC}"
|
|
|
|
# Start Frontend
|
|
echo -e "${BLUE}🌐 Starting Frontend (Port 5173)...${NC}"
|
|
cd ../frontend
|
|
|
|
# Ensure we use the modern Node.js version
|
|
export PATH="/usr/local/opt/node@24/bin:$PATH"
|
|
|
|
npm run dev -- --port 5173 > ../frontend.log 2>&1 &
|
|
FRONTEND_PID=$!
|
|
|
|
echo -e "${BLUE}------------------------------------------${NC}"
|
|
echo -e "${BLUE}🎉 FitMop is running!${NC}"
|
|
echo -e "${BLUE}🔗 Dashboard: http://localhost:5173${NC}"
|
|
echo -e "${BLUE}------------------------------------------${NC}"
|
|
echo "Press Ctrl+C to stop both services."
|
|
|
|
# Trap Ctrl+C and kill both processes
|
|
trap "kill $BACKEND_PID $FRONTEND_PID; echo -e '\n${BLUE}👋 FitMop stopped.${NC}'; exit" INT
|
|
|
|
wait
|