# aiwhispererdev/the_tribe architecture

> Architecture diagram of the GitHub repository aiwhispererdev/the_tribe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aiwhispererdev/the_tribe
- Repository: https://github.com/aiwhispererdev/the_tribe

## Overview

##### Main Components

A. Frontend Layer:
- React Application (built with Vite)
- Key Components:
- Wallet Connection Interface
- Game UI Components
- Tribe Management Interface
- State Management & Blockchain Integration

B. Blockchain Layer:
- Aptos Network
- Smart Contract (Move)
- NFT Storage
- Transaction Management

C. Game Logic Layer:
- Gorilla Management System
- Tribe Scoring System
- Evolution Mechanics
- Cooldown Management

**[User Interface Layer]**
- ↕
**[Blockchain Integration Layer]**
- ↕
**[Smart Contract Layer]**

##### Detailed Component Breakdown

Frontend Components (Top Layer):
**┌─ User Interface ─────────────────┐**
- WalletConnector               │
- CryptoGorillaGame            │
- GorillaCard                  │
- TribeStats                   │
- Header                       │
- ┘

Middleware/Integration Layer:
**┌─ Blockchain Integration ─────────┐**
- Aptos SDK                     │
- Wallet Adapters               │
- Transaction Handlers          │
- ┘

Smart Contract Layer:
**┌─ Game Logic (Move Contract) ─────┐**
- Minting Logic                 │
- Evolution System              │
- Tribe Management              │
- Scoring Calculator            │
- ┘

##### Data Flow Indicators

- User interactions → Frontend
- Frontend ↔ Blockchain Integration
- Blockchain Integration ↔ Smart Contract
- Smart Contract ↔ Aptos Network

##### Technical Stack Callouts

- React + Vite
- Chakra UI
- Move Language
- Aptos Framework
- Wallet Adapters

##### Key Interactions to Highlight

- Minting process flow
- Evolution mechanism
- Tribe score calculation
- Wallet connection flow
- Transaction handling

##### Additional Elements

Subsystems for:
- Asset management (NFT images)
- State management
- Error handling
- Transaction monitoring

This system design should emphasize the blockchain-specific aspects while showing how they integrate with traditional web application components, creating a complete picture of this Web3 gaming application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User
        U[User/Player]
    end

    subgraph "Frontend Layer"
        UI[React Application]:::frontend
        WC[Wallet Connector]:::frontend
        GG[CryptoGorillaGame]:::frontend
        GC[GorillaCard]:::frontend
        TS[TribeStats]:::frontend
        HD[Header]:::frontend
    end

    subgraph "Blockchain Integration"
        SDK[Aptos SDK]:::integration
        WA[Wallet Adapters]:::integration
        TH[Transaction Handlers]:::integration
    end

    subgraph "Smart Contract Layer"
        ML[Minting Logic]:::contract
        ES[Evolution System]:::contract
        TM[Tribe Management]:::contract
        SC[Scoring Calculator]:::contract
    end

    subgraph "External Services"
        AN[Aptos Network]:::external
        NS[NFT Storage]:::external
    end

    %% User Interactions
    U --> UI
    U --> WC

    %% Frontend Connections
    UI --> WC
    UI --> GG
    UI --> HD
    GG --> GC
    GG --> TS

    %% Integration Layer
    WC --> SDK
    WC --> WA
    GG --> TH
    TH --> SDK

    %% Smart Contract Interactions
    SDK --> ML
    SDK --> ES
    SDK --> TM
    SDK --> SC

    %% External Service Connections
    ML --> AN
    ES --> AN
    TM --> AN
    SC --> AN
    ML --> NS

    %% Click Events
    click UI "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/App.tsx"
    click WC "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/components/WalletConnector.tsx"
    click GG "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/components/CryptoGorillaGame.tsx"
    click GC "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/components/GorillaCard.tsx"
    click TS "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/components/TribeStats.tsx"
    click HD "https://github.com/AIWhispererDev/The_Tribe/blob/main/frontend/src/components/Header.tsx"
    click ML "https://github.com/AIWhispererDev/The_Tribe/blob/main/contract/sources/gorilla_game_module.move"
    click ES "https://github.com/AIWhispererDev/The_Tribe/blob/main/contract/sources/gorilla_game_module.move"
    click TM "https://github.com/AIWhispererDev/The_Tribe/blob/main/contract/sources/gorilla_game_module.move"
    click SC "https://github.com/AIWhispererDev/The_Tribe/blob/main/contract/sources/gorilla_game_module.move"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef integration fill:#2ecc71,stroke:#27ae60,color:white
    classDef contract fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Blockchain Integration]:::integration
        L3[Smart Contract]:::contract
        L4[External Services]:::external
    end
```
