# anfinogenov/donation-interactive architecture

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

- Interactive diagram: https://gitdiagram.com/anfinogenov/donation-interactive
- Repository: https://github.com/anfinogenov/donation-interactive

## Overview

##### Main Components

- Module – This is the core of the project and is divided into several subdirectories:
- Actions: Contains scripts that likely handle various user inputs or automated actions. Files such as gtasa.py, kbdctypes.py, press_x.py, and random_keys.py suggest different action triggers.
- Classes: Holds reusable classes and common logic to support the overall system.
- Config: Manages configuration (with config.json) and confidential settings (secrets.json).
- Donation Handlers: Manages integration with donation alerts (including Twitch integration). It contains donation_alerts.py, test_alerts.py, and twitch.py, which likely serve as modules for live stream donation interactions.
- UI: Contains the main user interface logic (main.py) which presumably connects with the actions, donation handlers, and config modules.

- Standalone Scripts and Files
- interactive.py and the batch files (start.bat, install.bat) suggest different modes for launching or installing the application.

- Visualisations
- The visualisations folder (with the “random_keys” subfolder containing index.html) represents the front-end or reporting part for specific functionalities (for example, visually representing the “random_keys” action).

##### Relationships and Interactions

- The UI (module/ui) is the interactive front-end that likely orchestrates interaction among actions, the donation handlers, and configuration.
- The Actions component provides the core functionalities and automated responses. In some cases (e.g., random_keys), there is a related visualization in the external visualisations folder.
- The Donation Handlers component interfaces with external services (like Twitch) and could be triggering actions based on live input from donations.
- The Config module plays a shared role by providing necessary settings to all other components for consistent behavior (for instance, API keys, configuration flags, etc.).
- The main script (interactive.py) may act as an alternative entry point to bring these components together in an interactive session.

##### Architectural Patterns and Design Principles

- Separation of Concerns: The project is clearly modular; each subdirectory is responsible for a distinct set of responsibilities (actions, config, donation alerts, UI).
- Integration Points: APIs or external integrations (Twitch, external donation alerts) are encapsulated in the donation_handlers directory.
- Clear configuration separation: Central configuration (and secrets) files provide a single point of management for settings.
- Visual Feedback: The separation between core functionality and its visual representation (in the visualisations folder) follows a common pattern where business logic is separated from presentation/view layers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Interactive("Interactive Script Entry Point"):::entry
    Config("Config Module"):::config
    Classes("Classes Module"):::classes
    UIModule("UI Module"):::ui
    Actions("Actions Module"):::actions
    DonationHandlers("Donation Handlers"):::donation
    Visualisations("Visualisations"):::visualisation
    Twitch("Twitch External Service"):::external

    Interactive -->|"starts"| UIModule
    Config -->|"provides_config_to"| UIModule
    Config -->|"provides_config_to"| Actions
    Config -->|"provides_config_to"| DonationHandlers
    Classes -->|"supports"| UIModule
    UIModule -->|"triggers"| Actions
    UIModule -->|"triggers"| DonationHandlers
    Actions -->|"updates"| Visualisations
    DonationHandlers -->|"sends_alerts_to"| Twitch

    %% Subcomponents of Actions Module
    Actions --> A1("gtasa.py"):::script
    A1 --> A2("kbdctypes.py"):::script
    A2 --> A3("press_x.py"):::script
    A3 --> A4("random_keys.py"):::script
    A4 --> A5("gtasa.csv"):::script

    %% Click Events
    click Interactive "https://github.com/anfinogenov/donation-interactive/blob/master/interactive.py"
    click Config "https://github.com/anfinogenov/donation-interactive/tree/master/module/config"
    click Classes "https://github.com/anfinogenov/donation-interactive/tree/master/module/classes"
    click UIModule "https://github.com/anfinogenov/donation-interactive/tree/master/module/ui"
    click Actions "https://github.com/anfinogenov/donation-interactive/tree/master/module/actions"
    click DonationHandlers "https://github.com/anfinogenov/donation-interactive/tree/master/module/donation_handlers"
    click Visualisations "https://github.com/anfinogenov/donation-interactive/tree/master/visualisations/random_keys"

    %% Styles
    classDef entry fill:#ffcc00,stroke:#000,stroke-width:2px;
    classDef ui fill:#b3e5fc,stroke:#0277bd,stroke-width:2px;
    classDef actions fill:#ffe0b2,stroke:#fb8c00,stroke-width:2px;
    classDef donation fill:#c8e6c9,stroke:#43a047,stroke-width:2px;
    classDef config fill:#d1c4e9,stroke:#5e35b1,stroke-width:2px;
    classDef classes fill:#eeeeee,stroke:#757575,stroke-width:2px;
    classDef visualisation fill:#f8bbd0,stroke:#ad1457,stroke-width:2px;
    classDef external fill:#c5cae9,stroke:#3949ab,stroke-width:2px;
    classDef script fill:#fff9c4,stroke:#fdd835,stroke-width:1px;
```
