1. System Overview

This game is a real-time, competitive, move-to-earn GPS game. Its architecture is designed as a scalable microservices system to ensure a fast, responsive user experience for gameplay, while leveraging the Very Network blockchain for security, trust, and rewards.

High-Level Architecture Diagram

graph TD
    subgraph "User Layer"
        A[Mobile Web App]
    end

    subgraph "Infrastructure"
        LB[Load Balancer]
    end

    subgraph "Backend Microservices"
        API[API Gateway]

        subgraph "Real-Time Services"
            GLS[Game Logic Service]
            WS[WebSocket Service]
        end

        subgraph "Asynchronous Services"
            US[User Service]
            BS[Blockchain Service]
            NS[Notification Service]
        end
    end

    subgraph "Data & Caching Layer"
        DB[(PostgreSQL Database)]
        Cache[(Redis Cache)]
        MQ([Message Queue <br/> e.g., RabbitMQ])
    end

    subgraph "Very Ecosystem (Decentralized)"
        VN[Very Network Blockchain]
        SC[Smart Contract <br/> Scores & Rewards]
        VAPI[Verychat API]
    end

    %% Connections
    A --> LB
    LB --> API

    API -- "HTTP Requests (Login, Profile)" --> US
    API -- "WebSocket Connection" --> WS

    WS -- "Live GPS Data" --> GLS
    GLS -- "Game State Updates" --> WS

    GLS -- "Player Location Data" --> Cache
    GLS -- "Read/Write Leaderboards" --> DB

    US -- "User Profiles, Wallets" --> DB

    GLS -- "Event: Bank Points" --> MQ
    MQ -- "Consume: Bank Points" --> BS

    GLS -- "Event: Line Broken" --> MQ
    MQ -- "Consume: Line Broken" --> NS

    BS -- "Update Score / Distribute Rewards" --> SC
    SC -- "On-Chain Events" --> VN
    NS -- "Send Notification" --> VAPI
    VAPI -- "Push to User" --> A

2. Detailed Component Breakdown

2.1 User Layer: The Mobile App

2.2 Infrastructure

2.3 Backend Microservices

This is the core engine of the game, broken into specialized, independent services.

2.4 Data & Caching Layer