FitMop/fitmop.sh

46 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# FitMop Orchestrator Script
# Starts the backend and frontend for Fitness Antigravity
# Set colors
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}🚀 Starting FitMop Environment...${NC}"
# 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
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