# mrsalifdiallo/gestionbancairejavafx architecture

> Architecture diagram of the GitHub repository mrsalifdiallo/gestionbancairejavafx, 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/mrsalifdiallo/gestionbancairejavafx
- Repository: https://github.com/mrsalifdiallo/gestionbancairejavafx

## Overview

##### Project Type and Purpose
- This is a JavaFX desktop application designed for managing banking operations such as handling clients, bank cards, transactions, and loyalty programs.
- It follows a typical layered architecture with a strong separation between the user interface (views), business logic, and persistence/data layers using JPA/Hibernate with PostgreSQL.

##### File Structure
- The project is Maven-based with a clear division between source code (src/main/java) and resources (src/main/resources).
- Notice the packages:
- "com/groupeisi/gestionbancaires/entities": Contains JPA entity classes.
- "com/groupeisi/gestionbancaires/views": Contains JavaFX controller classes that interact with FXML view files.
- "com/groupeisi/gestionbancaires/services": Provides service-level components (e.g., ClientService) which encapsulate business logic.
- "com/groupeisi/gestionbancaires/utils" and "JpaUtils.java": Utility classes for JPA/Hibernate configuration and possibly helper methods.
- Resources include FXML files for UI layouts, CSS for styling, and configuration files such as persistence.xml (for database settings) and hibernate.cfg.xml.

##### Insights from the README
- The README emphasizes key functionalities: client management, bank card management, transaction tracking, and loyalty programs.
- It lists out the technologies employed: JavaFX for UI, JPA/Hibernate for persistence, PostgreSQL for the backend database, and Maven for dependency management.
- There’s a clear separation between the view (FXML files, controllers) and the backend logic (entities, services, utilities).

a. Main Components:
- User Interface (UI): JavaFX-based interface using FXML files and styled by CSS.
- Presentation/Controller Layer: Contains JavaFX controllers (e.g., LoginViewController, MainViewController, etc.) found in both application/view and com/groupeisi/gestionbancaires/views packages.
- Business Logic / Service Layer: Includes service classes (e.g., ClientService) and other business logic components.
- Data Access Layer: JPA entity classes (such as Client, CarteBancaire, Transaction, etc.) and utility classes (JpaUtils, HibernateUtil) that manage interactions with the persistence context.
- Database: External PostgreSQL database that is configured via persistence.xml and hibernate.cfg.xml.

b. Relationships and Interactions:
- The UI layer interacts with the Presentation/Controller layer: user events (e.g., button clicks) trigger controller methods.
- Controllers invoke services in the Business Logic layer to process requests.
- The Business Logic layer uses the Data Access layer (JPA/Hibernate utilities and entities) to retrieve, update, or store data.

c. Architectural Patterns and Design Principles:
- MVC (Model-View-Controller): The separation between FXML views, controllers in the views packages, and Models (JPA entity classes) is evident.
- Layered Architecture: Clear separation of concerns (UI, business logic, persistence).
- Dependency Injection (if used): Although not explicitly shown, Maven dependencies and use of JPA/Hibernate often rely on DI principles.

d. Technologies, Frameworks, and Libraries:
- JavaFX for the UI.
- JPA/Hibernate for ORM.
- PostgreSQL as the backend database.
- Maven for build and dependency management.
- Lombok is mentioned as a tool to reduce boilerplate in the code (likely applied in the entities or model classes).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "UI Layer"
        UI["FXML Views"]:::ui
    end

    subgraph "Presentation/Controller Layer"
        C1["LoginViewController (App)"]:::controller
        C2["MainViewController (App)"]:::controller
        C3["LoginViewController (Groupeisi)"]:::controller
        C4["ClientsViewController"]:::controller
    end

    subgraph "Business Logic / Service Layer"
        S1["ClientService"]:::service
    end

    subgraph "Data Access / Persistence Layer"
        subgraph "Entities"
            E1["JPA Entities (Client, CarteBancaire, Transaction, ...)"]:::data
        end
        subgraph "Utilities"
            U1["JpaUtils"]:::data
            U2["HibernateUtil"]:::data
        end
    end

    subgraph "Database Configuration"
        D1["persistence.xml"]:::config
        D2["hibernate.cfg.xml"]:::config
    end

    DB["PostgreSQL Database"]:::database

    UI -->|"triggers"| C1
    UI -->|"triggers"| C2
    UI -->|"triggers"| C3
    UI -->|"triggers"| C4

    C1 -->|"calls"| S1
    C2 -->|"calls"| S1
    C3 -->|"calls"| S1
    C4 -->|"calls"| S1

    S1 -->|"accesses"| E1
    S1 -->|"uses"| U1
    S1 -->|"uses"| U2

    E1 -->|"configuredBy"| D1
    U1 -->|"configuredBy"| D1
    U2 -->|"configuredBy"| D2

    D1 -->|"connectsTo"| DB
    D2 -->|"connectsTo"| DB

    click UI "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/resources/com/groupeisi/gestionbancaires/views"
    click UI "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/resources/fxml"
    
    click C1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/application/view/LoginViewController"
    click C2 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/application/view/MainViewController"
    click C3 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/com/groupeisi/gestionbancaires/views/LoginViewController"
    click C4 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/com/groupeisi/gestionbancaires/views/ClientsViewController"
    
    click S1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/com/groupeisi/gestionbancaires/services"
    
    click E1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/tree/main/src/main/java/com/groupeisi/gestionbancaires/entities"
    
    click U1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/blob/main/src/main/java/com/groupeisi/gestionbancaires/JpaUtils.java"
    click U2 "https://github.com/mrsalifdiallo/gestionbancairejavafx/blob/main/src/main/java/com/groupeisi/gestionbancaires/utils/HibernateUtil.java"
    
    click D1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/blob/main/src/main/resources/META-INF/persistence.xml"
    click D1 "https://github.com/mrsalifdiallo/gestionbancairejavafx/blob/main/src/main/java/com/groupeisi/gestionbancaires/META-INF/persistence.xml"
    click D2 "https://github.com/mrsalifdiallo/gestionbancairejavafx/blob/main/src/main/resources/hibernate.cfg.xml"

    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef controller fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef service fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef data fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef config fill:#D2B4DE,stroke:#512E5F,stroke-width:2px;
    classDef database fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
