# 8fax/hoyohelper architecture

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

- Interactive diagram: https://gitdiagram.com/8fax/hoyohelper
- Repository: https://github.com/8fax/hoyohelper

## Overview

##### Project Type and Purpose
- This is a multi-component application with a modular architecture. Its primary goal is to automate web-based logins (leveraging Playwright) while offering a client-side GUI interface and robust backend authentication. The project is developed in separate modules (automation, GUI, backend scripts) which are planned for future integration into a single, seamless application.
- Key functionalities:
- Automated login using Playwright.
- A client GUI for user interaction.
- A backend login system handling authentication and session management.

##### File Structure Analysis
- The top-level files and directories reveal several key areas:
- The “app” directory contains the primary application scripts (app.py, windoless_app.py), stylesheets, and a “dependencies” folder for backend logic like database connectivity, encryption, login handling, settings, and pip configurations.
- “client scrips” includes additional scripts (renamer.py, testcard.py) which likely support GUI or auxiliary functionalities.
- “solo build” appears to contain standalone or experimental build versions of critical components (e.g., login.py, pips.py, pips2.py).
- Other files such as requirements.txt, codes.py, and supporting documentation underscore the use of Python and potentially web technologies (given the CSS and apparent GUI elements).

##### README Insights
- The README clearly delineates three major components:
▸ Playwright Automation for Auto-Login: Likely relying on asynchronous scripting to handle user credentials and automated session management.
▸ Client GUI: Offering a user-facing interface with both a main application window and a windowless variant.
▸ Backend Login Script: Managing authentication and security aspects in tandem with the automated login.

a. Main Components:
- Client GUI: Represent the user interface, possibly separated into two parts (standard window mode and windowless mode).
- Automation Engine: This is your Playwright Automation for Auto-Login, which handles navigation, credential entry, and session management.
- Backend Authentication: The backend login and dependency modules (in “app/dependencies”) representing authentication, encryption, database connections, and settings management.
- Supporting Utilities: Include components from “client scrips” and “solo build” if they represent experimental or supplementary parts of the system (e.g., additional login methods or testing functionalities).

- The Client GUI sends login requests to the Automation Engine.
- The Automation Engine works with the Backend Authentication modules to verify credentials and manage sessions.
- Data flows (such as session tokens, configurations, and status updates) should be clearly shown between GUI, automation, and backend.
- Using an API abstraction layer between the GUI and backend modules if applicable.

c. Architectural Patterns and Design Principles:
- Modularity and separation of concerns. For instance, note that the frontend (GUI) is decoupled from the backend (authentication and automation).
- Dependency injection patterns by the “dependencies” folder, which centralizes critical operations like encryption and database management.
- Point out that asynchronous processing is a key design element in the Playwright component for non-blocking operations.

d. Technologies and Frameworks:
- Python is the core language.
- Playwright is used for automation.
- CSS files in “app/css” indicate a custom styling approach for the GUI.
- Any other Python modules (e.g., for encryption, database connectivity) should be annotated along with relevant library names if known from the requirements.

##### Specific Elements
- Clear labels for each major component (e.g., “Client GUI – app.py / windoless_app.py”, “Automation Engine – Playwright-based auto-login”, “Backend Services – files in app/dependencies”).
▸ Data flow (user requests, responses).
▸ Dependencies (e.g., Client GUI depends on the automation for login).
▸ Communication channels between asynchronous automation and backend services.
▸ For instance, use blue rectangles for UI, green for backend services, and orange for automation modules.

##### Final Touches
- Document each element briefly so that any stakeholder (engineer, reviewer) can quickly understand the role of each block.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        subgraph "Client GUI"
            GUI1("Standard Client GUI"):::frontend
            GUI2("Windowless Client GUI"):::frontend
        end
        CS("Client Scripts"):::utility
    end

    %% Service Layer
    subgraph "Service Layer"
        AE("Playwright Automation for Auto-Login"):::automation
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BA("Backend Authentication & Dependencies"):::backend
    end

    %% Relationships
    GUI1 -->|"sendsLoginRequest"| AE
    GUI2 -->|"sendsLoginRequest"| AE
    AE -->|"verifiesCredentials"| BA
    CS -->|"enhances"| GUI1
    CS -->|"enhances"| GUI2

    %% Legend
    subgraph "Legend"
        LEG1["UI Component (Blue)"]:::frontend
        LEG2["Automation Service (Orange)"]:::automation
        LEG3["Backend Service (Green)"]:::backend
        LEG4["Utility Script (Yellow)"]:::utility
    end

    %% Click Events
    click GUI1 "https://github.com/8fax/hoyohelper/blob/main/app/app.py"
    click GUI2 "https://github.com/8fax/hoyohelper/blob/main/app/windoless_app.py"
    click BA "https://github.com/8fax/hoyohelper/tree/main/app/dependencies"
    click AE "https://github.com/8fax/hoyohelper/blob/main/solo build/login.py"
    click CS "https://github.com/8fax/hoyohelper/tree/main/client scrips"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef automation fill:#FFD580,stroke:#FF8C00,stroke-width:2px;
    classDef utility fill:#FFFF99,stroke:#CCCC00,stroke-width:2px;
```
