# 🏗️ REPORT_ARCHITECTURE.md - Cartographie Technique ## 1. Architecture des Services ### 🟢 Service: Backend API (`veza-backend-api`) * **Rôle:** Cœur de métier, gestion utilisateurs, metadata, catalogue. * **Langage:** Go (Golang). * **Framework:** Gin Gonic. * **Data:** GORM + PostgreSQL. * **Observation:** Gère la logique métier lourde. A subi une refonte massive vers UUID. ### 🔵 Service: Chat Server (`veza-chat-server`) * **Rôle:** Messagerie temps-réel, présence, WebSockets. * **Langage:** Rust. * **Framework:** Axum + Tokio. * **Data:** SQLx + PostgreSQL + Redis (Cache). * **Dépendances:** Très riche (`jsonwebtoken`, `argon2`, `tonic` gRPC). * **Observation:** Architecture très propre, moderne, orientée performance. ### 🟣 Service: Stream Server (`veza-stream-server`) * **Rôle:** Streaming audio haute performance, transcodage. * **Langage:** Rust. * **Framework:** Axum + Symphonia (Audio). * **Observation:** Utilise `rayon` pour le parallélisme. Service critique pour l'expérience utilisateur. ## 2. Architecture Frontend (Le Conflit) ### 🅰️ Apps/Web (`apps/web`) - **LA CIBLE** * **Stack:** React 18, Vite, TailwindCSS, Zustand, TanStack Query, Radix UI. * **Qualité:** Très haute. Utilise les standards modernes (hooks, composants atomiques, `shadcn/ui` like). * **Rôle:** Web App principale. ### 🅱️ Veza Desktop (`veza-desktop`) - **LEGACY?** * **Stack:** Electron, React (plus ancien), Redux (vs Zustand sur web). * **Problème:** Semble être une implémentation parallèle et non un wrapper de `apps/web`. * **Risque:** Double maintenance des features. ## 3. Données & Infrastructure ### Base de Données (PostgreSQL) * Architecture distribuée ou monolithique logique ? * **Problème:** `veza-backend-api` et `veza-chat-server` ont chacun leur dossier `migrations/`. * **Risque:** Désynchronisation des schémas (ex: table `users` définie à deux endroits ?). ### Communication Inter-Services * Preuves de **gRPC** (`tonic`) dans les fichiers Cargo. * Preuves de **RabbitMQ** (`lapin`) mentionné. ## 4. Diagramme de Flux (Simplifié) ```mermaid graph TD Client[Clients (Web/Desktop/Mobile)] --> HAProxy[HAProxy / Load Balancer] HAProxy --> Go[Go Backend API] HAProxy --> Chat[Rust Chat Server] HAProxy --> Stream[Rust Stream Server] Go --> DB[(PostgreSQL Core)] Chat --> DB Chat --> Redis[(Redis Cache)] Stream --> FS[File System / S3] Go -.-> RabbitMQ((RabbitMQ Event Bus)) Chat -.-> RabbitMQ ```