# haitame/bd-ui-generator architecture

> Architecture diagram of the GitHub repository haitame/bd-ui-generator, 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/haitame/bd-ui-generator
- Repository: https://github.com/haitame/bd-ui-generator

## Overview

##### Project Type and Core Purpose
- The application is a full-featured database management tool targeted at MySQL.
- It is a desktop application (Windows Forms) that acts as a frontend for executing and managing database operations.

##### Key Components
a. User Interface (UI) Layer:
- Forms such as the Login Form, Main Interface (table list, SQL query panel), Data Editing Forms, Export dialogues, and Server Status Dashboard.
- Each form is represented in the file tree as .cs files paired with Designer files (e.g., login.cs, playground.cs, Editor.cs, etc.).

b. Business Logic/Data Validation:
- Although not explicitly separated in the file tree, business rules (such as validating user credentials, data edits, and query executions) are typically embedded within the UI event handlers and possibly helper classes.
- This can be logically annotated as part of the interaction between the UI and the database.

c. Data Access Layer:
- Responsible for managing the connection to the MySQL database.
- Manages SQL execution (for CRUD operations, executing custom queries, and retrieving results) and handling export functionalities.

d. External Systems:
- MySQL Database – the external data store that the application connects to. Represent this as a separate component communicating with the Data Access Layer.
- Export functions might use third-party libraries for PDF, Excel, and CSV generation.

- A clear flow from the UI layer to the business logic and data access component.
- That once authenticated, users navigate through the main interface (with panels for viewing tables, executing queries, and data editing). Each of these interactions communicates with the Data Access Layer that, in turn, performs CRUD operations on the MySQL database.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer Subgraph (UI Components)
    subgraph "Application Layer"
        loginForm["Login Form"]:::ui
        playgroundForm["Main Dashboard / Query Interface"]:::ui
        editorForm["Data Editing Interface (Editor.cs)"]:::ui
        crudEditor["Data Editing Interface (CrudEditor.Designer.cs)"]:::ui
        createTableForm["Table Management (CreateTableForm.cs)"]:::ui
        etatDB["Server Status Dashboard"]:::ui
    end

    %% Business Logic / Data Access Layer Subgraph
    subgraph "Business Logic / Data Access Layer"
        dal["Data Access Module (Program.cs)"]:::dal
        exportLib["Export Components"]:::export
    end

    %% External System
    mysql["((MySQL Database))"]:::external

    %% Connections between UI and Business Logic
    loginForm -->|"authenticates"| dal
    playgroundForm -->|"executesQueries"| dal
    editorForm -->|"editsData"| dal
    crudEditor -->|"supportsEditing"| dal
    createTableForm -->|"managesTables"| dal
    etatDB -->|"retrievesStats"| dal

    %% Data Access interactions with External Systems and Export Library
    dal -->|"performsCRUD"| mysql
    dal -->|"callsExport"| exportLib

    %% Click Events for UI Components and Business Logic
    click loginForm "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/login.cs"
    click playgroundForm "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/playground.cs"
    click editorForm "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/Editor.cs"
    click crudEditor "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/CrudEditor.Designer.cs"
    click createTableForm "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/CreateTableForm .cs"
    click etatDB "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/EtatDB.cs"
    click dal "https://github.com/haitame/bd-ui-generator/blob/main/BD UI/Program.cs"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef dal fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef export fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
