graph TB
    subgraph Host["Host Machine<br/>Docker Compose Environment"]
        Docker["🐳 Docker Engine"]
    end

    subgraph Services["Services & Containers"]
        subgraph Frontend_svc["Frontend Service"]
            NJS["Next.js 14<br/>Container<br/>Port: 3000<br/>Volume: ./frontend"]
        end

        subgraph API_svc["Backend API Service"]
            NESTJS["NestJS<br/>Container<br/>Port: 3001<br/>Volume: ./backend<br/>Env: DB_HOST,<br/>BLOCKCHAIN_RPC"]
        end

        subgraph Database_svc["Database Service"]
            PG["PostgreSQL 15<br/>Container<br/>Port: 5432<br/>Volume: postgres_data<br/>POSTGRES_DB: goa_gel<br/>POSTGRES_USER: gel_user"]
        end

        subgraph Cache_svc["Cache Service"]
            REDIS["Redis 7<br/>Container<br/>Port: 6379<br/>Volume: redis_data"]
        end

        subgraph Storage_svc["File Storage Service"]
            MINIO["MinIO<br/>Container<br/>Port: 9000 API<br/>Port: 9001 Console<br/>Volume: minio_data<br/>Access: minioadmin<br/>Secret: minioadmin"]
        end

        subgraph Blockchain_svc["Blockchain Network"]
            BESU1["Besu Validator 1<br/>Container<br/>Port: 8545 RPC<br/>Port: 30303 P2P<br/>Volume: besu_data_1"]
            BESU2["Besu Validator 2<br/>Container<br/>Port: 8546 RPC<br/>Port: 30304 P2P<br/>Volume: besu_data_2"]
            BESU3["Besu Validator 3<br/>Container<br/>Port: 8547 RPC<br/>Port: 30305 P2P<br/>Volume: besu_data_3"]
            BESU4["Besu Validator 4<br/>Container<br/>Port: 8548 RPC<br/>Port: 30306 P2P<br/>Volume: besu_data_4"]
        end

        subgraph Monitoring_svc["Monitoring & Logging"]
            PROMETHEUS["Prometheus<br/>Port: 9090"]
            GRAFANA["Grafana<br/>Port: 3000 Alt<br/>Volume: grafana_storage"]
        end
    end

    subgraph Network["Docker Network"]
        COMPOSE_NET["gel-network<br/>Driver: bridge"]
    end

    subgraph Volumes["Named Volumes"]
        PG_VOL["postgres_data"]
        REDIS_VOL["redis_data"]
        MINIO_VOL["minio_data"]
        BESU_VOL1["besu_data_1"]
        BESU_VOL2["besu_data_2"]
        BESU_VOL3["besu_data_3"]
        BESU_VOL4["besu_data_4"]
        GRAFANA_VOL["grafana_storage"]
    end

    subgraph Config["Configuration Files"]
        COMPOSE["docker-compose.yml"]
        ENV[".env<br/>BLOCKCHAIN_RPC<br/>DB_PASSWORD<br/>API_SECRET_KEY"]
        BESU_CONFIG["besu/config.toml<br/>genesis.json<br/>ibft_config.toml"]
    end

    Docker -->|Run| Services
    Services -->|Connect via| COMPOSE_NET

    NJS -->|HTTP Client| NESTJS
    NESTJS -->|SQL Query| PG
    NESTJS -->|Cache| REDIS
    NESTJS -->|S3 API| MINIO
    NESTJS -->|RPC Call| BESU1

    BESU1 -->|Peer| BESU2
    BESU1 -->|Peer| BESU3
    BESU1 -->|Peer| BESU4
    BESU2 -->|Peer| BESU3
    BESU2 -->|Peer| BESU4
    BESU3 -->|Peer| BESU4

    PG -->|Store| PG_VOL
    REDIS -->|Store| REDIS_VOL
    MINIO -->|Store| MINIO_VOL
    BESU1 -->|Store| BESU_VOL1
    BESU2 -->|Store| BESU_VOL2
    BESU3 -->|Store| BESU_VOL3
    BESU4 -->|Store| BESU_VOL4
    GRAFANA -->|Store| GRAFANA_VOL

    PROMETHEUS -->|Scrape| NESTJS
    PROMETHEUS -->|Scrape| BESU1
    GRAFANA -->|Query| PROMETHEUS

    ENV -->|Configure| NESTJS
    ENV -->|Configure| PG
    BESU_CONFIG -->|Configure| BESU1
    BESU_CONFIG -->|Configure| BESU2
    BESU_CONFIG -->|Configure| BESU3
    BESU_CONFIG -->|Configure| BESU4

    style Host fill:#1f2937,stroke:#111827,stroke-width:2px,color:#fff
    style Services fill:#374151,stroke:#1f2937,stroke-width:2px,color:#fff
    style Blockchain_svc fill:#dc2626,stroke:#991b1b,stroke-width:2px,color:#fff
    style Network fill:#06b6d4,stroke:#0891b2,stroke-width:2px,color:#fff
    style Volumes fill:#8b5cf6,stroke:#6d28d9,stroke-width:2px,color:#fff
    style Config fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff
