3.3 KiB
3.3 KiB
Démarrage rapide — Xpeditis
Guide de démarrage en 5 minutes.
Prérequis
- Node.js ≥ 20.x
- npm ≥ 10.x
- Docker + Docker Compose (pour PostgreSQL, Redis, MinIO)
1. Installer les dépendances
npm run install:all
Sur Windows si l'installation échoue, voir windows.md.
2. Démarrer l'infrastructure
docker-compose up -d
Vérifier que tout est actif :
docker-compose ps
# postgres Up (healthy)
# redis Up (healthy)
# minio Up (healthy)
3. Configurer l'environnement
cp apps/backend/.env.example apps/backend/.env
cp apps/frontend/.env.example apps/frontend/.env.local
Les valeurs par défaut fonctionnent pour le développement local — aucune modification nécessaire.
4. Exécuter les migrations
cd apps/backend && npm run migration:run && cd ../..
5. Démarrer les serveurs
# Terminal 1
npm run backend:dev
# → http://localhost:4000/api/v1
# → Swagger: http://localhost:4000/api/docs
# Terminal 2
npm run frontend:dev
# → http://localhost:3000
Vérification
| URL | Attendu |
|---|---|
| http://localhost:4000/api/v1/health | {"status":"ok"} |
| http://localhost:4000/api/docs | Swagger UI |
| http://localhost:3000 | Page d'accueil Xpeditis |
Commandes de référence
# Développement
npm run backend:dev # Backend avec hot-reload
npm run frontend:dev # Frontend avec hot-reload
# Tests
npm run backend:test # Tests unitaires backend
npm run frontend:test # Tests unitaires frontend
cd apps/backend && npm run test:integration # Tests d'intégration
cd apps/frontend && npm run test:e2e # Tests E2E Playwright
# Qualité de code
npm run backend:lint # ESLint backend
npm run frontend:lint # ESLint frontend
npm run format # Prettier (tous les fichiers)
npm run format:check # Vérifier le formatage
# Base de données
cd apps/backend
npm run migration:generate -- src/infrastructure/persistence/typeorm/migrations/NomMigration
npm run migration:run
npm run migration:revert
# Build
npm run backend:build # Build NestJS
npm run frontend:build # Build Next.js
npm run clean # Supprimer node_modules, dist, .next
Infrastructure locale (Docker)
| Service | URL / Port | Credentials |
|---|---|---|
| PostgreSQL | localhost:5432 | xpeditis / xpeditis_dev_password |
| Redis | localhost:6379 | password: xpeditis_redis_password |
| MinIO API | http://localhost:9000 | minioadmin / minioadmin |
| MinIO Console | http://localhost:9001 | minioadmin / minioadmin |
Comptes de test (après migration)
Les migrations seed créent automatiquement des comptes de test. Voir la migration 1730000000007-SeedTestUsers.ts pour les credentials exacts.
Résolution de problèmes courants
Backend ne démarre pas :
cd apps/backend && rm -rf node_modules && npm install && npm run dev
Erreur de migration :
cd apps/backend
npm run migration:revert # Annuler la dernière migration
npm run migration:run # Relancer
Port déjà utilisé :
# Modifier PORT dans apps/backend/.env
PORT=4001
Docker ne démarre pas :
docker-compose down
docker-compose up -d