diff --git a/DEMARRAGE_SIMPLE.md b/DEMARRAGE_SIMPLE.md new file mode 100644 index 000000000..af7e3b879 --- /dev/null +++ b/DEMARRAGE_SIMPLE.md @@ -0,0 +1,159 @@ +# 🚀 DĂ©marrage Simple - Test IntĂ©gration Veza + +## ✅ ProblĂšmes CorrigĂ©s + +1. ✅ Migration SQL corrigĂ©e (`050_data_validation_constraints.sql`) +2. ✅ Redis dĂ©marrĂ© correctement +3. ✅ Configuration backend créée (`.env`) + +--- + +## 🎯 DĂ©marrage en 3 Étapes + +### Étape 1: Infrastructure Docker + +```bash +make infra-up +``` + +**VĂ©rification**: +```bash +docker compose ps +# Devrait voir: postgres, redis, rabbitmq (tous "healthy") +``` + +--- + +### Étape 2: Backend Go + +```bash +cd veza-backend-api + +# Le fichier .env est dĂ©jĂ  créé avec la bonne config +# Si besoin, vĂ©rifier: +cat .env + +# DĂ©marrer le serveur +go run cmd/api/main.go +``` + +**VĂ©rification**: +```bash +# Dans un autre terminal +curl http://localhost:8080/health +# Devrait retourner: {"status":"ok"} +``` + +**URLs**: +- API: http://localhost:8080/api/v1 +- Swagger: http://localhost:8080/docs +- Health: http://localhost:8080/health + +--- + +### Étape 3: Frontend React + +```bash +cd apps/web + +# DĂ©marrer Vite +npm run dev +``` + +**VĂ©rification**: +- Ouvrir http://localhost:3000 dans le navigateur +- La page devrait se charger + +--- + +## đŸ§Ș Test Complet + +1. **Ouvrir** http://localhost:3000 +2. **Tester Register**: + - CrĂ©er un compte + - VĂ©rifier que ça fonctionne +3. **Tester Login**: + - Se connecter + - VĂ©rifier DevTools → Network → Headers + - Devrait voir `Authorization: Bearer ` + - Devrait voir `X-CSRF-Token: ` sur les mutations +4. **Tester API**: + - Ouvrir http://localhost:8080/docs + - Tester un endpoint depuis Swagger UI + +--- + +## ⚙ Configuration + +### Backend (`veza-backend-api/.env`) + +```bash +APP_ENV=development +JWT_SECRET=dev-secret-key-minimum-32-characters-long-for-testing +DATABASE_URL=postgres://veza:password@localhost:5432/veza?sslmode=disable +REDIS_URL=redis://localhost:6379 +CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173 +APP_PORT=8080 +LOG_LEVEL=INFO +RABBITMQ_URL=amqp://veza:password@localhost:5672/ +``` + +### Frontend + +Aucune configuration nĂ©cessaire - valeurs par dĂ©faut OK: +- `VITE_API_URL=http://127.0.0.1:8080/api/v1` ✅ + +--- + +## 🐛 Si ProblĂšme + +### Backend ne dĂ©marre pas + +```bash +# VĂ©rifier DB +docker compose exec postgres psql -U veza -d veza -c "SELECT 1;" + +# VĂ©rifier Redis +docker compose exec redis redis-cli ping + +# VĂ©rifier logs backend +cd veza-backend-api +go run cmd/api/main.go 2>&1 | tee backend.log +``` + +### Frontend ne se connecte pas + +```bash +# VĂ©rifier CORS +curl -v -H "Origin: http://localhost:3000" \ + -H "Access-Control-Request-Method: GET" \ + -X OPTIONS \ + http://localhost:8080/api/v1/auth/me + +# Devrait voir: Access-Control-Allow-Origin: http://localhost:3000 +``` + +### Port occupĂ© + +```bash +# Trouver processus +lsof -i :8080 # Backend +lsof -i :3000 # Frontend + +# Tuer si nĂ©cessaire +kill -9 +``` + +--- + +## ✅ Checklist Finale + +- [ ] Infrastructure Docker dĂ©marrĂ©e (`make infra-up`) +- [ ] Backend dĂ©marrĂ© sur port 8080 +- [ ] Frontend dĂ©marrĂ© sur port 3000 +- [ ] Backend health check OK (`curl http://localhost:8080/health`) +- [ ] Frontend accessible (http://localhost:3000) +- [ ] Swagger accessible (http://localhost:8080/docs) + +**PrĂȘt Ă  tester ! 🎉** +