# overlayeddev/overlayed architecture

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

- Interactive diagram: https://gitdiagram.com/overlayeddev/overlayed
- Repository: https://github.com/overlayeddev/overlayed

## Overview

##### Main Components
- Desktop Application:
- Located in apps/desktop, this is the Tauri-based overlay client.
- Built with web technologies (React/TypeScript with Vite) combined with Rust backend elements (Tauri integration).
- API Server:
- Found under apps/api, this is likely a Node.js/TypeScript-based backend service.
- It handles HTTP requests, token generation, webhooks, and updater events.
- Discord Bot:
- Found in apps/bot, this component integrates directly with Discord for command handling and possibly managing some overlay behaviors.
- Web Marketing Site:
- Located in apps/web, built with Astro (indicated by files like astro.config.ts) and supporting assets, pages, and blog content.
- Shared/Utility Packages:
- Located in packages/types and packages/utils, these provide shared types/interfaces and utility functions used by multiple apps.
- CI/CD and Tooling:
- Numerous GitHub workflows in the .github directory; these manage deployment, testing, releases, and more.
- Tooling configurations (in tooling/) exist to enforce code quality and handle TypeScript/ESLint setups.
- External Services:
- Integration with Discord (via bot and OAuth or webhooks in the API).
- Distribution channels such as Winget, Homebrew, and Flathub, as well as external guides that help users install the app.

##### Establish Relationships and Interactions
- The desktop application probably communicates with the API for updates, configuration, or analytics.
- The Discord bot interacts with Discord’s APIs and may exchange data with the API (for example, to validate requests or update statuses).
- The web marketing site serves as the public-facing portal where documentation, installation guides, and component details (like download links for the desktop app) are hosted.
- Shared packages ensure that types and utilities are consistent across the different apps, reducing duplication.
- CI/CD pipelines orchestrate builds, tests, and deployments across these different components.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project is neatly segmented into distinct directories for each major component (API, Bot, Desktop, and Web), allowing independent development and deployment.
- Reusability: Shared packages for utility functions and types prevent code duplication.
- Cross-Platform: The desktop app is built with Tauri, meaning there is a strong focus on native integration across operating systems.
- DevOps Integration: The presence of robust CI/CD configurations (GitHub workflows) emphasizes continuous testing and deployment.

##### Final Recommendations for the Principal Software Engineer
- Then refine the subsections within each container to show internal modules (e.g., components within the desktop app).
- That you detail shared resources such as the utility and type packages or CI/CD integrations, as they are essential to understanding the full architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Desktop Application Subgraph
    subgraph "Desktop Application (Tauri App)"
        DesktopFrontend("Frontend (React/Vite)"):::desktop
        DesktopBackend("Backend (Rust/Tauri)"):::desktop
        DesktopFrontend -->|"UI_calls_native"| DesktopBackend
    end

    %% Core Backend Components
    API("API Server (Node.js/TypeScript)"):::api
    Bot("Discord Bot"):::bot
    Web("Web Marketing Site (Astro)"):::web

    %% External Services
    DiscordAPI("Discord API"):::external
    Distr("Distribution Platforms (Winget,Homebrew,Flathub)"):::external

    %% Shared & DevOps Resources
    subgraph "Shared & DevOps"
        SharedTypes("Shared Types"):::shared
        SharedUtils("Shared Utils"):::shared
        CICD("CI/CD (GitHub Workflows)"):::cicd
        Tooling("Tooling (Build&CodeQuality)"):::cicd
    end

    %% Interactions between Core Components
    DesktopFrontend -->|"HTTP_Update"| API
    API -->|"Webhook_Token"| DiscordAPI
    Bot -->|"Commands"| DiscordAPI
    Bot -->|"DataExchange"| API
    API -->|"Notifications"| Bot
    Web -->|"Download_Link"| DesktopFrontend

    %% Shared Packages connections (dashed lines)
    SharedTypes ---|"shared"| DesktopFrontend
    SharedTypes ---|"shared"| API
    SharedTypes ---|"shared"| Bot
    SharedTypes ---|"shared"| Web

    SharedUtils ---|"shared"| DesktopFrontend
    SharedUtils ---|"shared"| API
    SharedUtils ---|"shared"| Bot
    SharedUtils ---|"shared"| Web

    %% CI/CD & Tooling connections (dotted arrows)
    CICD ---|"Build_Deploy"| DesktopFrontend
    CICD ---|"Build_Deploy"| API
    CICD ---|"Build_Deploy"| Bot
    CICD ---|"Build_Deploy"| Web

    Tooling ---|"CodeQuality"| DesktopFrontend
    Tooling ---|"CodeQuality"| API
    Tooling ---|"CodeQuality"| Bot
    Tooling ---|"CodeQuality"| Web

    %% Click Events
    click DesktopFrontend "https://github.com/overlayeddev/overlayed/tree/main/apps/desktop"
    click DesktopBackend "https://github.com/overlayeddev/overlayed/tree/main/apps/desktop/src-tauri"
    click API "https://github.com/overlayeddev/overlayed/tree/main/apps/api"
    click Bot "https://github.com/overlayeddev/overlayed/tree/main/apps/bot"
    click Web "https://github.com/overlayeddev/overlayed/tree/main/apps/web"
    click SharedTypes "https://github.com/overlayeddev/overlayed/tree/main/packages/types"
    click SharedUtils "https://github.com/overlayeddev/overlayed/tree/main/packages/utils"
    click CICD "https://github.com/overlayeddev/overlayed/tree/main/.github/workflows"
    click Tooling "https://github.com/overlayeddev/overlayed/tree/main/tooling"

    %% Styles
    classDef desktop fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef api fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef bot fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef web fill:#577590,stroke:#fff,stroke-width:2px;
    classDef external fill:#f3722c,stroke:#333,stroke-width:2px;
    classDef shared fill:#f94144,stroke:#333,stroke-width:2px;
    classDef cicd fill:#277da1,stroke:#fff,stroke-width:2px;
```
