graph TB
    %% Frontend
    subgraph "Frontend (React)"
        UI[Interface Utilisateur]
    end

    %% API Gateway / Load Balancer
    subgraph "API Gateway"
        LB[Load Balancer / Nginx]
    end

    %% Backend API (Go)
    subgraph "Backend API (Go/Gin)"
        API[API REST v1]
        Auth[Auth Service]
        User[User Service]
        Track[Track Service]
        Listing[Listing Service]
        Offer[Offer Service]
        Message[Message Service]
        Room[Room Service]
        Search[Search Service]
        Tag[Tag Service]
        Shared[Shared Resources]
        ChatAPI[Chat API]
        Admin[Admin Service]
    end

    %% Chat Server (Rust)
    subgraph "Chat Server (Rust/Tokio)"
        ChatWS[WebSocket Server]
        ChatAuth[Authentication]
        ChatMod[Moderation]
        ChatPres[Presence]
        ChatCache[Message Cache]
        ChatStore[Message Store]
    end

    %% Stream Server (Rust)
    subgraph "Stream Server (Rust/Axum)"
        StreamAPI[Streaming API]
        AudioProc[Audio Processing]
        Transcode[Transcoding]
        HLS[HLS/DASH]
        Codecs[Codec Support]
        Analytics[Stream Analytics]
    end

    %% Infrastructure
    subgraph "Infrastructure"
        PG[(PostgreSQL)]
        Redis[(Redis Cache)]
        NATS[NATS Message Queue]
        Prom[Prometheus]
        Grafana[Grafana]
    end

    %% External Services
    subgraph "External Services"
        Stripe[Stripe Payment]
        PayPal[PayPal]
        Email[Email Service]
        Storage[Object Storage]
        CDN[CDN]
    end

    %% Connections
    UI --> LB
    LB --> API
    LB --> ChatWS
    LB --> StreamAPI

    API --> Auth
    API --> User
    API --> Track
    API --> Listing
    API --> Offer
    API --> Message
    API --> Room
    API --> Search
    API --> Tag
    API --> Shared
    API --> ChatAPI
    API --> Admin

    ChatAPI --> ChatWS
    ChatWS --> ChatAuth
    ChatWS --> ChatMod
    ChatWS --> ChatPres
    ChatWS --> ChatCache
    ChatWS --> ChatStore

    StreamAPI --> AudioProc
    StreamAPI --> Transcode
    StreamAPI --> HLS
    StreamAPI --> Codecs
    StreamAPI --> Analytics

    %% Database Connections
    API --> PG
    ChatWS --> PG
    StreamAPI --> PG
    API --> Redis
    ChatWS --> Redis
    StreamAPI --> Redis

    %% Message Queue
    API --> NATS
    ChatWS --> NATS
    StreamAPI --> NATS

    %% Monitoring
    API --> Prom
    ChatWS --> Prom
    StreamAPI --> Prom
    Prom --> Grafana

    %% External Integrations
    API --> Stripe
    API --> PayPal
    API --> Email
    API --> Storage
    StreamAPI --> Storage
    StreamAPI --> CDN

    %% Styling
    classDef goService fill:#00ADD8,stroke:#333,stroke-width:2px,color:#fff
    classDef rustService fill:#DEA584,stroke:#333,stroke-width:2px,color:#fff
    classDef infra fill:#4A90E2,stroke:#333,stroke-width:2px,color:#fff
    classDef external fill:#F5A623,stroke:#333,stroke-width:2px,color:#fff

    class API,Auth,User,Track,Listing,Offer,Message,Room,Search,Tag,Shared,ChatAPI,Admin goService
    class ChatWS,ChatAuth,ChatMod,ChatPres,ChatCache,ChatStore,StreamAPI,AudioProc,Transcode,HLS,Codecs,Analytics rustService
    class PG,Redis,NATS,Prom,Grafana,LB infra
    class Stripe,PayPal,Email,Storage,CDN external 