#!/bin/bash # Script de dΓ©marrage MVP Veza # ArrΓͺte les services existants, nettoie, puis redΓ©marre tout set -e cd "$(dirname "$0")" echo "🧹 Nettoyage de l'environnement..." # ArrΓͺter les processus existants pkill -f "veza-api" 2>/dev/null || true pkill -f "vite" 2>/dev/null || true pkill -f "node.*web" 2>/dev/null || true # LibΓ©rer les ports lsof -ti:8080 | xargs kill -9 2>/dev/null || true lsof -ti:5173 | xargs kill -9 2>/dev/null || true lsof -ti:8081 | xargs kill -9 2>/dev/null || true lsof -ti:8082 | xargs kill -9 2>/dev/null || true # Nettoyer les fichiers temporaires rm -f backend.pid frontend.pid backend.log frontend.log 2>/dev/null || true sleep 2 echo "πŸ”¨ Compilation du backend..." cd veza-backend-api if [ ! -f "bin/veza-api" ]; then go build -o bin/veza-api ./cmd/api echo "βœ… Backend compilΓ©" else echo "βœ… Binaire backend dΓ©jΓ  prΓ©sent" fi echo "πŸ‘€ CrΓ©ation de l'utilisateur de test..." TEST_EMAIL=test@veza.app TEST_PASSWORD=test123 TEST_USERNAME=testuser go run cmd/tools/create_test_user/main.go 2>&1 | grep -E "(Created|Updated|Email|Username|Password)" || echo "⚠️ Utilisateur peut-Γͺtre dΓ©jΓ  créé" echo "πŸš€ DΓ©marrage du backend..." cd .. nohup ./veza-backend-api/bin/veza-api > backend.log 2>&1 & echo $! > backend.pid echo "βœ… Backend dΓ©marrΓ© (PID: $(cat backend.pid))" sleep 3 echo "🌐 DΓ©marrage du frontend..." cd apps/web nohup npm run dev > ../../frontend.log 2>&1 & echo $! > ../../frontend.pid echo "βœ… Frontend dΓ©marrΓ© (PID: $(cat ../../frontend.pid))" cd ../.. sleep 3 echo "" echo "═══════════════════════════════════════════════════════════" echo "βœ… MVP Veza dΓ©marrΓ© avec succΓ¨s !" echo "═══════════════════════════════════════════════════════════" echo "" echo "🌐 Frontend : http://localhost:5173" echo "πŸ”§ Backend : http://localhost:8080" echo "" echo "πŸ” Identifiants de test :" echo " Email : test@veza.app" echo " Username : testuser" echo " Password : test123" echo "" echo "πŸ“‹ Voir les logs :" echo " Backend : tail -f backend.log" echo " Frontend : tail -f frontend.log" echo "" echo "πŸ›‘ ArrΓͺter les services :" echo " pkill -f veza-api && pkill -f vite" echo "" echo "═══════════════════════════════════════════════════════════"