# kirilltregubov/overbuddy architecture

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

- Interactive diagram: https://gitdiagram.com/kirilltregubov/overbuddy
- Repository: https://github.com/kirilltregubov/overbuddy

## Overview

##### Main Components Identification
The system consists of two primary architectural layers:

A. Frontend (React/Vite Application):
- Located in the `/src` directory
- Uses TanStack Router (evident from routeTree.gen.ts)
- Implements a component-based architecture
- Utilizes Tailwind CSS for styling

B. Backend (Tauri Rust Application):
- Located in `/src-tauri`
- Handles file system operations
- Manages platform-specific configurations
- Interfaces with game clients

##### Key Architectural Elements

a) User Interface Layer:
- Main routes (/setup, /menu, /settings)
- Core components (AlertDialog, Button, etc.)
- State management and utilities

b) Tauri Bridge Layer:
- Commands interface between Frontend and Backend
- IPC (Inter-Process Communication) channels

c) Backend Services:
- Configuration management (config.rs)
- Background handling (backgrounds.rs)
- Platform-specific operations (platforms.rs)
- File system interactions

d) External Systems:
- Battle.net client integration
- Steam client integration
- Game configuration files

**┌─ User Interface Layer ─────────────────┐**

- Routes  ←→  Components  ←→  Utilities│
- ↕           ↕            ↕        │
- Tauri Bridge ─────────────┤
- ↕                     │
- Rust Backend ─────────────┤

- Config Manager ←→ Platform Services   │
- ↕               ↕              │
- Background Manager  File System Ops   │
- ↓               ↓           │
- ┘
- ↓               ↓               ↓
**┌─────────┐    ┌─────────┐    ┌─────────┐**
- Battle.net│    │ Steam   │    │Overwatch│
- Client   │    │ Client  │    │Config   │
- ┘    └─────────┘    └─────────┘

##### Important Flows to Highlight

a) Configuration Flow:
- User selection → Frontend → Tauri bridge → Backend → Client configs

b) Background Management Flow:
- Background selection → Frontend → Backend → File system operations

c) Platform Detection Flow:
- System check → Platform services → Client detection → UI updates

##### Implementation Notes

Callouts for:
- Cross-platform considerations
- File system permissions
- Client detection mechanisms
- Background asset management

This system design should effectively communicate OverBuddy's architecture while highlighting its key features: background customization, multi-platform support, and seamless integration with game clients.

Remember to emphasize the separation between the UI layer and system-level operations, as this is crucial for maintaining security and stability when modifying game client configurations.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        direction TB
        Routes["Routes"]
        Components["Core Components"]
        Utils["Utilities"]
        
        subgraph Routes
            Setup["Setup Route"]
            Menu["Menu Route"]
            Settings["Settings Route"]
        end

        subgraph Components
            Alert["Alert Dialog"]
            Error["Error Handler"]
            Loading["Loading States"]
            Progress["Progress Indicator"]
            Steam["Steam Profile"]
        end

        subgraph Utils
            ErrorUtils["Error Utilities"]
            DataUtils["Data Management"]
            UtilFuncs["Utility Functions"]
        end
    end

    subgraph Bridge["Tauri Bridge Layer"]
        IPC["IPC Channels"]
        Commands["Commands Interface"]
    end

    subgraph Backend["Rust Backend Layer"]
        ConfigMgr["Configuration Manager"]
        BgMgr["Background Manager"]
        PlatformSvc["Platform Services"]
        FSOps["File System Operations"]
        Helpers["Helper Functions"]
    end

    subgraph External["External Systems"]
        BNet["Battle.net Client"]
        Steam["Steam Client"]
        OWConfig["Overwatch Config"]
    end

    %% Relationships
    Routes <--> Components
    Components <--> Utils
    Routes <--> Utils

    UI <--> Bridge
    Bridge <--> Backend

    ConfigMgr <--> PlatformSvc
    ConfigMgr <--> BgMgr
    PlatformSvc <--> FSOps
    BgMgr <--> FSOps
    Helpers <--> ConfigMgr
    Helpers <--> BgMgr
    Helpers <--> PlatformSvc

    Backend --> BNet
    Backend --> Steam
    Backend --> OWConfig

    %% Click Events
    click Setup "https://github.com/KirillTregubov/OverBuddy/tree/main/src/routes/setup"
    click Menu "https://github.com/KirillTregubov/OverBuddy/blob/main/src/routes/menu.tsx"
    click Settings "https://github.com/KirillTregubov/OverBuddy/blob/main/src/routes/settings.tsx"
    click Alert "https://github.com/KirillTregubov/OverBuddy/blob/main/src/components/AlertDialog.tsx"
    click Error "https://github.com/KirillTregubov/OverBuddy/blob/main/src/components/Error.tsx"
    click Loading "https://github.com/KirillTregubov/OverBuddy/blob/main/src/components/Loading.tsx"
    click Progress "https://github.com/KirillTregubov/OverBuddy/blob/main/src/components/Progress.tsx"
    click Steam "https://github.com/KirillTregubov/OverBuddy/blob/main/src/components/SteamProfile.tsx"
    click ErrorUtils "https://github.com/KirillTregubov/OverBuddy/blob/main/src/lib/errors.ts"
    click DataUtils "https://github.com/KirillTregubov/OverBuddy/blob/main/src/lib/data.ts"
    click UtilFuncs "https://github.com/KirillTregubov/OverBuddy/blob/main/src/lib/utils.ts"
    click ConfigMgr "https://github.com/KirillTregubov/OverBuddy/blob/main/src-tauri/src/config.rs"
    click BgMgr "https://github.com/KirillTregubov/OverBuddy/blob/main/src-tauri/src/backgrounds.rs"
    click PlatformSvc "https://github.com/KirillTregubov/OverBuddy/blob/main/src-tauri/src/platforms.rs"
    click Helpers "https://github.com/KirillTregubov/OverBuddy/blob/main/src-tauri/src/helpers.rs"

    %% Styling
    classDef frontend fill:#3b82f6,color:#fff
    classDef bridge fill:#22c55e,color:#fff
    classDef backend fill:#f97316,color:#fff
    classDef external fill:#6b7280,color:#fff

    class Routes,Components,Utils,Setup,Menu,Settings,Alert,Error,Loading,Progress,Steam,ErrorUtils,DataUtils,UtilFuncs frontend
    class IPC,Commands bridge
    class ConfigMgr,BgMgr,PlatformSvc,FSOps,Helpers backend
    class BNet,Steam,OWConfig external
```
