veza/DEMARRAGE_SIMPLE.md

159 lines
3.1 KiB
Markdown

# 🚀 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 <token>`
- Devrait voir `X-CSRF-Token: <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 <PID>
```
---
## ✅ 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 ! 🎉**