#!/bin/bash # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}Starting Uvify UI Server...${NC}" # Check if node_modules exists if [ ! -d "node_modules" ]; then echo -e "${YELLOW}Installing Node dependencies...${NC}" npm install fi # Activate Python virtual environment if [ -d ".venv" ]; then source .venv/bin/activate else echo -e "${YELLOW}Creating Python virtual environment...${NC}" uv venv source .venv/bin/activate echo -e "${YELLOW}Installing Python dependencies...${NC}" uv pip install 'uvify[api]' fi # Create .env file if it doesn't exist if [ ! -f ".env" ]; then cp .env.example .env echo -e "${YELLOW}Created .env file from .env.example${NC}" fi # Function to cleanup on exit cleanup() { echo -e "\n${YELLOW}Shutting down servers...${NC}" kill $UVIFY_PID $VITE_PID 2>/dev/null exit } trap cleanup EXIT INT TERM # Start uvify backend server echo -e "${GREEN}Starting Uvify backend server on http://localhost:8000${NC}" # Use our CORS wrapper to handle cross-origin requests python uvify_cors_wrapper.py & UVIFY_PID=$! # Wait a moment for the backend to start sleep 2 # Start Vite frontend server echo -e "${GREEN}Starting Vite frontend server on http://localhost:5173${NC}" npm run dev & VITE_PID=$! echo -e "${GREEN}Both servers are running!${NC}" echo -e "Frontend: ${GREEN}http://localhost:5173${NC}" echo -e "Backend API: ${GREEN}http://localhost:8000${NC}" echo -e "\nPress ${YELLOW}Ctrl+C${NC} to stop both servers" # Wait for both processes wait $UVIFY_PID $VITE_PID