# mariuz/flamerobin architecture

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

- Interactive diagram: https://gitdiagram.com/mariuz/flamerobin
- Repository: https://github.com/mariuz/flamerobin

## Overview

##### Main Components
- Graphical User Interface (GUI): This is found in the “src/gui” directory along with platform-specific subfolders (e.g., “gtk”, “msw”, “mac”). It includes the main window frame, dialog components (e.g., AboutBox, PreferencesDialog, BackupFrame), and control elements.
- Core Application Logic: In “src/core” you see shared utilities like progress indicators, error handling, template processors, subject/observer implementations, and string utilities. This layer handles many of the cross-cutting concerns.
- Database Connectivity & Communication: FlameRobin has its own implementation in “src/firebird” (which includes header and interface files for Firebird) and also integrates with the IBPP library in “src/ibpp” which serves as an abstraction over lower-level database operations.
- Business/Data Modeling: The “src/metadata” and “src/sql” directories cover database schema metadata, DDL generation (with visitors for metadata items), SQL statement creation, tokenization, and parsing. These modules abstract and represent the structure of the Firebird databases.
- Configuration & Templates: There are configuration files (within “src/config”, “conf-defs”) and code/template processor modules (within “code-templates” and “html-templates”). These influence how SQL queries and triggers are generated as well as how the application is configured and customized.
- Supporting Components: This includes logging (“src/logger”), application entry-point (“src/main.cpp”), and other utility aspects that support the overall functionality.

##### Representing Component Relationships
- The GUI layer interacts directly with the Core Application Logic. For example, user actions (like executing a query or requesting a backup) trigger calls that go from the GUI to core modules.
- The Core Application connects with both the Database Connectivity components (via IBPP and Firebird-specific code) and the Metadata/SQL processing modules to prepare and execute queries.
- There is an interaction between the configuration/template system and the Core/SQL layers wherein code templates and configuration definitions are applied to generate the correct SQL operations.

##### Key Architectural Patterns and Design Principles
- Layered Architecture: At a high level, the design cleanly separates the Presentation (GUI), the Application/Core (logic for error handling, string processing, progress updates), and the Data Access/Model (metadata, SQL parsing, Firebird interactions).

##### Specific Elements
- Components:
- Presentation Layer: “GUI” (src/gui, including platform-specific adaptations).
- Application Layer: “Core Modules” (src/core, src/config).
- Data/Business Logic: “SQL & Metadata Engine” (src/sql, src/metadata).
- Database Connectivity: “Firebird & IBPP Interface” (src/firebird, src/ibpp).
- Configuration & Templates: “Template Processor & Config Definitions” (code-templates, conf-defs, html-templates).
- Relationships:
- A connection from the Configuration & Templates module to both the Core and SQL layers.
- Notation:
- Use clear labels.
- External dependencies like the Firebird DBMS instance.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["GUI - Main Window & Dialogs"]:::gui
    B["Core Modules"]:::core
    C["SQL & Metadata Engine"]:::data
    D["Firebird & IBPP Interface"]:::db
    E["Template Processor & Config Definitions"]:::config
    F["Supporting Components (Logging & Entry)"]:::support
    G["External: Firebird DBMS"]:::external

    %% Relationships
    A -->|"triggers"| B
    B -->|"generatesQueries"| C
    C -->|"executesQueries"| D
    D -->|"communicatesWith"| G
    E -->|"configures"| B
    E -->|"configures"| C
    F -->|"supports"| B

    %% Click Events
    click A "https://github.com/mariuz/flamerobin/tree/master/src/gui"
    click B "https://github.com/mariuz/flamerobin/tree/master/src/core"
    click B "https://github.com/mariuz/flamerobin/tree/master/src/config"
    click C "https://github.com/mariuz/flamerobin/tree/master/src/metadata"
    click C "https://github.com/mariuz/flamerobin/tree/master/src/sql"
    click C "https://github.com/mariuz/flamerobin/tree/master/src/engine"
    click D "https://github.com/mariuz/flamerobin/tree/master/src/firebird"
    click D "https://github.com/mariuz/flamerobin/tree/master/src/ibpp"
    click E "https://github.com/mariuz/flamerobin/tree/master/code-templates"
    click E "https://github.com/mariuz/flamerobin/tree/master/conf-defs"
    click E "https://github.com/mariuz/flamerobin/tree/master/html-templates"
    click F "https://github.com/mariuz/flamerobin/tree/master/src/logger"
    click F "https://github.com/mariuz/flamerobin/blob/master/src/main.cpp"

    %% Styles
    classDef gui fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
    classDef core fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef data fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px;
    classDef db fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef config fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef support fill:#D5DBDB,stroke:#7F8C8D,stroke-width:2px;
    classDef external fill:#FDEBD0,stroke:#E67E22,stroke-width:2px;
```
