- Remove old STATUS.md and STRUCTURE_NOTES.md - Add detailed PROJECT_STRUCTURE.md with full architecture documentation - Add QUICK_START.md with quick reference guide - Documentation covers: project overview, file structure, database models, API routes, Docker setup, authentication flow, security, and deployment
134 lines
3.2 KiB
Markdown
134 lines
3.2 KiB
Markdown
# Quick Start & Notes
|
|
|
|
## 🚀 Démarrage rapide
|
|
|
|
```bash
|
|
# Docker (recommandé)
|
|
cd /home/paul/CIA/e-voting-system
|
|
docker-compose up -d
|
|
|
|
# Frontend: http://localhost:3000
|
|
# Backend API: http://localhost:8000
|
|
# Database: localhost:3306
|
|
```
|
|
|
|
## 🔧 Fixes récentes (5 nov 2025)
|
|
|
|
### LoginPage.js
|
|
- ✅ Utilise `API_ENDPOINTS.LOGIN` au lieu de URL hardcodée
|
|
- ✅ Prop correct: `onLogin` (était `onLoginSuccess`)
|
|
- ✅ Mapping données correct: `email`, `first_name`, `last_name`
|
|
- ✅ Teste les identifiants: `paul.roost@epita.fr` / `tennis16`
|
|
|
|
### DashboardPage.js
|
|
- ✅ Utilise `API_ENDPOINTS.ELECTIONS_ACTIVE`
|
|
|
|
### Docker
|
|
- ✅ Dockerfile.backend: suppression du double CMD
|
|
- ✅ Frontend build inclus dans docker-compose
|
|
|
|
### Nettoyage
|
|
- ✅ Suppression du dossier `src/` (doublon)
|
|
- ✅ Installation de `lucide-react`
|
|
- ✅ Suppression des console.log de debug
|
|
|
|
---
|
|
|
|
## 📋 Fichiers à connaître
|
|
|
|
| Fichier | Rôle |
|
|
|---------|------|
|
|
| `backend/main.py` | Point d'entrée FastAPI |
|
|
| `backend/routes/auth.py` | Routes login/register |
|
|
| `frontend/src/pages/LoginPage.js` | **Page de login** |
|
|
| `frontend/src/config/api.js` | Configuration API endpoints |
|
|
| `docker-compose.yml` | Orchestration services |
|
|
| `.env.example` | Variables d'environnement |
|
|
|
|
---
|
|
|
|
## 🧪 Test login
|
|
|
|
```bash
|
|
# Via curl
|
|
curl -X POST http://localhost:8000/api/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "paul.roost@epita.fr", "password": "tennis16"}'
|
|
|
|
# Réponse attendue
|
|
{
|
|
"access_token": "eyJ...",
|
|
"token_type": "bearer",
|
|
"expires_in": 1800,
|
|
"id": 1,
|
|
"email": "paul.roost@epita.fr",
|
|
"first_name": "Paul",
|
|
"last_name": "Roost"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 🔑 Points clés
|
|
|
|
### API Base URL
|
|
- **Local dev:** `http://localhost:8000`
|
|
- **Docker:** Configuration dans `frontend/public/config.js`
|
|
|
|
### JWT Token
|
|
- Stocké dans `localStorage` sous clé `token`
|
|
- Utilisé dans header `Authorization: Bearer <token>`
|
|
- Expiration: 30 minutes
|
|
|
|
### Voter Data
|
|
- Stocké dans `localStorage` sous clé `voter`
|
|
- Structure: `{ id, email, name, first_name, last_name }`
|
|
|
|
---
|
|
|
|
## ⚠️ Erreurs courantes
|
|
|
|
| Erreur | Cause | Solution |
|
|
|--------|-------|----------|
|
|
| `CORS error` | Frontend cherche localhost depuis Docker | Utiliser `API_ENDPOINTS` |
|
|
| `onLoginSuccess is not a function` | Prop nommé incorrectement | Utiliser `onLogin` |
|
|
| `t is not a function` | Composant pas reçu le bon prop | Vérifier noms props parent/enfant |
|
|
| Build cache | Ancien JS chargé | Force refresh: `Ctrl+Shift+R` |
|
|
|
|
---
|
|
|
|
## 📊 Architecture réseau Docker
|
|
|
|
```
|
|
User Browser (localhost:3000)
|
|
↓
|
|
Frontend Container (nginx serve)
|
|
↓
|
|
Backend Container (:8000)
|
|
↓
|
|
MariaDB Container (:3306)
|
|
```
|
|
|
|
**Important:** Du navigateur, utiliser `localhost:8000`. Du container, utiliser `evoting_backend:8000`.
|
|
|
|
---
|
|
|
|
## 🔐 Credentials de test
|
|
|
|
- **Email:** `paul.roost@epita.fr`
|
|
- **Password:** `tennis16`
|
|
- **DB User:** `evoting_user`
|
|
- **DB Pass:** `evoting_pass123`
|
|
|
|
---
|
|
|
|
## 📚 Autres fichiers .claude
|
|
|
|
- **PROJECT_STRUCTURE.md** - Architecture complète (ce répertoire)
|
|
- **DEPLOYMENT.md** - Guide déploiement production
|
|
- **POSTQUANTUM_CRYPTO.md** - Détails cryptographie
|
|
|
|
---
|
|
|
|
**Dernière mise à jour:** 5 novembre 2025
|