# blake-mealey/mantle architecture

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

- Interactive diagram: https://gitdiagram.com/blake-mealey/mantle
- Repository: https://github.com/blake-mealey/mantle

## Overview

##### Main Components Identification

a. Core Components:
- CLI Application (mantle/mantle/)
- Roblox API Integration (mantle/rbx_api/)
- Authentication System (mantle/rbx_auth/)
- Cookie Management (mantle/rbx_cookie/)
- Core Library (mantle/rbx_mantle/)
- Documentation System (docs/)

**User Interface Layer**

**Command Layer**

**Core Services Layer**

**External Services Layer**

##### Specific Component Relationships

a. User Interface Layer:
- CLI Interface (mantle/mantle/src/cli.rs)
- Commands (mantle/mantle/src/commands/)
- deploy
- destroy
- diff
- download
- import
- outputs
- upload

b. Core Services Layer:
- Resource Management (rbx_mantle/src/resource_graph.rs)
- State Management (rbx_mantle/src/state/)
- Project Configuration (rbx_mantle/src/config.rs)
- Authentication Services (rbx_auth)

c. External Services Layer:
- Roblox API Integration (rbx_api)
- Assets
- Experiences
- Places
- Game Passes
- Developer Products
- Thumbnails
- Remote State Storage
- AWS S3
- Cloudflare R2

##### Important Flows to Highlight

- Authentication flow (rbx_auth → rbx_cookie → Roblox API)
- Deployment flow (CLI → Resource Manager → Roblox API)
- State management flow (Project → State Storage → Remote Backend)

##### Additional Elements

Supporting components:
- Configuration schema (specs/)
- Integration tests workflow
- Documentation generation pipeline

##### Specific Implementation Details

- Version management for state (v1 through v6)
- Resource graph relationships
- API endpoint groupings
- Authentication chain

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef auth fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef api fill:#9b59b6,stroke:#8e44ad,color:white
    classDef state fill:#1abc9c,stroke:#16a085,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black

    %% User Interface Layer
    subgraph UI
        CLI["CLI Interface"]:::ui
    end
    click CLI "https://github.com/blake-mealey/mantle/blob/main/mantle/mantle/src/cli.rs"

    %% Command Layer
    subgraph Commands
        CMD["Command Layer"]:::ui
        Deploy["deploy"]:::ui
        Destroy["destroy"]:::ui
        Diff["diff"]:::ui
        Download["download"]:::ui
        Import["import"]:::ui
        Outputs["outputs"]:::ui
        Upload["upload"]:::ui
    end
    click CMD "https://github.com/blake-mealey/mantle/tree/main/mantle/mantle/src/commands/"

    %% Core Services Layer
    subgraph Core
        ResourceMgr["Resource Management"]:::core
        StateMgr["State Management"]:::core
        ProjectConfig["Project Configuration"]:::core
        Auth["Authentication Services"]:::auth
        Cookie["Cookie Management"]:::auth
    end
    click ResourceMgr "https://github.com/blake-mealey/mantle/blob/main/mantle/rbx_mantle/src/resource_graph.rs"
    click StateMgr "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_mantle/src/state/"
    click ProjectConfig "https://github.com/blake-mealey/mantle/blob/main/mantle/rbx_mantle/src/config.rs"
    click Auth "https://github.com/blake-mealey/mantle/blob/main/mantle/rbx_auth/src/lib.rs"
    click Cookie "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_cookie/src/"

    %% External Services Layer
    subgraph External
        RobloxAPI["Roblox API Integration"]:::api
        subgraph "API Services"
            Assets["Assets"]:::api
            Experiences["Experiences"]:::api
            Places["Places"]:::api
            GamePasses["Game Passes"]:::api
            DevProducts["Developer Products"]:::api
            Thumbnails["Thumbnails"]:::api
        end
        
        subgraph "Remote Storage"
            S3["AWS S3"]:::external
            R2["Cloudflare R2"]:::external
        end
    end
    click RobloxAPI "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/"
    click Assets "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/assets/"
    click Experiences "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/experiences/"
    click Places "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/places/"
    click GamePasses "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/game_passes/"
    click DevProducts "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/developer_products/"
    click Thumbnails "https://github.com/blake-mealey/mantle/tree/main/mantle/rbx_api/src/thumbnails/"

    %% Supporting Components
    ConfigSchema["Configuration Schema"]:::config
    IntegrationTests["Integration Tests"]:::external
    Documentation["Documentation System"]:::external
    click ConfigSchema "https://github.com/blake-mealey/mantle/blob/main/mantle/specs/schema.json"
    click IntegrationTests "https://github.com/blake-mealey/mantle/blob/main/.github/workflows/integration-tests.yml"
    click Documentation "https://github.com/blake-mealey/mantle/tree/main/docs/site/"

    %% Relationships
    CLI --> CMD
    CMD --> Deploy & Destroy & Diff & Download & Import & Outputs & Upload
    Deploy & Destroy & Diff & Download & Import & Outputs & Upload --> ResourceMgr
    ResourceMgr --> StateMgr
    StateMgr --> S3 & R2
    ResourceMgr --> RobloxAPI
    RobloxAPI --> Assets & Experiences & Places & GamePasses & DevProducts & Thumbnails
    Auth --> Cookie
    Cookie --> RobloxAPI
    ProjectConfig --> ResourceMgr
    ConfigSchema -.-> ProjectConfig

    %% Legend
    subgraph Legend
        L1["UI Components"]:::ui
        L2["Core Services"]:::core
        L3["Authentication"]:::auth
        L4["External Services"]:::external
        L5["API Services"]:::api
        L6["State Management"]:::state
        L7["Configuration"]:::config
    end
```
