ujusum:3-codage:1-repository:4-code
Différences
Ci-dessous, les différences entre deux révisions de la page.
| ujusum:3-codage:1-repository:4-code [2026/06/08 01:22] – créée admin | ujusum:3-codage:1-repository:4-code [2026/06/08 01:30] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1172: | Ligne 1172: | ||
| ---- | ---- | ||
| - | ====== | + | ====== |
| - | ===== Phase 4-C — DTO & Contrats TypeScript | + | ===== Objectif |
| - | Objectif | + | Transformer le modèle Prisma consolidé en contrats applicatifs utilisables par : |
| - | Générer | + | < |
| + | NestJS | ||
| + | |||
| + | Swagger | ||
| + | |||
| + | OpenAPI | ||
| + | |||
| + | Zod | ||
| + | |||
| + | NextJS | ||
| + | |||
| + | React Query | ||
| + | |||
| + | SDK TypeScript | ||
| + | </ | ||
| + | |||
| + | À l'issue de cette phase : | ||
| < | < | ||
| - | DTO NestJS | + | ✓ DTO générés |
| - | Types TypeScript | + | ✓ Types TypeScript |
| + | |||
| + | ✓ Validation Zod générée | ||
| + | |||
| + | ✓ Contrats API stabilisés | ||
| + | |||
| + | ✓ Base de génération Swagger | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | libs/ | ||
| + | |||
| + | └── contracts/ | ||
| + | |||
| + | ├── dto/ | ||
| + | |||
| + | ├── schemas/ | ||
| + | |||
| + | ├── enums/ | ||
| + | |||
| + | ├── types/ | ||
| + | |||
| + | └── index.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Séparer : | ||
| + | |||
| + | < | ||
| + | Base de données | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Prisma Models | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | API | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | DTO | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | Frontend | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Types | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.1 — Création de la librairie Contracts ====== | ||
| + | |||
| + | ===== Nx ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx g @nx/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | libs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.2 — Installation des dépendances ====== | ||
| + | |||
| + | ===== DTO ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install class-validator | ||
| + | |||
| + | npm install class-transformer | ||
| + | |||
| + | npm install @nestjs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Validation Runtime ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install zod | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Génération Zod ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install prisma-zod-generator | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.3 — Organisation des contrats ====== | ||
| + | |||
| + | ===== Arborescence ===== | ||
| + | |||
| + | < | ||
| + | libs/ | ||
| + | |||
| + | ├── dto | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | ├── schemas | ||
| + | │ | ||
| + | ├── enums | ||
| + | │ | ||
| + | └── types | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.4 — DTO Auth ====== | ||
| + | |||
| + | ===== CreateUserDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateUserDto { | ||
| + | |||
| + | @IsEmail() | ||
| + | email: string; | ||
| + | |||
| + | @IsString() | ||
| + | firstName: string; | ||
| + | |||
| + | @IsString() | ||
| + | lastName: string; | ||
| + | |||
| + | @MinLength(8) | ||
| + | password: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== LoginDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class LoginDto { | ||
| + | |||
| + | @IsEmail() | ||
| + | email: string; | ||
| + | |||
| + | @IsString() | ||
| + | password: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== RefreshTokenDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class RefreshTokenDto { | ||
| + | |||
| + | @IsString() | ||
| + | refreshToken: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.5 — DTO Users ====== | ||
| + | |||
| + | ===== UpdateUserDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class UpdateUserDto { | ||
| + | |||
| + | @IsOptional() | ||
| + | firstName?: string; | ||
| + | |||
| + | @IsOptional() | ||
| + | lastName?: string; | ||
| + | |||
| + | @IsOptional() | ||
| + | phone?: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== UserResponseDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class UserResponseDto { | ||
| + | |||
| + | id: string; | ||
| + | |||
| + | email: string; | ||
| + | |||
| + | firstName: string; | ||
| + | |||
| + | lastName: string; | ||
| + | |||
| + | status: UserStatus; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.6 — DTO Properties ====== | ||
| + | |||
| + | ===== CreatePropertyDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreatePropertyDto { | ||
| + | |||
| + | title: string; | ||
| + | |||
| + | description?: | ||
| + | |||
| + | propertyType: | ||
| + | |||
| + | maxGuests: number; | ||
| + | |||
| + | bedrooms: number; | ||
| + | |||
| + | bathrooms: number; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== UpdatePropertyDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class UpdatePropertyDto { | ||
| + | |||
| + | title?: string; | ||
| + | |||
| + | description?: | ||
| + | |||
| + | published?: boolean; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PropertyResponseDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class PropertyResponseDto { | ||
| + | |||
| + | id: string; | ||
| + | |||
| + | reference: string; | ||
| + | |||
| + | slug: string; | ||
| + | |||
| + | title: string; | ||
| + | |||
| + | published: boolean; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.7 — DTO Reservations ====== | ||
| + | |||
| + | ===== CreateReservationDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateReservationDto { | ||
| + | |||
| + | propertyId: string; | ||
| + | |||
| + | customerId: string; | ||
| + | |||
| + | checkInDate: | ||
| + | |||
| + | checkOutDate: | ||
| + | |||
| + | adults: number; | ||
| + | |||
| + | children?: number; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ReservationResponseDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class ReservationResponseDto { | ||
| + | |||
| + | id: string; | ||
| + | |||
| + | reservationNumber: | ||
| + | |||
| + | status: ReservationStatus; | ||
| + | |||
| + | totalAmount: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.8 — DTO CRM ====== | ||
| + | |||
| + | ===== CreateLeadDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateLeadDto { | ||
| + | |||
| + | firstName: string; | ||
| + | |||
| + | lastName: string; | ||
| + | |||
| + | email: string; | ||
| + | |||
| + | source?: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== CreateTaskDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateTaskDto { | ||
| + | |||
| + | title: string; | ||
| + | |||
| + | description?: | ||
| + | |||
| + | assignedUserId?: | ||
| + | |||
| + | dueDate?: Date; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.9 — DTO Finance ====== | ||
| + | |||
| + | ===== CreateInvoiceDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class CreateInvoiceDto { | ||
| + | |||
| + | reservationId: | ||
| + | |||
| + | issueDate: Date; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PaymentDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class PaymentDto { | ||
| + | |||
| + | reservationId: | ||
| + | |||
| + | amount: number; | ||
| + | |||
| + | currencyCode: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.10 — DTO Security ====== | ||
| + | |||
| + | ===== EnableMfaDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class EnableMfaDto { | ||
| + | |||
| + | method: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ConsentDto ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class ConsentDto { | ||
| + | |||
| + | consentType: | ||
| + | |||
| + | granted: boolean; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.11 — Pagination Contracts ====== | ||
| + | |||
| + | ===== PaginationRequest ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class PaginationRequest { | ||
| + | |||
| + | page?: number; | ||
| + | |||
| + | pageSize?: number; | ||
| + | |||
| + | sort?: string; | ||
| + | |||
| + | search?: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PaginationResponse ===== | ||
| + | |||
| + | <code ts> | ||
| + | export class PaginationResponse< | ||
| + | |||
| + | data: T[]; | ||
| + | |||
| + | total: number; | ||
| + | |||
| + | page: number; | ||
| + | |||
| + | pageSize: number; | ||
| + | |||
| + | totalPages: number; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.12 — API Response Contracts ====== | ||
| + | |||
| + | ===== Success ===== | ||
| + | |||
| + | <code ts> | ||
| + | export interface ApiResponse< | ||
| + | |||
| + | success: true; | ||
| + | |||
| + | data: T; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Error ===== | ||
| + | |||
| + | <code ts> | ||
| + | export interface ApiError { | ||
| + | |||
| + | success: false; | ||
| + | |||
| + | code: string; | ||
| + | |||
| + | message: string; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.13 — Génération Zod ====== | ||
| + | |||
| + | ===== Generator Prisma ===== | ||
| + | |||
| + | Dans : | ||
| + | |||
| + | < | ||
| + | schema.prisma | ||
| + | </ | ||
| + | |||
| + | ajouter : | ||
| + | |||
| + | <code prisma> | ||
| + | generator zod { | ||
| + | |||
| + | provider = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Génération ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma generate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | libs/ | ||
| + | </ | ||
| + | |||
| + | contenant : | ||
| + | |||
| + | < | ||
| + | UserSchema | ||
| + | |||
| + | PropertySchema | ||
| + | |||
| + | ReservationSchema | ||
| + | |||
| + | LeadSchema | ||
| + | |||
| + | InvoiceSchema | ||
| + | |||
| + | PaymentSchema | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-C.14 — Barrel Exports ====== | ||
| + | |||
| + | ===== enums/ | ||
| + | |||
| + | <code ts> | ||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== dto/ | ||
| + | |||
| + | <code ts> | ||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== index.ts ===== | ||
| + | |||
| + | <code ts> | ||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | |||
| + | export * from ' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Contrôles qualité ====== | ||
| + | |||
| + | ===== Compilation ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx build contracts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Type Check ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx tsc --noEmit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Lint ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx lint contracts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | libs/ | ||
| + | |||
| + | libs/ | ||
| + | |||
| + | libs/ | ||
| + | |||
| + | libs/ | ||
| + | |||
| + | libs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-C est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ DTO créés | ||
| + | |||
| + | ✓ Types TypeScript créés | ||
| + | |||
| + | ✓ Zod généré | ||
| + | |||
| + | ✓ Contrats partagés Backend/ | ||
| + | |||
| + | ✓ Validation unifiée | ||
| + | |||
| + | ✓ Build vert | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-D — Structure NestJS Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire l' | ||
| + | |||
| + | < | ||
| + | Prisma Schema consolidé | ||
| + | |||
| + | OpenAPI Enterprise 4.0 | ||
| + | |||
| + | Contrats DTO | ||
| + | |||
| + | DDD | ||
| + | |||
| + | CQRS | ||
| + | |||
| + | Hexagonal Architecture | ||
| + | </ | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Backend structuré | ||
| + | |||
| + | ✓ Modules générés | ||
| + | |||
| + | ✓ CQRS en place | ||
| + | |||
| + | ✓ Event Bus en place | ||
| + | |||
| + | ✓ Repository Pattern | ||
| + | |||
| + | ✓ Domain Services | ||
| + | |||
| + | ✓ Guards | ||
| + | |||
| + | ✓ Interceptors | ||
| + | |||
| + | ✓ Filters | ||
| + | |||
| + | ✓ Multi-Tenant | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | ===== Structure globale ===== | ||
| + | |||
| + | < | ||
| + | apps/ | ||
| + | |||
| + | ├── core | ||
| + | |||
| + | ├── infrastructure | ||
| + | |||
| + | ├── shared | ||
| + | |||
| + | ├── modules | ||
| + | |||
| + | └── bootstrap | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.1 — Core Layer ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Contenir les composants techniques communs. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Arborescence ===== | ||
| + | |||
| + | < | ||
| + | src/core | ||
| + | |||
| + | ├── database | ||
| + | |||
| + | ├── cqrs | ||
| + | |||
| + | ├── events | ||
| + | |||
| + | ├── guards | ||
| + | |||
| + | ├── interceptors | ||
| + | |||
| + | ├── filters | ||
| + | |||
| + | ├── decorators | ||
| + | |||
| + | ├── exceptions | ||
| + | |||
| + | ├── logging | ||
| + | |||
| + | └── tenancy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Database ====== | ||
| + | |||
| + | ===== Prisma Service ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prisma Module ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== CQRS ====== | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install @nestjs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | Commands | ||
| + | |||
| + | Queries | ||
| + | |||
| + | Handlers | ||
| + | |||
| + | Events | ||
| + | |||
| + | Sagas | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Event Bus ====== | ||
| + | |||
| + | ===== Événements globaux ===== | ||
| + | |||
| + | < | ||
| + | UserCreated | ||
| + | |||
| + | ReservationCreated | ||
| + | |||
| + | ContractSigned | ||
| + | |||
| + | PaymentReceived | ||
| + | |||
| + | InvoiceGenerated | ||
| + | |||
| + | LeadConverted | ||
| + | |||
| + | MfaEnabled | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Répertoire ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.2 — Shared Layer ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Mutualiser les objets transverses. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── dto | ||
| + | |||
| + | ├── enums | ||
| + | |||
| + | ├── constants | ||
| + | |||
| + | ├── types | ||
| + | |||
| + | ├── interfaces | ||
| + | |||
| + | └── utils | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.3 — Infrastructure Layer ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Contenir les adaptateurs techniques. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | ====== Phase 4-D — Structure NestJS Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire l' | ||
| + | |||
| + | < | ||
| + | Prisma Schema consolidé | ||
| + | |||
| + | OpenAPI Enterprise 4.0 | ||
| + | |||
| + | Contrats DTO | ||
| + | |||
| + | DDD | ||
| + | |||
| + | CQRS | ||
| + | |||
| + | Hexagonal Architecture | ||
| + | </ | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Backend structuré | ||
| + | |||
| + | ✓ Modules générés | ||
| + | |||
| + | ✓ CQRS en place | ||
| + | |||
| + | ✓ Event Bus en place | ||
| + | |||
| + | ✓ Repository Pattern | ||
| + | |||
| + | ✓ Domain Services | ||
| + | |||
| + | ✓ Guards | ||
| + | |||
| + | ✓ Interceptors | ||
| + | |||
| + | ✓ Filters | ||
| + | |||
| + | ✓ Multi-Tenant | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | ===== Structure globale ===== | ||
| + | |||
| + | < | ||
| + | apps/ | ||
| + | |||
| + | ├── core | ||
| + | |||
| + | ├── infrastructure | ||
| + | |||
| + | ├── shared | ||
| + | |||
| + | ├── modules | ||
| + | |||
| + | └── bootstrap | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.1 — Core Layer ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Contenir les composants techniques communs. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Arborescence ===== | ||
| + | |||
| + | < | ||
| + | src/core | ||
| + | |||
| + | ├── database | ||
| + | |||
| + | ├── cqrs | ||
| + | |||
| + | ├── events | ||
| + | |||
| + | ├── guards | ||
| + | |||
| + | ├── interceptors | ||
| + | |||
| + | ├── filters | ||
| + | |||
| + | ├── decorators | ||
| + | |||
| + | ├── exceptions | ||
| + | |||
| + | ├── logging | ||
| + | |||
| + | └── tenancy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Database ====== | ||
| + | |||
| + | ===== Prisma Service ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prisma Module ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== CQRS ====== | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install @nestjs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | Commands | ||
| + | |||
| + | Queries | ||
| + | |||
| + | Handlers | ||
| + | |||
| + | Events | ||
| + | |||
| + | Sagas | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Event Bus ====== | ||
| + | |||
| + | ===== Événements globaux ===== | ||
| + | |||
| + | < | ||
| + | UserCreated | ||
| + | |||
| + | ReservationCreated | ||
| + | |||
| + | ContractSigned | ||
| + | |||
| + | PaymentReceived | ||
| + | |||
| + | InvoiceGenerated | ||
| + | |||
| + | LeadConverted | ||
| + | |||
| + | MfaEnabled | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Répertoire ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.2 — Shared Layer ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Mutualiser les objets transverses. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── dto | ||
| + | |||
| + | ├── enums | ||
| + | |||
| + | ├── constants | ||
| + | |||
| + | ├── types | ||
| + | |||
| + | ├── interfaces | ||
| + | |||
| + | └── utils | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-D.3 — Infrastructure Layer (suite) ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── prisma | ||
| + | |||
| + | ├── cache | ||
| + | |||
| + | ├── queue | ||
| + | |||
| + | |||
| + | |||
| + | ├── sms | ||
| + | |||
| + | ├── storage | ||
| + | |||
| + | ├── payments | ||
| + | |||
| + | ├── signatures | ||
| + | |||
| + | ├── ota | ||
| + | |||
| + | ├── ai | ||
| + | |||
| + | └── search | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Cache ====== | ||
| + | |||
| + | ===== Redis ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install @nestjs/ | ||
| + | |||
| + | npm install cache-manager | ||
| + | |||
| + | npm install cache-manager-redis-store | ||
| + | |||
| + | npm install redis | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | CacheService | ||
| + | |||
| + | CacheKeys | ||
| + | |||
| + | CacheInvalidationService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Queue ====== | ||
| + | |||
| + | ===== BullMQ ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install @nestjs/ | ||
| + | |||
| + | npm install bullmq | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Files ===== | ||
| + | |||
| + | < | ||
| + | queue.module.ts | ||
| + | |||
| + | jobs/ | ||
| + | |||
| + | processors/ | ||
| + | |||
| + | workers/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Jobs ===== | ||
| + | |||
| + | < | ||
| + | SendEmailJob | ||
| + | |||
| + | SendSmsJob | ||
| + | |||
| + | GenerateInvoiceJob | ||
| + | |||
| + | SyncOtaJob | ||
| + | |||
| + | GenerateContractJob | ||
| + | |||
| + | AiIndexationJob | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Mail ====== | ||
| + | |||
| + | ===== Provider ===== | ||
| + | |||
| + | < | ||
| + | SendGrid | ||
| + | |||
| + | Mailgun | ||
| + | |||
| + | SMTP | ||
| + | |||
| + | Amazon SES | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Interface ===== | ||
| + | |||
| + | <code ts> | ||
| + | export interface EmailProvider { | ||
| + | |||
| + | send( | ||
| + | payload: SendEmailPayload | ||
| + | ): Promise< | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== SMS ====== | ||
| + | |||
| + | ===== Provider ===== | ||
| + | |||
| + | < | ||
| + | Twilio | ||
| + | |||
| + | MessageBird | ||
| + | |||
| + | OVH SMS | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Interface ===== | ||
| + | |||
| + | <code ts> | ||
| + | export interface SmsProvider { | ||
| + | |||
| + | send( | ||
| + | payload: SendSmsPayload | ||
| + | ): Promise< | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Storage ====== | ||
| + | |||
| + | ===== Providers ===== | ||
| + | |||
| + | < | ||
| + | S3 | ||
| + | |||
| + | MinIO | ||
| + | |||
| + | Azure Blob | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | StorageService | ||
| + | |||
| + | FileUploadService | ||
| + | |||
| + | ImageOptimizationService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Payments ====== | ||
| + | |||
| + | ===== Providers ===== | ||
| + | |||
| + | < | ||
| + | Stripe | ||
| + | |||
| + | PayPal | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Adapters ===== | ||
| + | |||
| + | < | ||
| + | StripeAdapter | ||
| + | |||
| + | PaypalAdapter | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Signature ====== | ||
| + | |||
| + | ===== Providers ===== | ||
| + | |||
| + | < | ||
| + | DocuSign | ||
| + | |||
| + | Yousign | ||
| + | |||
| + | Universign | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Adapters ===== | ||
| + | |||
| + | < | ||
| + | DocusignAdapter | ||
| + | |||
| + | YousignAdapter | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== OTA ====== | ||
| + | |||
| + | ===== Connecteurs ===== | ||
| + | |||
| + | < | ||
| + | BookingAdapter | ||
| + | |||
| + | AirbnbAdapter | ||
| + | |||
| + | VrboAdapter | ||
| + | |||
| + | ExpediaAdapter | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== IA ====== | ||
| + | |||
| + | ===== Providers ===== | ||
| + | |||
| + | < | ||
| + | OpenAI | ||
| + | |||
| + | Azure OpenAI | ||
| + | |||
| + | Anthropic | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | AiAssistantService | ||
| + | |||
| + | EmbeddingService | ||
| + | |||
| + | RecommendationService | ||
| + | |||
| + | KnowledgeSearchService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.4 — Domain Modules ====== | ||
| + | |||
| + | ===== Structure standard ===== | ||
| + | |||
| + | Chaque domaine métier adopte exactement la même structure. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── application | ||
| + | |||
| + | ├── domain | ||
| + | |||
| + | ├── infrastructure | ||
| + | |||
| + | ├── presentation | ||
| + | |||
| + | └── properties.module.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Application Layer ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | application | ||
| + | |||
| + | ├── commands | ||
| + | |||
| + | ├── queries | ||
| + | |||
| + | ├── handlers | ||
| + | |||
| + | ├── dto | ||
| + | |||
| + | └── mappers | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | commands/ | ||
| + | |||
| + | CreatePropertyCommand | ||
| + | |||
| + | UpdatePropertyCommand | ||
| + | |||
| + | PublishPropertyCommand | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Queries ===== | ||
| + | |||
| + | < | ||
| + | GetPropertyQuery | ||
| + | |||
| + | SearchPropertiesQuery | ||
| + | |||
| + | GetAvailabilityQuery | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Domain Layer ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | domain | ||
| + | |||
| + | ├── entities | ||
| + | |||
| + | ├── repositories | ||
| + | |||
| + | ├── services | ||
| + | |||
| + | ├── value-objects | ||
| + | |||
| + | └── events | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Entités ===== | ||
| + | |||
| + | < | ||
| + | Property | ||
| + | |||
| + | Reservation | ||
| + | |||
| + | Owner | ||
| + | |||
| + | Invoice | ||
| + | |||
| + | Lead | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Repositories ===== | ||
| + | |||
| + | <code ts> | ||
| + | export interface PropertyRepository { | ||
| + | |||
| + | findById(id: | ||
| + | |||
| + | save(property: | ||
| + | |||
| + | delete(id: string); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Domain Services ===== | ||
| + | |||
| + | < | ||
| + | PricingService | ||
| + | |||
| + | ReservationService | ||
| + | |||
| + | ContractService | ||
| + | |||
| + | RevenueManagementService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Infrastructure Layer Domaine ====== | ||
| + | |||
| + | ===== Implémentations ===== | ||
| + | |||
| + | < | ||
| + | PrismaPropertyRepository | ||
| + | |||
| + | PrismaReservationRepository | ||
| + | |||
| + | PrismaLeadRepository | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | infrastructure/ | ||
| + | |||
| + | └── prisma-property.repository.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Presentation Layer ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | presentation | ||
| + | |||
| + | ├── controllers | ||
| + | |||
| + | ├── presenters | ||
| + | |||
| + | └── swagger | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | properties.controller.ts | ||
| + | |||
| + | availability.controller.ts | ||
| + | |||
| + | rates.controller.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.5 — Modules Métier ====== | ||
| + | |||
| + | ===== Modules à générer ===== | ||
| + | |||
| + | < | ||
| + | AuthModule | ||
| + | |||
| + | UsersModule | ||
| + | |||
| + | OwnersModule | ||
| + | |||
| + | PropertiesModule | ||
| + | |||
| + | ReservationsModule | ||
| + | |||
| + | ContractsModule | ||
| + | |||
| + | PaymentsModule | ||
| + | |||
| + | InvoicesModule | ||
| + | |||
| + | CRMModule | ||
| + | |||
| + | MessagingModule | ||
| + | |||
| + | MarketingModule | ||
| + | |||
| + | AutomationModule | ||
| + | |||
| + | AiModule | ||
| + | |||
| + | GovernanceModule | ||
| + | |||
| + | OtaModule | ||
| + | |||
| + | RevenueModule | ||
| + | |||
| + | SecurityModule | ||
| + | |||
| + | InternationalizationModule | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.6 — Multi-Tenant ====== | ||
| + | |||
| + | ===== Tenant Context ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | < | ||
| + | TenantContextService | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Header ===== | ||
| + | |||
| + | <code http> | ||
| + | X-Tenant-Id | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Guard ===== | ||
| + | |||
| + | < | ||
| + | TenantGuard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Middleware ===== | ||
| + | |||
| + | < | ||
| + | TenantMiddleware | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Injecter automatiquement : | ||
| + | |||
| + | < | ||
| + | tenantId | ||
| + | </ | ||
| + | |||
| + | dans tous les accès Prisma. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.7 — Security ====== | ||
| + | |||
| + | ===== Guards ===== | ||
| + | |||
| + | < | ||
| + | JwtAuthGuard | ||
| + | |||
| + | RolesGuard | ||
| + | |||
| + | PermissionsGuard | ||
| + | |||
| + | TenantGuard | ||
| + | |||
| + | MfaGuard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Decorators ===== | ||
| + | |||
| + | <code ts> | ||
| + | @CurrentUser() | ||
| + | |||
| + | @Roles() | ||
| + | |||
| + | @Permissions() | ||
| + | |||
| + | @Tenant() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.8 — Interceptors ====== | ||
| + | |||
| + | ===== Interceptors globaux ===== | ||
| + | |||
| + | < | ||
| + | LoggingInterceptor | ||
| + | |||
| + | AuditInterceptor | ||
| + | |||
| + | CacheInterceptor | ||
| + | |||
| + | TenantInterceptor | ||
| + | |||
| + | ResponseTransformInterceptor | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.9 — Exception Filters ====== | ||
| + | |||
| + | ===== Filtres ===== | ||
| + | |||
| + | < | ||
| + | GlobalExceptionFilter | ||
| + | |||
| + | PrismaExceptionFilter | ||
| + | |||
| + | ValidationExceptionFilter | ||
| + | |||
| + | DomainExceptionFilter | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.10 — Bootstrap ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | src/ | ||
| + | |||
| + | ├── swagger.ts | ||
| + | |||
| + | ├── validation.ts | ||
| + | |||
| + | ├── security.ts | ||
| + | |||
| + | └── app.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== main.ts ===== | ||
| + | |||
| + | <code ts> | ||
| + | async function bootstrap() { | ||
| + | |||
| + | const app = | ||
| + | await NestFactory.create(AppModule); | ||
| + | |||
| + | setupSwagger(app); | ||
| + | |||
| + | setupValidation(app); | ||
| + | |||
| + | setupSecurity(app); | ||
| + | |||
| + | await app.listen(3000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-D.11 — AppModule ====== | ||
| + | |||
| + | ===== Agrégation ===== | ||
| + | |||
| + | < | ||
| + | AppModule | ||
| + | |||
| + | ├── CoreModule | ||
| + | |||
| + | ├── InfrastructureModule | ||
| + | |||
| + | ├── AuthModule | ||
| + | |||
| + | ├── UsersModule | ||
| + | |||
| + | ├── OwnersModule | ||
| + | |||
| + | ├── PropertiesModule | ||
| + | |||
| + | ├── ReservationsModule | ||
| + | |||
| + | ├── ContractsModule | ||
| + | |||
| + | ├── PaymentsModule | ||
| + | |||
| + | ├── CRMModule | ||
| + | |||
| + | ├── MessagingModule | ||
| + | |||
| + | ├── RevenueModule | ||
| + | |||
| + | ├── SecurityModule | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Contrôles qualité ====== | ||
| + | |||
| + | ===== Compilation ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx build api | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Lint ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx lint api | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tests ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx test api | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | src/core | ||
| + | |||
| + | src/ | ||
| + | |||
| + | src/ | ||
| + | |||
| + | src/ | ||
| + | |||
| + | src/ | ||
| + | |||
| + | app.module.ts | ||
| + | |||
| + | main.ts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-D est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Architecture Hexagonale en place | ||
| + | |||
| + | ✓ CQRS installé | ||
| + | |||
| + | ✓ Event Bus installé | ||
| + | |||
| + | ✓ Modules générés | ||
| + | |||
| + | ✓ Multi-Tenant opérationnel | ||
| + | |||
| + | ✓ Guards opérationnels | ||
| + | |||
| + | ✓ Interceptors opérationnels | ||
| + | |||
| + | ✓ Filters opérationnels | ||
| + | |||
| + | ✓ Build vert | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-E — Structure NextJS Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Construire l' | ||
| + | |||
| + | Cette phase transforme : | ||
| + | |||
| + | < | ||
| + | OpenAPI Enterprise | ||
| + | |||
| + | DTO TypeScript | ||
| + | |||
| + | SDK TypeScript | ||
| + | |||
| + | Contrats API | ||
| + | </ | ||
| + | |||
| + | en une application : | ||
| + | |||
| + | < | ||
| + | NextJS 15 | ||
| + | |||
| + | React 19 | ||
| + | |||
| + | TypeScript | ||
| + | |||
| + | TanStack Query | ||
| + | |||
| + | TailwindCSS | ||
| + | |||
| + | shadcn/ui | ||
| + | |||
| + | Multi-Tenant | ||
| + | |||
| + | RBAC | ||
| + | |||
| + | Internationalisée | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Résultat attendu ====== | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Frontend compilable | ||
| + | |||
| + | ✓ Authentification complète | ||
| + | |||
| + | ✓ Layouts Enterprise | ||
| + | |||
| + | ✓ Design System | ||
| + | |||
| + | ✓ Pages métier | ||
| + | |||
| + | ✓ Gestion permissions | ||
| + | |||
| + | ✓ Multi-tenant | ||
| + | |||
| + | ✓ Multi-langues | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.1 — Création de l' | ||
| + | |||
| + | ===== Génération ===== | ||
| + | |||
| + | <code bash> | ||
| + | cd apps | ||
| + | |||
| + | npx create-next-app@latest web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Options ===== | ||
| + | |||
| + | < | ||
| + | TypeScript | ||
| + | |||
| + | ESLint | ||
| + | |||
| + | TailwindCSS | ||
| + | |||
| + | App Router | ||
| + | |||
| + | src/ directory | ||
| + | |||
| + | Turbopack | ||
| + | |||
| + | Import Alias YES | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | apps/web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.2 — Installation des dépendances ====== | ||
| + | |||
| + | ===== TanStack Query ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install @tanstack/ | ||
| + | |||
| + | npm install @tanstack/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Formulaires ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install react-hook-form | ||
| + | |||
| + | npm install zod | ||
| + | |||
| + | npm install @hookform/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Auth ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install jwt-decode | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== UI ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx shadcn@latest init | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx shadcn add button | ||
| + | |||
| + | npx shadcn add input | ||
| + | |||
| + | npx shadcn add dialog | ||
| + | |||
| + | npx shadcn add table | ||
| + | |||
| + | npx shadcn add dropdown-menu | ||
| + | |||
| + | npx shadcn add form | ||
| + | |||
| + | npx shadcn add card | ||
| + | |||
| + | npx shadcn add tabs | ||
| + | |||
| + | npx shadcn add toast | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.3 — Structure globale ====== | ||
| + | |||
| + | ===== Architecture ===== | ||
| + | |||
| + | < | ||
| + | apps/ | ||
| + | |||
| + | ├── app | ||
| + | |||
| + | ├── modules | ||
| + | |||
| + | ├── components | ||
| + | |||
| + | ├── layouts | ||
| + | |||
| + | ├── hooks | ||
| + | |||
| + | ├── services | ||
| + | |||
| + | ├── providers | ||
| + | |||
| + | ├── stores | ||
| + | |||
| + | ├── lib | ||
| + | |||
| + | ├── types | ||
| + | |||
| + | └── config | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.4 — Providers ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | providers | ||
| + | |||
| + | ├── query-provider.tsx | ||
| + | |||
| + | ├── auth-provider.tsx | ||
| + | |||
| + | ├── tenant-provider.tsx | ||
| + | |||
| + | ├── theme-provider.tsx | ||
| + | |||
| + | └── i18n-provider.tsx | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Query Provider ===== | ||
| + | |||
| + | <code tsx> | ||
| + | < | ||
| + | |||
| + | {children} | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.5 — SDK API ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | services/ | ||
| + | |||
| + | ├── auth | ||
| + | |||
| + | ├── users | ||
| + | |||
| + | ├── properties | ||
| + | |||
| + | ├── reservations | ||
| + | |||
| + | ├── crm | ||
| + | |||
| + | ├── finance | ||
| + | |||
| + | ├── ota | ||
| + | |||
| + | ├── ai | ||
| + | |||
| + | └── security | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code ts> | ||
| + | export const getProperty = ( | ||
| + | |||
| + | id: string | ||
| + | |||
| + | ) => sdk.properties.getProperty(id); | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.6 — Gestion Auth ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | |||
| + | ├── hooks | ||
| + | |||
| + | ├── services | ||
| + | |||
| + | ├── components | ||
| + | |||
| + | └── pages | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | /login | ||
| + | |||
| + | /register | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | /mfa | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Hook ===== | ||
| + | |||
| + | <code ts> | ||
| + | useCurrentUser() | ||
| + | |||
| + | useLogin() | ||
| + | |||
| + | useLogout() | ||
| + | |||
| + | usePermissions() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.7 — Layouts ====== | ||
| + | |||
| + | ===== Public ===== | ||
| + | |||
| + | < | ||
| + | layouts/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Auth ===== | ||
| + | |||
| + | < | ||
| + | layouts/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Dashboard ===== | ||
| + | |||
| + | < | ||
| + | layouts/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Owner ===== | ||
| + | |||
| + | < | ||
| + | layouts/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Admin ===== | ||
| + | |||
| + | < | ||
| + | layouts/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.8 — Navigation ====== | ||
| + | |||
| + | ===== Sidebar ===== | ||
| + | |||
| + | < | ||
| + | Dashboard | ||
| + | |||
| + | Reservations | ||
| + | |||
| + | Properties | ||
| + | |||
| + | Owners | ||
| + | |||
| + | CRM | ||
| + | |||
| + | Finance | ||
| + | |||
| + | Marketing | ||
| + | |||
| + | Analytics | ||
| + | |||
| + | Security | ||
| + | |||
| + | Administration | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Menu dynamique ===== | ||
| + | |||
| + | Piloté par : | ||
| + | |||
| + | < | ||
| + | Permissions | ||
| + | |||
| + | Tenant | ||
| + | |||
| + | Feature Flags | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.9 — Module Properties ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | PropertyForm | ||
| + | |||
| + | PropertyTable | ||
| + | |||
| + | PropertyCard | ||
| + | |||
| + | PropertyGallery | ||
| + | |||
| + | AvailabilityCalendar | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.10 — Module Reservations ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | ReservationForm | ||
| + | |||
| + | ReservationDetails | ||
| + | |||
| + | GuestList | ||
| + | |||
| + | PricingSummary | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.11 — Module CRM ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | LeadKanban | ||
| + | |||
| + | OpportunityPipeline | ||
| + | |||
| + | TaskBoard | ||
| + | |||
| + | CustomerTimeline | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.12 — Module Finance ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | InvoiceTable | ||
| + | |||
| + | PaymentHistory | ||
| + | |||
| + | RefundManager | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.13 — Module OTA ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | ChannelStatus | ||
| + | |||
| + | SyncDashboard | ||
| + | |||
| + | DistributionTable | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.14 — Module IA ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | /ai | ||
| + | |||
| + | /ai/chat | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | AiChat | ||
| + | |||
| + | RecommendationPanel | ||
| + | |||
| + | KnowledgeSearch | ||
| + | |||
| + | AutomationDashboard | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.15 — Module Sécurité ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | /security | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | |||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | MfaWizard | ||
| + | |||
| + | SessionManager | ||
| + | |||
| + | ConsentManager | ||
| + | |||
| + | RiskMatrix | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.16 — Dashboard ====== | ||
| + | |||
| + | ===== Route ===== | ||
| + | |||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Widgets ===== | ||
| + | |||
| + | < | ||
| + | Revenue KPI | ||
| + | |||
| + | Occupancy KPI | ||
| + | |||
| + | Reservations KPI | ||
| + | |||
| + | Payments KPI | ||
| + | |||
| + | Lead KPI | ||
| + | |||
| + | Security KPI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.17 — Internationalisation ====== | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install next-intl | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Langues ===== | ||
| + | |||
| + | < | ||
| + | fr | ||
| + | |||
| + | en | ||
| + | |||
| + | es | ||
| + | |||
| + | it | ||
| + | |||
| + | de | ||
| + | |||
| + | nl | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | messages | ||
| + | |||
| + | ├── fr.json | ||
| + | |||
| + | ├── en.json | ||
| + | |||
| + | ├── es.json | ||
| + | |||
| + | └── de.json | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.18 — Multi-Tenant ====== | ||
| + | |||
| + | ===== Header ===== | ||
| + | |||
| + | < | ||
| + | X-Tenant-Id | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Provider ===== | ||
| + | |||
| + | < | ||
| + | TenantProvider | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Context ===== | ||
| + | |||
| + | <code ts> | ||
| + | TenantContext | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Changer dynamiquement : | ||
| + | |||
| + | < | ||
| + | Branding | ||
| + | |||
| + | Logo | ||
| + | |||
| + | Couleurs | ||
| + | |||
| + | Permissions | ||
| + | |||
| + | Domaine | ||
| + | </ | ||
| + | |||
| + | selon le tenant. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.19 — RBAC Frontend ====== | ||
| + | |||
| + | ===== Hooks ===== | ||
| + | |||
| + | <code ts> | ||
| + | useRole() | ||
| + | |||
| + | usePermission() | ||
| + | |||
| + | useFeatureFlag() | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composant ===== | ||
| + | |||
| + | <code tsx> | ||
| + | <Can permission=" | ||
| + | |||
| + | < | ||
| + | |||
| + | Ajouter | ||
| + | |||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.20 — Feature Flags ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | < | ||
| + | FeatureFlagProvider | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code tsx> | ||
| + | < | ||
| + | code=" | ||
| + | |||
| + | < | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.21 — Gestion des erreurs ====== | ||
| + | |||
| + | ===== Pages ===== | ||
| + | |||
| + | < | ||
| + | not-found.tsx | ||
| + | |||
| + | error.tsx | ||
| + | |||
| + | global-error.tsx | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Composants ===== | ||
| + | |||
| + | < | ||
| + | ErrorBoundary | ||
| + | |||
| + | ApiErrorAlert | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-E.22 — Tests ====== | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm install vitest | ||
| + | |||
| + | npm install @testing-library/ | ||
| + | |||
| + | npm install @testing-library/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Types ===== | ||
| + | |||
| + | < | ||
| + | Unit | ||
| + | |||
| + | Integration | ||
| + | |||
| + | Component | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Contrôles qualité ====== | ||
| + | |||
| + | ===== Lint ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx lint web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Type Check ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx tsc --noEmit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Build ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx build web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Local ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx serve web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | apps/web | ||
| + | |||
| + | layouts | ||
| + | |||
| + | providers | ||
| + | |||
| + | modules | ||
| + | |||
| + | components | ||
| + | |||
| + | hooks | ||
| + | |||
| + | services | ||
| + | |||
| + | stores | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-E est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ NextJS compilable | ||
| + | |||
| + | ✓ Auth fonctionnelle | ||
| + | |||
| + | ✓ SDK intégré | ||
| + | |||
| + | ✓ RBAC opérationnel | ||
| + | |||
| + | ✓ Multi-Tenant opérationnel | ||
| + | |||
| + | ✓ Internationalisation opérationnelle | ||
| + | |||
| + | ✓ Dashboard opérationnel | ||
| + | |||
| + | ✓ Build vert | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-F — Docker Compose Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Industrialiser complètement l' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ PostgreSQL | ||
| + | |||
| + | ✓ Redis | ||
| + | |||
| + | ✓ NestJS | ||
| + | |||
| + | ✓ NextJS | ||
| + | |||
| + | ✓ PgAdmin | ||
| + | |||
| + | ✓ Mailhog | ||
| + | |||
| + | ✓ MinIO | ||
| + | |||
| + | ✓ Nginx | ||
| + | |||
| + | ✓ Monitoring | ||
| + | |||
| + | ✓ Docker Network | ||
| + | |||
| + | ✓ Volumes persistants | ||
| + | </ | ||
| + | |||
| + | seront disponibles via une simple commande : | ||
| + | |||
| + | <code bash> | ||
| + | docker compose up -d | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture cible ====== | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | ┌─────────────┐ | ||
| + | │ | ||
| + | └──────┬──────┘ | ||
| + | │ | ||
| + | ▼ | ||
| + | ┌─────────────┐ | ||
| + | │ | ||
| + | └──────┬──────┘ | ||
| + | │ | ||
| + | ▼ | ||
| + | ┌─────────────┐ | ||
| + | │ | ||
| + | └──────┬──────┘ | ||
| + | │ | ||
| + | | ||
| + | | ||
| + | |||
| + | Postgres Redis MinIO | ||
| + | |||
| + | │ | ||
| + | ▼ | ||
| + | |||
| + | | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.1 — Structure Docker ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | docker | ||
| + | |||
| + | ├── postgres | ||
| + | |||
| + | ├── redis | ||
| + | |||
| + | ├── minio | ||
| + | |||
| + | ├── nginx | ||
| + | |||
| + | ├── mailhog | ||
| + | |||
| + | ├── prometheus | ||
| + | |||
| + | └── grafana | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.2 — Docker Network ====== | ||
| + | |||
| + | ===== docker-compose.yml ===== | ||
| + | |||
| + | Créer à la racine : | ||
| + | |||
| + | < | ||
| + | docker-compose.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Network ===== | ||
| + | |||
| + | <code yaml> | ||
| + | networks: | ||
| + | |||
| + | platform-network: | ||
| + | |||
| + | driver: bridge | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.3 — PostgreSQL ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | postgres: | ||
| + | |||
| + | image: postgres: | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | environment: | ||
| + | |||
| + | POSTGRES_DB: | ||
| + | |||
| + | POSTGRES_USER: | ||
| + | |||
| + | POSTGRES_PASSWORD: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - postgres_data:/ | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Volume ===== | ||
| + | |||
| + | <code yaml> | ||
| + | volumes: | ||
| + | |||
| + | postgres_data: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.4 — PgAdmin ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | pgadmin: | ||
| + | |||
| + | image: dpage/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | environment: | ||
| + | |||
| + | PGADMIN_DEFAULT_EMAIL: | ||
| + | |||
| + | PGADMIN_DEFAULT_PASSWORD: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | depends_on: | ||
| + | |||
| + | - postgres | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== URL ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.5 — Redis ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | redis: | ||
| + | |||
| + | image: redis: | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - redis_data:/ | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Volume ===== | ||
| + | |||
| + | <code yaml> | ||
| + | redis_data: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.6 — Mailhog ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | mailhog: | ||
| + | |||
| + | image: mailhog/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | - " | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== URLs ===== | ||
| + | |||
| + | < | ||
| + | SMTP | ||
| + | |||
| + | localhost: | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | UI | ||
| + | |||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.7 — MinIO ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minio: | ||
| + | |||
| + | image: minio/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | command: server /data --console-address ": | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | environment: | ||
| + | |||
| + | MINIO_ROOT_USER: | ||
| + | |||
| + | MINIO_ROOT_PASSWORD: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - minio_data:/ | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Volume ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minio_data: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Console ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.8 — API NestJS ====== | ||
| + | |||
| + | ===== Dockerfile ===== | ||
| + | |||
| + | Créer : | ||
| + | |||
| + | < | ||
| + | apps/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | <code docker> | ||
| + | FROM node: | ||
| + | |||
| + | WORKDIR /app | ||
| + | |||
| + | COPY . . | ||
| + | |||
| + | RUN npm install | ||
| + | |||
| + | RUN npm run build api | ||
| + | |||
| + | CMD [" | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | api: | ||
| + | |||
| + | build: | ||
| + | |||
| + | context: . | ||
| + | |||
| + | dockerfile: apps/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | env_file: | ||
| + | |||
| + | - apps/ | ||
| + | |||
| + | depends_on: | ||
| + | |||
| + | - postgres | ||
| + | |||
| + | - redis | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.9 — Frontend NextJS ====== | ||
| + | |||
| + | ===== Dockerfile ===== | ||
| + | |||
| + | Créer : | ||
| + | |||
| + | < | ||
| + | apps/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | <code docker> | ||
| + | FROM node: | ||
| + | |||
| + | WORKDIR /app | ||
| + | |||
| + | COPY . . | ||
| + | |||
| + | RUN npm install | ||
| + | |||
| + | RUN npm run build web | ||
| + | |||
| + | CMD [" | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | web: | ||
| + | |||
| + | build: | ||
| + | |||
| + | context: . | ||
| + | |||
| + | dockerfile: apps/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | restart: always | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | depends_on: | ||
| + | |||
| + | - api | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.10 — NGINX Reverse Proxy ====== | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | docker/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | <code nginx> | ||
| + | server { | ||
| + | |||
| + | listen 80; | ||
| + | |||
| + | location / { | ||
| + | |||
| + | proxy_pass http:// | ||
| + | } | ||
| + | |||
| + | location /api { | ||
| + | |||
| + | proxy_pass http:// | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | nginx: | ||
| + | |||
| + | image: nginx: | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - ./ | ||
| + | |||
| + | depends_on: | ||
| + | |||
| + | - web | ||
| + | |||
| + | - api | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.11 — Prometheus ====== | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | < | ||
| + | docker/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | prometheus: | ||
| + | |||
| + | image: prom/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - ./ | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.12 — Grafana ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | grafana: | ||
| + | |||
| + | image: grafana/ | ||
| + | |||
| + | container_name: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - " | ||
| + | |||
| + | volumes: | ||
| + | |||
| + | - grafana_data:/ | ||
| + | |||
| + | networks: | ||
| + | |||
| + | - platform-network | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Volume ===== | ||
| + | |||
| + | <code yaml> | ||
| + | grafana_data: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== URL ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.13 — Fichier .env Docker ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | .env.docker | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | < | ||
| + | POSTGRES_USER=postgres | ||
| + | |||
| + | POSTGRES_PASSWORD=postgres | ||
| + | |||
| + | POSTGRES_DB=rental_platform | ||
| + | |||
| + | REDIS_HOST=redis | ||
| + | |||
| + | REDIS_PORT=6379 | ||
| + | |||
| + | MINIO_ENDPOINT=minio | ||
| + | |||
| + | MINIO_ACCESS_KEY=admin | ||
| + | |||
| + | MINIO_SECRET_KEY=password123 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.14 — Démarrage ====== | ||
| + | |||
| + | ===== Lancer ===== | ||
| + | |||
| + | <code bash> | ||
| + | docker compose up -d | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | <code bash> | ||
| + | docker ps | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Résultat ===== | ||
| + | |||
| + | < | ||
| + | postgres | ||
| + | |||
| + | redis | ||
| + | |||
| + | mailhog | ||
| + | |||
| + | minio | ||
| + | |||
| + | pgadmin | ||
| + | |||
| + | api | ||
| + | |||
| + | web | ||
| + | |||
| + | nginx | ||
| + | |||
| + | prometheus | ||
| + | |||
| + | grafana | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-F.15 — Vérifications ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Swagger ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Front ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== PgAdmin ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Mailhog ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== MinIO ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Grafana ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Prometheus ===== | ||
| + | |||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-F est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Tous les conteneurs démarrent | ||
| + | |||
| + | ✓ PostgreSQL accessible | ||
| + | |||
| + | ✓ Redis accessible | ||
| + | |||
| + | ✓ API accessible | ||
| + | |||
| + | ✓ Frontend accessible | ||
| + | |||
| + | ✓ Swagger accessible | ||
| + | |||
| + | ✓ Mailhog opérationnel | ||
| + | |||
| + | ✓ MinIO opérationnel | ||
| + | |||
| + | ✓ Monitoring opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | docker-compose.yml | ||
| + | |||
| + | apps/ | ||
| + | |||
| + | apps/ | ||
| + | |||
| + | docker/ | ||
| + | |||
| + | docker/ | ||
| + | |||
| + | .env.docker | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-G — GitHub Actions CI/CD Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Industrialiser complètement le cycle de développement. | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Build automatique | ||
| + | |||
| + | ✓ Lint automatique | ||
| + | |||
| + | ✓ Tests automatiques | ||
| + | |||
| + | ✓ Validation Prisma | ||
| + | |||
| + | ✓ Génération OpenAPI | ||
| + | |||
| + | ✓ Build Docker | ||
| + | |||
| + | ✓ Security Scan | ||
| + | |||
| + | ✓ Release automatique | ||
| + | |||
| + | ✓ Qualité contrôlée | ||
| + | </ | ||
| + | |||
| + | sur chaque : | ||
| + | |||
| + | < | ||
| + | Push | ||
| + | |||
| + | Pull Request | ||
| + | |||
| + | Release | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture CI/CD ====== | ||
| + | |||
| + | ===== Pipelines ===== | ||
| + | |||
| + | < | ||
| + | CI | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Quality | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Security | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Docker | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Release | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Deploy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Structure ====== | ||
| + | |||
| + | ===== Répertoire ===== | ||
| + | |||
| + | < | ||
| + | .github | ||
| + | |||
| + | └── workflows | ||
| + | |||
| + | ├── ci.yml | ||
| + | |||
| + | ├── quality.yml | ||
| + | |||
| + | ├── security.yml | ||
| + | |||
| + | ├── docker.yml | ||
| + | |||
| + | ├── release.yml | ||
| + | |||
| + | └── deploy.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.1 — Workflow CI ====== | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | .github/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclencheurs ===== | ||
| + | |||
| + | <code yaml> | ||
| + | on: | ||
| + | |||
| + | push: | ||
| + | |||
| + | branches: | ||
| + | |||
| + | - main | ||
| + | |||
| + | - develop | ||
| + | |||
| + | pull_request: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Jobs ===== | ||
| + | |||
| + | < | ||
| + | Install | ||
| + | |||
| + | Lint | ||
| + | |||
| + | Build | ||
| + | |||
| + | Test | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code yaml> | ||
| + | name: CI | ||
| + | |||
| + | jobs: | ||
| + | |||
| + | install: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - uses: actions/ | ||
| + | |||
| + | - uses: actions/ | ||
| + | |||
| + | - run: npm ci | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.2 — Lint ====== | ||
| + | |||
| + | ===== Job ===== | ||
| + | |||
| + | <code yaml> | ||
| + | lint: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: nx lint api | ||
| + | |||
| + | - run: nx lint web | ||
| + | |||
| + | - run: nx lint contracts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contrôle ===== | ||
| + | |||
| + | < | ||
| + | ESLint | ||
| + | |||
| + | Prettier | ||
| + | |||
| + | Architecture | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.3 — Type Check ====== | ||
| + | |||
| + | ===== Job ===== | ||
| + | |||
| + | <code yaml> | ||
| + | typecheck: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: npx tsc --noEmit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.4 — Prisma Validation ====== | ||
| + | |||
| + | ===== Job ===== | ||
| + | |||
| + | <code yaml> | ||
| + | prisma: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: npx prisma validate | ||
| + | |||
| + | - run: npx prisma format --check | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Empêcher : | ||
| + | |||
| + | < | ||
| + | Migration cassée | ||
| + | |||
| + | Relation invalide | ||
| + | |||
| + | Schema incorrect | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.5 — Build ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | <code yaml> | ||
| + | build-api: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: nx build api | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Front ===== | ||
| + | |||
| + | <code yaml> | ||
| + | build-web: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: nx build web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contracts ===== | ||
| + | |||
| + | <code yaml> | ||
| + | build-contracts: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: nx build contracts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.6 — Tests ====== | ||
| + | |||
| + | ===== Unitaires ===== | ||
| + | |||
| + | <code yaml> | ||
| + | test-unit: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | |||
| + | steps: | ||
| + | |||
| + | - run: nx test api | ||
| + | |||
| + | - run: nx test web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Couverture ===== | ||
| + | |||
| + | < | ||
| + | Minimum 80% | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contrôle ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npm run test: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.7 — PostgreSQL CI ====== | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | services: | ||
| + | |||
| + | postgres: | ||
| + | |||
| + | image: postgres: | ||
| + | |||
| + | env: | ||
| + | |||
| + | POSTGRES_USER: | ||
| + | |||
| + | POSTGRES_PASSWORD: | ||
| + | |||
| + | POSTGRES_DB: | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - 5432:5432 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Migration ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npx prisma migrate deploy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Seed ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npx prisma db seed | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.8 — Tests E2E ====== | ||
| + | |||
| + | ===== Job ===== | ||
| + | |||
| + | <code yaml> | ||
| + | e2e: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Scénarios ===== | ||
| + | |||
| + | < | ||
| + | Register | ||
| + | |||
| + | Login | ||
| + | |||
| + | Create Property | ||
| + | |||
| + | Create Reservation | ||
| + | |||
| + | Create Invoice | ||
| + | |||
| + | Payment | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Commande ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: nx e2e api-e2e | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.9 — Security Scan ====== | ||
| + | |||
| + | ===== Dépendances ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npm audit | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Trivy ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - uses: aquasecurity/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Vérifications ===== | ||
| + | |||
| + | < | ||
| + | CVE | ||
| + | |||
| + | Secrets | ||
| + | |||
| + | Images Docker | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.10 — Secret Scan ====== | ||
| + | |||
| + | ===== Gitleaks ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - uses: gitleaks/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Détecte ===== | ||
| + | |||
| + | < | ||
| + | API Keys | ||
| + | |||
| + | Passwords | ||
| + | |||
| + | Tokens | ||
| + | |||
| + | Secrets AWS | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.11 — OpenAPI Validation ====== | ||
| + | |||
| + | ===== Génération ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npm run swagger: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Validation ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - run: npm run openapi: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Vérification ===== | ||
| + | |||
| + | < | ||
| + | Swagger valide | ||
| + | |||
| + | Contrats cohérents | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.12 — Build Docker ====== | ||
| + | |||
| + | ===== Job ===== | ||
| + | |||
| + | <code yaml> | ||
| + | docker: | ||
| + | |||
| + | runs-on: ubuntu-latest | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | <code yaml> | ||
| + | docker build \ | ||
| + | -f apps/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Front ===== | ||
| + | |||
| + | <code yaml> | ||
| + | docker build \ | ||
| + | -f apps/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.13 — Push Registry ====== | ||
| + | |||
| + | ===== GitHub Container Registry ===== | ||
| + | |||
| + | < | ||
| + | ghcr.io | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Login ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - uses: docker/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Push ===== | ||
| + | |||
| + | <code yaml> | ||
| + | docker push ghcr.io/ | ||
| + | |||
| + | docker push ghcr.io/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.14 — Release Automation ====== | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | .github/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclencheur ===== | ||
| + | |||
| + | <code yaml> | ||
| + | on: | ||
| + | |||
| + | push: | ||
| + | |||
| + | tags: | ||
| + | |||
| + | - ' | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | < | ||
| + | v1.0.0 | ||
| + | |||
| + | v1.1.0 | ||
| + | |||
| + | v2.0.0 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Génération ===== | ||
| + | |||
| + | < | ||
| + | Release Notes | ||
| + | |||
| + | Docker Images | ||
| + | |||
| + | Artifacts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.15 — Artifacts ====== | ||
| + | |||
| + | ===== Upload ===== | ||
| + | |||
| + | <code yaml> | ||
| + | - uses: actions/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Artifacts ===== | ||
| + | |||
| + | < | ||
| + | OpenAPI | ||
| + | |||
| + | Coverage | ||
| + | |||
| + | Build | ||
| + | |||
| + | Migration SQL | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.16 — Badges ====== | ||
| + | |||
| + | ===== README ===== | ||
| + | |||
| + | <code markdown> | ||
| + | ![CI] | ||
| + | |||
| + | ![Coverage] | ||
| + | |||
| + | ![Docker] | ||
| + | |||
| + | ![Security] | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.17 — Branch Protection ====== | ||
| + | |||
| + | ===== Main ===== | ||
| + | |||
| + | Configurer GitHub : | ||
| + | |||
| + | < | ||
| + | Require Pull Request | ||
| + | |||
| + | Require CI | ||
| + | |||
| + | Require Reviews | ||
| + | |||
| + | Require Status Checks | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Interdictions ===== | ||
| + | |||
| + | < | ||
| + | Push direct main | ||
| + | |||
| + | Merge sans review | ||
| + | |||
| + | Merge sans CI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.18 — Dependabot ====== | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | .github/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code yaml> | ||
| + | version: 2 | ||
| + | |||
| + | updates: | ||
| + | |||
| + | - package-ecosystem: | ||
| + | |||
| + | directory: "/" | ||
| + | |||
| + | schedule: | ||
| + | |||
| + | interval: weekly | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.19 — Renovate (optionnel) ====== | ||
| + | |||
| + | ===== Alternative ===== | ||
| + | |||
| + | < | ||
| + | Renovate Bot | ||
| + | </ | ||
| + | |||
| + | pour : | ||
| + | |||
| + | < | ||
| + | NPM | ||
| + | |||
| + | Docker | ||
| + | |||
| + | GitHub Actions | ||
| + | |||
| + | Terraform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-G.20 — Qualité Enterprise ====== | ||
| + | |||
| + | ===== Gates ===== | ||
| + | |||
| + | < | ||
| + | Coverage > 80% | ||
| + | |||
| + | 0 erreur ESLint | ||
| + | |||
| + | 0 erreur TypeScript | ||
| + | |||
| + | 0 migration invalide | ||
| + | |||
| + | 0 vulnérabilité critique | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Arborescence finale ====== | ||
| + | |||
| + | < | ||
| + | .github | ||
| + | |||
| + | └── workflows | ||
| + | |||
| + | ├── ci.yml | ||
| + | |||
| + | ├── quality.yml | ||
| + | |||
| + | ├── security.yml | ||
| + | |||
| + | ├── docker.yml | ||
| + | |||
| + | ├── release.yml | ||
| + | |||
| + | └── deploy.yml | ||
| + | |||
| + | .github | ||
| + | |||
| + | └── dependabot.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-G est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ CI verte | ||
| + | |||
| + | ✓ Build automatique | ||
| + | |||
| + | ✓ Lint automatique | ||
| + | |||
| + | ✓ Tests automatiques | ||
| + | |||
| + | ✓ Docker build automatique | ||
| + | |||
| + | ✓ OpenAPI validé | ||
| + | |||
| + | ✓ Security scan actif | ||
| + | |||
| + | ✓ Releases automatisées | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | .github/ | ||
| + | |||
| + | .github/ | ||
| + | |||
| + | README.md | ||
| + | |||
| + | Badges CI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-H — Helm Charts Kubernetes Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Préparer la plateforme pour un déploiement Cloud Native Enterprise. | ||
| + | |||
| + | Cette phase transforme : | ||
| + | |||
| + | < | ||
| + | Docker Compose | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Kubernetes | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Helm Charts | ||
| + | </ | ||
| + | |||
| + | afin de permettre : | ||
| + | |||
| + | < | ||
| + | AWS EKS | ||
| + | |||
| + | Azure AKS | ||
| + | |||
| + | Google GKE | ||
| + | |||
| + | OVH Managed Kubernetes | ||
| + | |||
| + | On-Prem Kubernetes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Résultat attendu ====== | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Helm Charts complets | ||
| + | |||
| + | ✓ Déploiement automatisé | ||
| + | |||
| + | ✓ Rolling Updates | ||
| + | |||
| + | ✓ Autoscaling | ||
| + | |||
| + | ✓ Secrets Kubernetes | ||
| + | |||
| + | ✓ ConfigMaps | ||
| + | |||
| + | ✓ Ingress | ||
| + | |||
| + | ✓ Monitoring | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Architecture Kubernetes ====== | ||
| + | |||
| + | < | ||
| + | Namespace | ||
| + | |||
| + | │ | ||
| + | |||
| + | ├── web | ||
| + | |||
| + | ├── api | ||
| + | |||
| + | ├── postgres | ||
| + | |||
| + | ├── redis | ||
| + | |||
| + | ├── minio | ||
| + | |||
| + | ├── ingress | ||
| + | |||
| + | ├── monitoring | ||
| + | |||
| + | └── jobs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.1 — Structure Helm ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | deploy | ||
| + | |||
| + | └── helm | ||
| + | |||
| + | └── rental-platform | ||
| + | |||
| + | ├── Chart.yaml | ||
| + | |||
| + | ├── values.yaml | ||
| + | |||
| + | ├── values-dev.yaml | ||
| + | |||
| + | ├── values-staging.yaml | ||
| + | |||
| + | ├── values-prod.yaml | ||
| + | |||
| + | └── templates | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.2 — Chart.yaml ====== | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | deploy/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | <code yaml> | ||
| + | apiVersion: v2 | ||
| + | |||
| + | name: rental-platform | ||
| + | |||
| + | description: | ||
| + | |||
| + | type: application | ||
| + | |||
| + | version: 1.0.0 | ||
| + | |||
| + | appVersion: " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.3 — values.yaml ====== | ||
| + | |||
| + | ===== Configuration globale ===== | ||
| + | |||
| + | <code yaml> | ||
| + | global: | ||
| + | |||
| + | environment: | ||
| + | |||
| + | domain: local.dev | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Images ===== | ||
| + | |||
| + | <code yaml> | ||
| + | image: | ||
| + | |||
| + | api: | ||
| + | |||
| + | repository: ghcr.io/ | ||
| + | |||
| + | tag: latest | ||
| + | |||
| + | web: | ||
| + | |||
| + | repository: ghcr.io/ | ||
| + | |||
| + | tag: latest | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.4 — Namespace ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | <code yaml> | ||
| + | apiVersion: v1 | ||
| + | |||
| + | kind: Namespace | ||
| + | |||
| + | metadata: | ||
| + | |||
| + | name: rental-platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.5 — API Deployment ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Deployment ===== | ||
| + | |||
| + | <code yaml> | ||
| + | apiVersion: apps/v1 | ||
| + | |||
| + | kind: Deployment | ||
| + | |||
| + | metadata: | ||
| + | |||
| + | name: api | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== ReplicaSet ===== | ||
| + | |||
| + | <code yaml> | ||
| + | spec: | ||
| + | |||
| + | replicas: 3 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Container ===== | ||
| + | |||
| + | <code yaml> | ||
| + | containers: | ||
| + | |||
| + | - name: api | ||
| + | |||
| + | image: "{{ .Values.image.api.repository }}:{{ .Values.image.api.tag }}" | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.6 — API Service ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | kind: Service | ||
| + | |||
| + | spec: | ||
| + | |||
| + | type: ClusterIP | ||
| + | |||
| + | ports: | ||
| + | |||
| + | - port: 3000 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.7 — Web Deployment ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Replicas ===== | ||
| + | |||
| + | <code yaml> | ||
| + | spec: | ||
| + | |||
| + | replicas: 2 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Container ===== | ||
| + | |||
| + | <code yaml> | ||
| + | containers: | ||
| + | |||
| + | - name: web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.8 — Web Service ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Service ===== | ||
| + | |||
| + | <code yaml> | ||
| + | type: ClusterIP | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.9 — PostgreSQL ====== | ||
| + | |||
| + | ===== Option 1 ===== | ||
| + | |||
| + | Utiliser : | ||
| + | |||
| + | < | ||
| + | Bitnami PostgreSQL | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Dépendance ===== | ||
| + | |||
| + | <code yaml> | ||
| + | dependencies: | ||
| + | |||
| + | - name: postgresql | ||
| + | |||
| + | version: 15.* | ||
| + | |||
| + | repository: https:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Valeurs ===== | ||
| + | |||
| + | <code yaml> | ||
| + | postgresql: | ||
| + | |||
| + | auth: | ||
| + | |||
| + | database: rental_platform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.10 — Redis ====== | ||
| + | |||
| + | ===== Dépendance ===== | ||
| + | |||
| + | <code yaml> | ||
| + | dependencies: | ||
| + | |||
| + | - name: redis | ||
| + | |||
| + | repository: https:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Valeurs ===== | ||
| + | |||
| + | <code yaml> | ||
| + | redis: | ||
| + | |||
| + | architecture: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.11 — MinIO ====== | ||
| + | |||
| + | ===== Dépendance ===== | ||
| + | |||
| + | <code yaml> | ||
| + | dependencies: | ||
| + | |||
| + | - name: minio | ||
| + | |||
| + | repository: https:// | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Bucket ===== | ||
| + | |||
| + | < | ||
| + | contracts | ||
| + | |||
| + | properties | ||
| + | |||
| + | documents | ||
| + | |||
| + | uploads | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.12 — ConfigMap ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Variables ===== | ||
| + | |||
| + | <code yaml> | ||
| + | DATABASE_HOST | ||
| + | |||
| + | REDIS_HOST | ||
| + | |||
| + | MINIO_ENDPOINT | ||
| + | |||
| + | NODE_ENV | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.13 — Secrets ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Contenu ===== | ||
| + | |||
| + | <code yaml> | ||
| + | POSTGRES_PASSWORD | ||
| + | |||
| + | JWT_SECRET | ||
| + | |||
| + | MINIO_SECRET_KEY | ||
| + | |||
| + | STRIPE_SECRET_KEY | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Recommandation ===== | ||
| + | |||
| + | Ne jamais stocker les secrets dans Git. | ||
| + | |||
| + | Utiliser : | ||
| + | |||
| + | < | ||
| + | External Secrets | ||
| + | |||
| + | AWS Secrets Manager | ||
| + | |||
| + | Azure Key Vault | ||
| + | |||
| + | Hashicorp Vault | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.14 — Ingress ====== | ||
| + | |||
| + | ===== Template ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Domaine ===== | ||
| + | |||
| + | < | ||
| + | api.domain.com | ||
| + | |||
| + | app.domain.com | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code yaml> | ||
| + | rules: | ||
| + | |||
| + | - host: api.domain.com | ||
| + | |||
| + | - host: app.domain.com | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.15 — TLS ====== | ||
| + | |||
| + | ===== Cert Manager ===== | ||
| + | |||
| + | < | ||
| + | cert-manager | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Issuer ===== | ||
| + | |||
| + | < | ||
| + | Let's Encrypt | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== HTTPS ===== | ||
| + | |||
| + | < | ||
| + | TLS obligatoire | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.16 — Horizontal Pod Autoscaler ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minReplicas: | ||
| + | |||
| + | maxReplicas: | ||
| + | |||
| + | targetCPUUtilizationPercentage: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Web ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minReplicas: | ||
| + | |||
| + | maxReplicas: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.17 — Pod Disruption Budget ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minAvailable: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Web ===== | ||
| + | |||
| + | <code yaml> | ||
| + | minAvailable: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.18 — Resources ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | <code yaml> | ||
| + | requests: | ||
| + | |||
| + | cpu: 500m | ||
| + | |||
| + | memory: 512Mi | ||
| + | |||
| + | limits: | ||
| + | |||
| + | cpu: 2000m | ||
| + | |||
| + | memory: 2Gi | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Web ===== | ||
| + | |||
| + | <code yaml> | ||
| + | requests: | ||
| + | |||
| + | cpu: 250m | ||
| + | |||
| + | memory: 256Mi | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.19 — Liveness & Readiness ====== | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | <code yaml> | ||
| + | livenessProbe: | ||
| + | |||
| + | httpGet: | ||
| + | |||
| + | path: /health | ||
| + | |||
| + | port: 3000 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Readiness ===== | ||
| + | |||
| + | <code yaml> | ||
| + | readinessProbe: | ||
| + | |||
| + | httpGet: | ||
| + | |||
| + | path: /health | ||
| + | |||
| + | port: 3000 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.20 — Jobs Kubernetes ====== | ||
| + | |||
| + | ===== Migrations Prisma ===== | ||
| + | |||
| + | < | ||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Commande ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma migrate deploy | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Seed ===== | ||
| + | |||
| + | <code bash> | ||
| + | npx prisma db seed | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.21 — Monitoring ====== | ||
| + | |||
| + | ===== Prometheus ===== | ||
| + | |||
| + | < | ||
| + | kube-prometheus-stack | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Grafana ===== | ||
| + | |||
| + | < | ||
| + | Dashboards | ||
| + | |||
| + | API | ||
| + | |||
| + | PostgreSQL | ||
| + | |||
| + | Redis | ||
| + | |||
| + | Kubernetes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.22 — Logging ====== | ||
| + | |||
| + | ===== Stack ===== | ||
| + | |||
| + | < | ||
| + | Loki | ||
| + | |||
| + | Promtail | ||
| + | |||
| + | Grafana | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Centraliser : | ||
| + | |||
| + | < | ||
| + | API Logs | ||
| + | |||
| + | Audit Logs | ||
| + | |||
| + | Security Logs | ||
| + | |||
| + | Business Logs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.23 — Installation ====== | ||
| + | |||
| + | ===== Ajouter dépendances ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm dependency update | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Vérifier ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm lint deploy/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Dry Run ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm install rental-platform \ | ||
| + | deploy/ | ||
| + | --dry-run | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-H.24 — Déploiement ====== | ||
| + | |||
| + | ===== Dev ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm upgrade \ | ||
| + | --install rental-platform \ | ||
| + | deploy/ | ||
| + | -f values-dev.yaml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Staging ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm upgrade \ | ||
| + | --install rental-platform \ | ||
| + | -f values-staging.yaml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Production ===== | ||
| + | |||
| + | <code bash> | ||
| + | helm upgrade \ | ||
| + | --install rental-platform \ | ||
| + | -f values-prod.yaml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Arborescence finale ====== | ||
| + | |||
| + | < | ||
| + | deploy | ||
| + | |||
| + | └── helm | ||
| + | |||
| + | └── rental-platform | ||
| + | |||
| + | ├── Chart.yaml | ||
| + | |||
| + | ├── values.yaml | ||
| + | |||
| + | ├── values-dev.yaml | ||
| + | |||
| + | ├── values-staging.yaml | ||
| + | |||
| + | ├── values-prod.yaml | ||
| + | |||
| + | └── templates | ||
| + | |||
| + | ├── namespace.yaml | ||
| + | |||
| + | ├── api-deployment.yaml | ||
| + | |||
| + | ├── api-service.yaml | ||
| + | |||
| + | ├── web-deployment.yaml | ||
| + | |||
| + | ├── web-service.yaml | ||
| + | |||
| + | ├── ingress.yaml | ||
| + | |||
| + | ├── configmap.yaml | ||
| + | |||
| + | ├── secret.yaml | ||
| + | |||
| + | ├── api-hpa.yaml | ||
| + | |||
| + | └── job-migration.yaml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-H est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Helm valide | ||
| + | |||
| + | ✓ Déploiement Kubernetes valide | ||
| + | |||
| + | ✓ HPA opérationnel | ||
| + | |||
| + | ✓ TLS opérationnel | ||
| + | |||
| + | ✓ Monitoring opérationnel | ||
| + | |||
| + | ✓ Logging centralisé | ||
| + | |||
| + | ✓ Rolling Update opérationnel | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | deploy/ | ||
| + | |||
| + | Chart.yaml | ||
| + | |||
| + | values*.yaml | ||
| + | |||
| + | templates/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-I — Terraform Infrastructure Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Décrire l' | ||
| + | |||
| + | Cette phase transforme : | ||
| + | |||
| + | < | ||
| + | Infrastructure manuelle | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Infrastructure as Code (IaC) | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Terraform | ||
| + | </ | ||
| + | |||
| + | afin d' | ||
| + | |||
| + | < | ||
| + | ✓ Infrastructure reproductible | ||
| + | |||
| + | ✓ Multi-environnements | ||
| + | |||
| + | ✓ Versionnée dans Git | ||
| + | |||
| + | ✓ Auditée | ||
| + | |||
| + | ✓ Déployable automatiquement | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Plateforme cible ====== | ||
| + | |||
| + | ===== Cloud principal ===== | ||
| + | |||
| + | < | ||
| + | AWS | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Compatibilité ===== | ||
| + | |||
| + | < | ||
| + | AWS | ||
| + | |||
| + | Azure | ||
| + | |||
| + | GCP | ||
| + | |||
| + | OVH Cloud | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Architecture cible ===== | ||
| + | |||
| + | < | ||
| + | Internet | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Cloudflare | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | ALB | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | EKS | ||
| + | |||
| + | ├── API | ||
| + | |||
| + | ├── WEB | ||
| + | |||
| + | ├── Workers | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | RDS PostgreSQL | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Elasticache Redis | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | S3 | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | Secrets Manager | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | CloudWatch | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.1 — Structure Terraform ====== | ||
| + | |||
| + | ===== Créer ===== | ||
| + | |||
| + | < | ||
| + | deploy | ||
| + | |||
| + | └── terraform | ||
| + | |||
| + | ├── environments | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | ├── modules | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | |||
| + | │ | ||
| + | └── global | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.2 — Backend Terraform ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Stocker l' | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fichier ===== | ||
| + | |||
| + | < | ||
| + | global/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple AWS ===== | ||
| + | |||
| + | <code terraform> | ||
| + | terraform { | ||
| + | |||
| + | backend " | ||
| + | |||
| + | bucket = " | ||
| + | |||
| + | key = " | ||
| + | |||
| + | region = " | ||
| + | |||
| + | encrypt = true | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.3 — Provider AWS ====== | ||
| + | |||
| + | ===== provider.tf ===== | ||
| + | |||
| + | <code terraform> | ||
| + | provider " | ||
| + | |||
| + | region = var.aws_region | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Variables ===== | ||
| + | |||
| + | <code terraform> | ||
| + | variable " | ||
| + | |||
| + | default = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.4 — Réseau (VPC) ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ressources ===== | ||
| + | |||
| + | < | ||
| + | VPC | ||
| + | |||
| + | Public Subnets | ||
| + | |||
| + | Private Subnets | ||
| + | |||
| + | NAT Gateway | ||
| + | |||
| + | Internet Gateway | ||
| + | |||
| + | Route Tables | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | cidr_block = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.5 — Kubernetes EKS ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Cluster ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | name = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Node Groups ===== | ||
| + | |||
| + | < | ||
| + | System | ||
| + | |||
| + | Application | ||
| + | |||
| + | Jobs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sizing ===== | ||
| + | |||
| + | < | ||
| + | Min 3 nodes | ||
| + | |||
| + | Max 20 nodes | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.6 — PostgreSQL RDS ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ressource ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | engine = " | ||
| + | |||
| + | engine_version = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | < | ||
| + | Multi-AZ | ||
| + | |||
| + | Encrypted | ||
| + | |||
| + | Automated Backup | ||
| + | |||
| + | Point In Time Recovery | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Taille initiale ===== | ||
| + | |||
| + | < | ||
| + | db.t3.medium | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.7 — Redis ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ressource ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | engine = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | < | ||
| + | Primary | ||
| + | |||
| + | Replica | ||
| + | |||
| + | Automatic Failover | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.8 — S3 ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Buckets ===== | ||
| + | |||
| + | < | ||
| + | contracts | ||
| + | |||
| + | properties | ||
| + | |||
| + | documents | ||
| + | |||
| + | backups | ||
| + | |||
| + | exports | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | bucket = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.9 — DNS ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Route53 ===== | ||
| + | |||
| + | < | ||
| + | api.domain.com | ||
| + | |||
| + | app.domain.com | ||
| + | |||
| + | grafana.domain.com | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.10 — Certificats SSL ====== | ||
| + | |||
| + | ===== ACM ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Domaines ===== | ||
| + | |||
| + | < | ||
| + | *.domain.com | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.11 — Load Balancer ====== | ||
| + | |||
| + | ===== ALB ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Routing ===== | ||
| + | |||
| + | < | ||
| + | /api | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | NestJS | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | / | ||
| + | |||
| + | ↓ | ||
| + | |||
| + | NextJS | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.12 — Secrets Manager ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Secrets ===== | ||
| + | |||
| + | < | ||
| + | DATABASE_URL | ||
| + | |||
| + | JWT_SECRET | ||
| + | |||
| + | STRIPE_SECRET | ||
| + | |||
| + | MINIO_SECRET | ||
| + | |||
| + | OPENAI_API_KEY | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.13 — Monitoring ====== | ||
| + | |||
| + | ===== Module ===== | ||
| + | |||
| + | < | ||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | CloudWatch | ||
| + | |||
| + | Prometheus | ||
| + | |||
| + | Grafana | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Dashboards ===== | ||
| + | |||
| + | < | ||
| + | API | ||
| + | |||
| + | Database | ||
| + | |||
| + | Redis | ||
| + | |||
| + | Kubernetes | ||
| + | |||
| + | Business KPI | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.14 — Logging ====== | ||
| + | |||
| + | ===== Services ===== | ||
| + | |||
| + | < | ||
| + | CloudWatch Logs | ||
| + | |||
| + | Loki | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Collecte ===== | ||
| + | |||
| + | < | ||
| + | API Logs | ||
| + | |||
| + | Audit Logs | ||
| + | |||
| + | Security Logs | ||
| + | |||
| + | Job Logs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.15 — Alerting ====== | ||
| + | |||
| + | ===== Canaux ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | Slack | ||
| + | |||
| + | Teams | ||
| + | |||
| + | PagerDuty | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclencheurs ===== | ||
| + | |||
| + | < | ||
| + | CPU > 80% | ||
| + | |||
| + | Memory > 80% | ||
| + | |||
| + | API Down | ||
| + | |||
| + | Database Down | ||
| + | |||
| + | Failed Jobs | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.16 — WAF ====== | ||
| + | |||
| + | ===== Protection ===== | ||
| + | |||
| + | < | ||
| + | AWS WAF | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Règles ===== | ||
| + | |||
| + | < | ||
| + | SQL Injection | ||
| + | |||
| + | XSS | ||
| + | |||
| + | Rate Limit | ||
| + | |||
| + | Bots | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.17 — CloudFront ====== | ||
| + | |||
| + | ===== CDN ===== | ||
| + | |||
| + | <code terraform> | ||
| + | resource " | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Accélération ===== | ||
| + | |||
| + | < | ||
| + | Images | ||
| + | |||
| + | Documents | ||
| + | |||
| + | Frontend Assets | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.18 — Environnement DEV ====== | ||
| + | |||
| + | ===== Dossier ===== | ||
| + | |||
| + | < | ||
| + | environments/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Taille ===== | ||
| + | |||
| + | < | ||
| + | 1 node | ||
| + | |||
| + | Petite RDS | ||
| + | |||
| + | Petit Redis | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.19 — Environnement STAGING ====== | ||
| + | |||
| + | ===== Dossier ===== | ||
| + | |||
| + | < | ||
| + | environments/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Taille ===== | ||
| + | |||
| + | < | ||
| + | 2 nodes | ||
| + | |||
| + | Replica DB | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.20 — Environnement PROD ====== | ||
| + | |||
| + | ===== Dossier ===== | ||
| + | |||
| + | < | ||
| + | environments/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Taille ===== | ||
| + | |||
| + | < | ||
| + | 3+ nodes | ||
| + | |||
| + | Multi-AZ | ||
| + | |||
| + | Autoscaling | ||
| + | |||
| + | HA | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.21 — Variables Terraform ====== | ||
| + | |||
| + | ===== variables.tf ===== | ||
| + | |||
| + | <code terraform> | ||
| + | variable " | ||
| + | |||
| + | variable " | ||
| + | |||
| + | variable " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== terraform.tfvars ===== | ||
| + | |||
| + | <code terraform> | ||
| + | environment = " | ||
| + | |||
| + | domain_name = " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.22 — Outputs ====== | ||
| + | |||
| + | ===== outputs.tf ===== | ||
| + | |||
| + | <code terraform> | ||
| + | output " | ||
| + | |||
| + | output " | ||
| + | |||
| + | output " | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-I.23 — Validation ====== | ||
| + | |||
| + | ===== Format ===== | ||
| + | |||
| + | <code bash> | ||
| + | terraform fmt | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Validation ===== | ||
| + | |||
| + | <code bash> | ||
| + | terraform validate | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Plan ===== | ||
| + | |||
| + | <code bash> | ||
| + | terraform plan | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Apply ===== | ||
| + | |||
| + | <code bash> | ||
| + | terraform apply | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-I est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ VPC créé | ||
| + | |||
| + | ✓ EKS créé | ||
| + | |||
| + | ✓ PostgreSQL créé | ||
| + | |||
| + | ✓ Redis créé | ||
| + | |||
| + | ✓ S3 créé | ||
| + | |||
| + | ✓ DNS créé | ||
| + | |||
| + | ✓ SSL créé | ||
| + | |||
| + | ✓ Monitoring créé | ||
| + | |||
| + | ✓ Terraform validé | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables ====== | ||
| + | |||
| + | < | ||
| + | deploy/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | |||
| + | modules/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Phase 4-J — Monorepo Final Enterprise ====== | ||
| + | |||
| + | ===== Objectif ===== | ||
| + | |||
| + | Assembler l' | ||
| + | |||
| + | À l' | ||
| + | |||
| + | < | ||
| + | ✓ Monorepo finalisé | ||
| + | |||
| + | ✓ Backend NestJS | ||
| + | |||
| + | ✓ Frontend NextJS | ||
| + | |||
| + | ✓ Prisma | ||
| + | |||
| + | ✓ PostgreSQL | ||
| + | |||
| + | ✓ Redis | ||
| + | |||
| + | ✓ Contracts | ||
| + | |||
| + | ✓ SDK | ||
| + | |||
| + | ✓ Docker | ||
| + | |||
| + | ✓ Helm | ||
| + | |||
| + | ✓ Terraform | ||
| + | |||
| + | ✓ GitHub Actions | ||
| + | |||
| + | ✓ Documentation | ||
| + | </ | ||
| + | |||
| + | Le projet devient alors : | ||
| + | |||
| + | < | ||
| + | Release Enterprise 4.0 | ||
| + | </ | ||
| + | |||
| + | prête pour le développement métier continu. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Vision finale ====== | ||
| + | |||
| + | ===== Dépôt Git ===== | ||
| + | |||
| + | < | ||
| + | rental-platform/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Architecture ===== | ||
| + | |||
| + | < | ||
| + | rental-platform | ||
| + | |||
| + | ├── apps | ||
| + | |||
| + | ├── libs | ||
| + | |||
| + | ├── deploy | ||
| + | |||
| + | ├── docker | ||
| + | |||
| + | ├── docs | ||
| + | |||
| + | ├── scripts | ||
| + | |||
| + | ├── .github | ||
| + | |||
| + | ├── package.json | ||
| + | |||
| + | ├── nx.json | ||
| + | |||
| + | ├── tsconfig.base.json | ||
| + | |||
| + | └── README.md | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.1 — Applications ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | apps | ||
| + | |||
| + | ├── api | ||
| + | |||
| + | └── web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | < | ||
| + | apps/api | ||
| + | |||
| + | ├── prisma | ||
| + | |||
| + | ├── src | ||
| + | |||
| + | ├── test | ||
| + | |||
| + | ├── Dockerfile | ||
| + | |||
| + | └── project.json | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== WEB ===== | ||
| + | |||
| + | < | ||
| + | apps/web | ||
| + | |||
| + | ├── src | ||
| + | |||
| + | ├── public | ||
| + | |||
| + | ├── Dockerfile | ||
| + | |||
| + | └── project.json | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.2 — Librairies ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | libs | ||
| + | |||
| + | ├── contracts | ||
| + | |||
| + | ├── sdk | ||
| + | |||
| + | ├── ui | ||
| + | |||
| + | ├── config | ||
| + | |||
| + | ├── shared | ||
| + | |||
| + | ├── testing | ||
| + | |||
| + | └── eslint-config | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== contracts ===== | ||
| + | |||
| + | < | ||
| + | DTO | ||
| + | |||
| + | Types | ||
| + | |||
| + | Enums | ||
| Zod Schemas | Zod Schemas | ||
| + | </ | ||
| - | OpenAPI Models | + | ---- |
| - | Validation Classes | + | ===== sdk ===== |
| + | |||
| + | < | ||
| + | OpenAPI Client | ||
| + | |||
| + | React Query Hooks | ||
| + | |||
| + | API Wrappers | ||
| </ | </ | ||
| - | à partir | + | ---- |
| + | |||
| + | ===== ui ===== | ||
| + | |||
| + | < | ||
| + | Design System | ||
| + | |||
| + | Layout Components | ||
| + | |||
| + | Business Components | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.3 — Infrastructure ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | deploy | ||
| + | |||
| + | ├── helm | ||
| + | |||
| + | └── terraform | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Helm ===== | ||
| + | |||
| + | < | ||
| + | deploy/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Terraform ===== | ||
| + | |||
| + | < | ||
| + | deploy/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.4 — Docker ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | docker | ||
| + | |||
| + | ├── nginx | ||
| + | |||
| + | ├── postgres | ||
| + | |||
| + | ├── redis | ||
| + | |||
| + | ├── minio | ||
| + | |||
| + | ├── prometheus | ||
| + | |||
| + | └── grafana | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Fichier principal ===== | ||
| + | |||
| + | < | ||
| + | docker-compose.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.5 — GitHub ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | .github | ||
| + | |||
| + | ├── workflows | ||
| + | |||
| + | └── dependabot.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Workflows ===== | ||
| + | |||
| + | < | ||
| + | ci.yml | ||
| + | |||
| + | quality.yml | ||
| + | |||
| + | security.yml | ||
| + | |||
| + | docker.yml | ||
| + | |||
| + | release.yml | ||
| + | |||
| + | deploy.yml | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.6 — Scripts ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | scripts | ||
| + | |||
| + | ├── bootstrap.sh | ||
| + | |||
| + | ├── migrate.sh | ||
| + | |||
| + | ├── seed.sh | ||
| + | |||
| + | ├── reset-db.sh | ||
| + | |||
| + | ├── generate-sdk.sh | ||
| + | |||
| + | ├── generate-openapi.sh | ||
| + | |||
| + | └── release.sh | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== bootstrap.sh ===== | ||
| + | |||
| + | Objectif : | ||
| + | |||
| + | < | ||
| + | Installation complète développeur | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | |||
| + | <code bash> | ||
| + | # | ||
| + | |||
| + | npm install | ||
| + | |||
| + | docker compose up -d | ||
| + | |||
| + | npx prisma migrate dev | ||
| + | |||
| + | npx prisma db seed | ||
| + | |||
| + | nx run-many --target=build | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.7 — Documentation ====== | ||
| + | |||
| + | ===== Structure ===== | ||
| + | |||
| + | < | ||
| + | docs | ||
| + | |||
| + | ├── architecture | ||
| + | |||
| + | ├── api | ||
| + | |||
| + | ├── deployment | ||
| + | |||
| + | ├── development | ||
| + | |||
| + | ├── operations | ||
| + | |||
| + | └── decisions | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Architecture ===== | ||
| + | |||
| + | < | ||
| + | DDD | ||
| + | |||
| + | CQRS | ||
| + | |||
| + | Hexagonal | ||
| + | |||
| + | Multi-Tenant | ||
| + | |||
| + | RBAC | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== API ===== | ||
| + | |||
| + | < | ||
| + | OpenAPI | ||
| + | |||
| + | Swagger | ||
| + | |||
| + | SDK | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.8 — README principal ====== | ||
| + | |||
| + | ===== Sections ===== | ||
| + | |||
| + | < | ||
| + | Présentation | ||
| + | |||
| + | Architecture | ||
| + | |||
| + | Prérequis | ||
| + | |||
| + | Installation | ||
| + | |||
| + | Développement | ||
| + | |||
| + | Tests | ||
| + | |||
| + | Déploiement | ||
| + | |||
| + | Contribution | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Démarrage rapide ===== | ||
| + | |||
| + | <code bash> | ||
| + | git clone ... | ||
| + | |||
| + | cd rental-platform | ||
| + | |||
| + | npm install | ||
| + | |||
| + | docker compose up -d | ||
| + | |||
| + | npx prisma migrate dev | ||
| + | |||
| + | npx prisma db seed | ||
| + | |||
| + | nx serve api | ||
| + | |||
| + | nx serve web | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.9 — Qualité globale ====== | ||
| + | |||
| + | ===== Vérifications ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx graph | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Lint ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx run-many \ | ||
| + | --target=lint \ | ||
| + | --all | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tests ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx run-many \ | ||
| + | --target=test \ | ||
| + | --all | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Build ===== | ||
| + | |||
| + | <code bash> | ||
| + | nx run-many \ | ||
| + | --target=build \ | ||
| + | --all | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.10 — Génération OpenAPI ====== | ||
| + | |||
| + | ===== Commande ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm run swagger: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Livrable ===== | ||
| + | |||
| + | < | ||
| + | docs/ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.11 — Génération SDK ====== | ||
| + | |||
| + | ===== Commande ===== | ||
| + | |||
| + | <code bash> | ||
| + | npm run sdk: | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Livrable ===== | ||
| + | |||
| + | < | ||
| + | libs/sdk | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Étape 4-J.12 — Release Enterprise ====== | ||
| + | |||
| + | ===== Version ===== | ||
| + | |||
| + | < | ||
| + | v1.0.0 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Tag Git ===== | ||
| + | |||
| + | <code bash> | ||
| + | git tag v1.0.0 | ||
| + | |||
| + | git push origin v1.0.0 | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Déclenche ===== | ||
| + | |||
| + | < | ||
| + | Release GitHub | ||
| + | |||
| + | Build Docker | ||
| + | |||
| + | Publication Registry | ||
| + | |||
| + | Artifacts | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Arborescence finale ====== | ||
| + | |||
| + | < | ||
| + | rental-platform | ||
| + | |||
| + | ├── apps | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── libs | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── deploy | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | │ | ||
| + | ├── docker | ||
| + | │ | ||
| + | ├── docs | ||
| + | │ | ||
| + | ├── scripts | ||
| + | │ | ||
| + | ├── .github | ||
| + | │ | ||
| + | ├── docker-compose.yml | ||
| + | │ | ||
| + | ├── package.json | ||
| + | │ | ||
| + | ├── nx.json | ||
| + | │ | ||
| + | └── README.md | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Définition de terminé ====== | ||
| + | |||
| + | La Phase 4-J est terminée lorsque : | ||
| + | |||
| + | < | ||
| + | ✓ Monorepo compilable | ||
| + | |||
| + | ✓ API compilable | ||
| + | |||
| + | ✓ Frontend compilable | ||
| + | |||
| + | ✓ Prisma opérationnel | ||
| + | |||
| + | ✓ Docker opérationnel | ||
| + | |||
| + | ✓ CI opérationnelle | ||
| + | |||
| + | ✓ Helm valide | ||
| + | |||
| + | ✓ Terraform valide | ||
| + | |||
| + | ✓ OpenAPI généré | ||
| + | |||
| + | ✓ SDK généré | ||
| + | |||
| + | ✓ Documentation présente | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Livrables finaux ====== | ||
| + | |||
| + | < | ||
| + | Repository Enterprise complet | ||
| + | |||
| + | Backend NestJS | ||
| + | |||
| + | Frontend NextJS | ||
| + | |||
| + | Prisma | ||
| + | |||
| + | Contracts | ||
| + | |||
| + | SDK | ||
| + | |||
| + | Docker | ||
| + | |||
| + | GitHub Actions | ||
| + | |||
| + | Helm | ||
| + | |||
| + | Terraform | ||
| + | |||
| + | Documentation | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ====== Fin du cycle d' | ||
| + | |||
| + | Le projet dispose désormais de : | ||
| + | |||
| + | < | ||
| + | Architecture fonctionnelle | ||
| + | |||
| + | Architecture technique | ||
| + | |||
| + | Contrat API | ||
| + | |||
| + | Modèle de données | ||
| + | |||
| + | Infrastructure | ||
| + | |||
| + | CI/CD | ||
| + | |||
| + | Industrialisation | ||
| + | </ | ||
| + | |||
| + | La suite logique n'est plus la conception. | ||
| + | |||
| + | La suite logique est : | ||
| + | |||
| + | ===== Sprint Développement 1 ===== | ||
| + | |||
| + | Implémentation réelle du domaine Authentification | ||
| + | |||
| + | < | ||
| + | Register | ||
| + | |||
| + | Login | ||
| + | |||
| + | JWT | ||
| + | |||
| + | Refresh Token | ||
| + | |||
| + | RBAC | ||
| + | |||
| + | Swagger | ||
| + | |||
| + | Tests | ||
| + | </ | ||
| + | |||
| + | sur la base du monorepo désormais entièrement structuré et prêt à exécuter | ||
ujusum/3-codage/1-repository/4-code.1780874539.txt.gz · Dernière modification : 2026/06/08 01:22 de admin