#!/bin/bash # YouMusic Local Development Setup Script # For faster development without Docker (macOS/Linux only) # Uses Python 3.13 and uv for package management set -e echo "🎵 YouMusic - Local Development Setup" echo "======================================" echo "" # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Check Python 3.13 echo "Checking Python 3.13 installation..." if ! command -v python3.13 &> /dev/null; then echo -e "${RED}❌ Python 3.13 is required but not installed${NC}" echo "" echo "Install Python 3.13:" echo " macOS: brew install python@3.13" echo " Ubuntu/Debian: sudo apt-get install python3.13 python3.13-venv" exit 1 fi PYTHON_VERSION=$(python3.13 --version | cut -d' ' -f2) echo -e "${GREEN}✅ Found Python $PYTHON_VERSION${NC}" # Check uv echo "Checking uv installation..." if ! command -v uv &> /dev/null; then echo -e "${YELLOW}⚠️ uv not found, installing...${NC}" curl -LsSf https://astral.sh/uv/install.sh | sh # Source the profile to get uv in PATH export PATH="$HOME/.cargo/bin:$PATH" if ! command -v uv &> /dev/null; then echo -e "${RED}❌ Failed to install uv${NC}" exit 1 fi fi UV_VERSION=$(uv --version) echo -e "${GREEN}✅ Found uv $UV_VERSION${NC}" # Check Node.js echo "Checking Node.js installation..." if ! command -v node &> /dev/null; then echo -e "${RED}❌ Node.js is required but not installed${NC}" echo "Please install Node.js 18 or higher" exit 1 fi NODE_VERSION=$(node --version) echo -e "${GREEN}✅ Found Node.js $NODE_VERSION${NC}" # Check FFmpeg echo "Checking FFmpeg installation..." if ! command -v ffmpeg &> /dev/null; then echo -e "${YELLOW}⚠️ FFmpeg not found${NC}" echo "FFmpeg is required for audio processing. Install it:" echo " macOS: brew install ffmpeg" echo " Ubuntu/Debian: sudo apt-get install ffmpeg" echo "" read -p "Do you want to continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi else FFMPEG_VERSION=$(ffmpeg -version | head -n1) echo -e "${GREEN}✅ Found FFmpeg${NC}" fi echo "" echo "📁 Setting up project directories..." mkdir -p data/music data/uploads data/temp # Backend setup echo "" echo "🔧 Setting up Backend..." cd backend if [ ! -d ".venv" ]; then echo "Creating Python 3.13 virtual environment with uv..." uv venv --python 3.13 fi echo "Installing Python dependencies with uv..." uv sync echo -e "${GREEN}✅ Backend setup complete${NC}" # Create .env file if it doesn't exist if [ ! -f ".env" ]; then echo "Creating .env file..." cp .env.example .env echo -e "${YELLOW}⚠️ Please review backend/.env and adjust settings if needed${NC}" fi cd .. # Frontend setup echo "" echo "🎨 Setting up Frontend..." cd frontend if [ ! -d "node_modules" ]; then echo "Installing npm dependencies (this may take a few minutes)..." NODE_ENV= npm install --include=dev else echo "Updating npm dependencies..." NODE_ENV= npm install --include=dev fi echo -e "${GREEN}✅ Frontend setup complete${NC}" # Create .env file if it doesn't exist if [ ! -f ".env" ]; then echo "Creating .env file..." cp .env.example .env fi cd .. echo "" echo -e "${GREEN}✅ Setup Complete!${NC}" echo "" echo "======================================" echo "🚀 Start Development Servers" echo "======================================" echo "" echo "You need to run TWO terminals:" echo "" echo -e "${YELLOW}Terminal 1 - Backend:${NC}" echo " cd backend" echo " source .venv/bin/activate" echo " python main.py" echo "" echo -e "${YELLOW}Terminal 2 - Frontend:${NC}" echo " cd frontend" echo " npm run dev" echo "" echo "Then visit: http://localhost:3000" echo "" echo "Or use the helper scripts:" echo " ./dev-backend.sh (start backend)" echo " ./dev-frontend.sh (start frontend)" echo " ./dev.sh (start both in background)" echo ""