# 🔌 Configuration des Ports ## Ports utilisés par Family Planner | Service | Port | URL | Description | |---------|------|-----|-------------| | **Backend API** | `5000` | http://localhost:5000 | API Express + Base de données SQLite | | **Frontend** | `5173` | http://localhost:5173 | Interface React (Vite) | | **Ingestion Service** | `8000` | http://localhost:8000 | Service Python (optionnel) | --- ## ⚙️ Configuration ### Backend (Port 5000) **Fichier** : `backend/src/config/env.ts` ```typescript port: Number(process.env.PORT ?? 5000) ``` **Variable d'environnement** : Créer `backend/.env` ```env PORT=5000 ``` ### Frontend (Port 5173) **Fichier** : `frontend/src/services/api-client.ts` ```typescript API_BASE_URL = import.meta.env.VITE_API_URL ?? "http://localhost:5000/api" ``` **Variable d'environnement** : Créer `frontend/.env` ```env VITE_API_URL=http://localhost:5000/api ``` --- ## 🔧 Changements de ports ### Si le port 5000 est occupé **Option 1 : Tuer le processus qui occupe le port** ```bash # Windows netstat -ano | findstr :5000 taskkill /F /PID ``` **Option 2 : Changer le port backend** 1. Créer `backend/.env` : ```env PORT=5001 ``` 2. Créer `frontend/.env` : ```env VITE_API_URL=http://localhost:5001/api ``` 3. Redémarrer les deux serveurs --- ## ✅ Vérification ### Vérifier que les ports écoutent : ```bash netstat -ano | findstr :5000 # Backend netstat -ano | findstr :5173 # Frontend netstat -ano | findstr :8000 # Ingestion (optionnel) ``` ### Tester les services : ```bash # Backend curl http://localhost:5000/api/children # Frontend # Ouvrir le navigateur : http://localhost:5173 ``` --- ## 🚫 Ports à éviter Ne PAS utiliser ces ports (déjà couramment utilisés) : - `3000` - Create React App par défaut - `3001` - Alternatives CRA - `8080` - Tomcat, services Java - `80` / `443` - HTTP/HTTPS (nécessitent admin) --- **Configuration actuelle** : Backend sur 5000, Frontend sur 5173 ✅