# ridoykj/energy-manager architecture

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

- Interactive diagram: https://gitdiagram.com/ridoykj/energy-manager
- Repository: https://github.com/ridoykj/energy-manager

## Overview

##### Project type and purpose
- From the README (“energy-manager”) and the file tree, this is a standalone JavaFX desktop application built on top of Spring Boot.
- It’s an energy-management system that uses JavaFX for its GUI layer, Spring’s dependency injection and JDBC templates for back-end logic, a MySQL (or H2 dev) database for persistence, and JasperReports for reporting.

##### File structure
- Top‐level pom.xml indicates a Maven‐based Java project.
- src/main/java/com/itbd/energymanager: contains both a Spring Boot entry point (EnergyManagerApplication.java) and a JavaFXApplication launcher.
- config/: Spring configuration classes (AppConfig, MySqlDbConfig).
- constant/: application constants and enums.
- dao/ and repos/: DAO interfaces and Spring Data Repository interfaces — the persistence layer.
- services/: business‐logic layer, including a subpackage for JasperReports integration.
- utiles/: helper classes (JSON utilities, image handling, etc.).
- view/: JavaFX controller classes.

##### README for additional insights
- The README is minimal, so all substantive architecture details come from the source tree.

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Presentation Layer"
    UIControllers["JavaFX Controllers"]:::ui
    FXML["FXML Layouts"]:::ui
    UIComponents["UI Components"]:::ui
    ManagerModules["Manager Modules"]:::ui
    Assets["CSS & Assets"]:::assets
  end

  subgraph "Application Layer"
    SpringApp["EnergyManagerApplication"]:::app
    Launcher["JavaFXApplication"]:::app
    StageInit["StageInitializer"]:::app
    Configs["Spring Configuration Classes"]:::app
    ConfigFiles["Configuration Properties"]:::config
    Logging["Logging Configuration"]:::config
  end

  subgraph "Business Logic Layer"
    Services["Service Classes"]:::service
    ReportService["Reporting Services"]:::service
    JasperReportsEngine["JasperReports Engine"]:::service
  end

  subgraph "Data Access Layer"
    DAO["DAO Interfaces"]:::dao
    Repos["Spring Data Repositories"]:::dao
  end

  subgraph "Persistence Layer"
    SQLScripts["SQL Schema & Dev Data Scripts"]:::db
    H2DB["Embedded H2 Database Files"]:::db
    MySQLDB["MySQL Database"]:::db
  end

  %% Startup Flow
  SpringApp -->|boots| Launcher
  Launcher -->|initializes| StageInit
  StageInit -->|loads FXML & Controllers| UIControllers

  %% User Interaction Flow
  UIControllers -->|calls| Services
  Services -->|uses| DAO
  Services -->|uses| Repos
  DAO -->|executes SQL on| MySQLDB
  Repos -->|executes SQL on| MySQLDB
  DAO -->|executes SQL on| H2DB
  Repos -->|executes SQL on| H2DB

  %% Reporting Flow
  Services -->|invokes| ReportService
  ReportService -->|passes data to| JasperReportsEngine

  %% Config & Assets
  Configs -->|reads| ConfigFiles
  Configs -->|applies| Logging
  UIControllers -->|loads styles & icons from| Assets
  FXML -->|references layouts| UIComponents
  ManagerModules -->|uses controllers| UIControllers

  %% Resources Flow
  SQLScripts -->|initializes schema/data| MySQLDB
  SQLScripts -->|initializes schema/data| H2DB

  %% Click Events
  click UIControllers "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/view"
  click FXML "https://github.com/ridoykj/energy-manager/tree/main/src/main/resources/view"
  click UIComponents "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/view/ui/component"
  click ManagerModules "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/view/ui/manager/module"
  click Assets "https://github.com/ridoykj/energy-manager/tree/main/src/main/resources/assets/css"
  click SpringApp "https://github.com/ridoykj/energy-manager/blob/main/src/main/java/com/itbd/energymanager/EnergyManagerApplication.java"
  click Launcher "https://github.com/ridoykj/energy-manager/blob/main/src/main/java/com/itbd/energymanager/JavaFXApplication.java"
  click StageInit "https://github.com/ridoykj/energy-manager/blob/main/src/main/java/com/itbd/energymanager/StageInitializer.java"
  click Configs "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/config"
  click Services "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/services"
  click ReportService "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/services/reports"
  click DAO "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/dao"
  click Repos "https://github.com/ridoykj/energy-manager/tree/main/src/main/java/com/itbd/energymanager/repos"
  click SQLScripts "https://github.com/ridoykj/energy-manager/blob/main/src/main/resources/sql/schema.sql"
  click H2DB "https://github.com/ridoykj/energy-manager/blob/main/src/main/resources/data/demodb.mv.db"
  click ConfigFiles "https://github.com/ridoykj/energy-manager/blob/main/src/main/resources/application.properties"
  click Logging "https://github.com/ridoykj/energy-manager/blob/main/src/main/resources/logback.xml"

  %% Styles
  classDef ui fill:#BBDEFB,stroke:#2196F3,color:#0D47A1
  classDef assets fill:#CFD8DC,stroke:#607D8B,color:#263238
  classDef app fill:#FFF9C4,stroke:#FBC02D,color:#F57F17
  classDef service fill:#C8E6C9,stroke:#388E3C,color:#1B5E20
  classDef dao fill:#FFE0B2,stroke:#F57C00,color:#E65100
  classDef db fill:#D1C4E9,stroke:#7E57C2,color:#4A148C
  classDef config fill:#FFCCBC,stroke:#D84315,color:#BF360C
```
