How yassinean/gestion_budget works
1. System type and runtime
- This is a desktop JavaFX application built with Java 17 and Maven, not a web app.
- It connects directly to PostgreSQL for persistence; there is no separate backend service or HTTP API.
2. Application entry and modular boundary
- The app starts through Launcher / HelloApplication, with module-info.java defining the Java module boundary.
- The initial UI is loaded from FXML resources under src/main/resources/com/ba/budgetapp/Views.
3. Presentation layer
- The UI is organized around JavaFX controllers in com.ba.budgetapp.controllers:
- LoginController, RegisterController, ProfileController
- BudgetController, CategoriesController, TransactionController
- DashboardController, MainController
- Each controller owns one screen or a major UI region and is paired with an FXML view file.
4. Navigation and session state
- MainController and NavigationUtil are the key UI composition/navigation pieces.
- SessionManager holds the current logged-in user state so that authenticated screens can operate on the active account.
5. Domain model
- Core business entities live in com.ba.budgetapp.models.entities:
- Account, Budget, Category, Transaction
- TransactionType for income vs expense classification
- TransactionView for a UI-friendly projection used in lists/tables or reporting
- These entities represent the data passed between UI, services, and persistence.
6. Service layer and business rules
- Business logic is separated into service interfaces and implementations under services.Interface and services.Impl.
- Main services include:
- AccountService
- BudgetService
- CategoryService
- TransactionService
- DashboardService / StatisticsService
- DuplicateResourceException indicates service-level validation for unique constraints such as duplicate names or records.
7. Persistence layer
- Data access is abstracted by DAO interfaces in models.DAO.Interface and implemented in models.DAO.Impl.
- BaseDAO likely centralizes shared JDBC CRUD logic, while AccountDAOImpl, BudgetDAOImpl, CategoryDAOImpl, and TransactionDAOImpl handle table-specific queries.
- DatabaseConnection and DatabaseConfig provide the JDBC connection setup.
8. Database and schema boundary
- The repository includes budget_db.sql, which defines the PostgreSQL schema and is part of the deployment/data setup boundary.
- src/main/resources/database.properties externalizes connection settings, keeping the app configurable without code changes.
9. Main data flow
- Typical flow is: FXML view → controller → service → DAO → PostgreSQL → entity/view model → controller → JavaFX view.
- Authentication screens create or validate accounts, then the session state unlocks budget, category, transaction, and dashboard operations.
10. Analytics and dashboard
- The dashboard is a separate functional subsystem, not just a UI page.
- It aggregates income, expenses, balance, transaction counts, and category/monthly breakdowns for charts, likely using DashboardService and StatisticsService.
11. Resources and styling
- UI assets are packaged in src/main/resources/com/ba/budgetapp/Views and CSS/style.css.
- This makes the visual layer self-contained inside the desktop client.
12. Architecture summary
- Overall, the repo follows a layered MVC-style desktop architecture:
- Controllers orchestrate screens and user actions
- Services enforce business rules
- DAOs isolate database access
- Entities carry domain data
- JavaFX FXML/CSS define the presentation layer
- The main architectural boundary is between the JavaFX client and the PostgreSQL database, with no networked middle tier.
Main entry points: MainLayout.fxml FXML views · AccountDAOImpl.java DAOs · Account.java Entities · BudgetController.java Budget screens
Components 24
Bootstrap & module
Application entry points and module boundary.
- Launcher · JVM launch class for the desktop app.
src/main/java/com/ba/budgetapp/Launcher.java - App · JavaFX application bootstrap and primary stage setup.
src/main/java/com/ba/budgetapp/HelloApplication.java - Module info · Java module descriptor defining exported and required modules.
src/main/java/module-info.java
JavaFX UI
Controllers, navigation, session state, and packaged views.
- Main view · Main layout controller coordinating screen composition.
src/main/java/com/ba/budgetapp/controllers/MainController.java - Navigation · Screen switching and view loading helper.
src/main/java/com/ba/budgetapp/utils/NavigationUtil.java - Session · Holds the active logged-in user context.
src/main/java/com/ba/budgetapp/utils/SessionManager.java - Auth screens · Login, registration, and profile controllers.
src/main/java/com/ba/budgetapp/controllers/LoginController.java - Budget screens · Budget and category management controllers.
src/main/java/com/ba/budgetapp/controllers/BudgetController.java - Transactions · Transaction entry and listing controller.
src/main/java/com/ba/budgetapp/controllers/TransactionController.java - Dashboard · Dashboard controller for summaries and charts.
src/main/java/com/ba/budgetapp/controllers/DashboardController.java
Domain model
Business entities and UI-facing projections.
- Entities · Core account, budget, category, transaction, and projection types.
src/main/java/com/ba/budgetapp/models/entities/Account.java
Services
Business rules and analytics orchestration.
- Account svc · Account registration and validation logic.
src/main/java/com/ba/budgetapp/services/Impl/AccountServiceImpl.java - Budget svc · Budget business rules and persistence coordination.
src/main/java/com/ba/budgetapp/services/Impl/BudgetServiceImpl.java - Category svc · Category management and duplicate checks.
src/main/java/com/ba/budgetapp/services/Impl/CategoryServiceImpl.java - Transaction svc · Transaction creation, lookup, and classification logic.
src/main/java/com/ba/budgetapp/services/Impl/TransactionServiceImpl.java - Stats svc · Dashboard aggregation and statistics computation.
src/main/java/com/ba/budgetapp/services/Impl/DashboardServiceImpl.java - Duplicate rule · Signals duplicate-resource validation failures.
src/main/java/com/ba/budgetapp/services/Impl/DuplicateResourceException.java
Persistence
DAO layer and JDBC connection setup.
- Base DAO · Shared CRUD and JDBC support for DAO implementations.
src/main/java/com/ba/budgetapp/models/DAO/BaseDAO.java - DAOs · Account, budget, category, and transaction DAO implementations.
src/main/java/com/ba/budgetapp/models/DAO/Impl/AccountDAOImpl.java - DB config · Connection creation and database configuration helpers.
src/main/java/com/ba/budgetapp/config/DatabaseConnection.java
Resources & schema
FXML, styling, configuration, and database schema assets.
- FXML views · Packaged JavaFX layouts for login, main, and feature screens.
src/main/resources/com/ba/budgetapp/Views/MainLayout.fxml - Styles · Global JavaFX styling for the desktop client.
src/main/resources/com/ba/budgetapp/CSS/style.css - DB props · Externalized JDBC connection properties.
src/main/resources/database.properties - Schema · Database schema and deployment SQL.
budget_db.sql
Connections 36
- Launcher → App: starts · Launch class delegates to the JavaFX application.
- App → Module info: runs in · Application is constrained by the module descriptor.
- App → FXML views: loads UI · Initial scenes and layouts are loaded from FXML.
- FXML views → Main view: binds · Main layout and screens are controlled by JavaFX controllers.
- FXML views → Auth screens: binds · Authentication screens are paired with controllers.
- FXML views → Budget screens: binds · Budget and category views are paired with controllers.
- FXML views → Transactions: binds · Transaction views are paired with controllers.
- FXML views → Dashboard: binds · Dashboard view is paired with its controller.
- Main view → Navigation: navigates · Main shell delegates screen changes to the navigation helper.
- Auth screens → Session: sets user · Successful login or register updates active session state.
- Budget screens → Session: reads user · Budget and category actions are scoped to the active account.
- Transactions → Session: reads user · Transaction operations use the current account context.
- Dashboard → Session: reads user · Dashboard aggregates data for the active account.
- Auth screens → Account svc: calls · Authentication and profile actions use account services.
- Budget screens → Budget svc: calls · Budget screen delegates business operations to budget services.
- Budget screens → Category svc: calls · Category management is handled through category services.
- Transactions → Transaction svc: calls · Transaction screen delegates persistence and validation work.
- Dashboard → Stats svc: calls · Dashboard controller requests aggregated metrics.
- Account svc → DAOs: uses · Services persist and fetch data through DAOs.
- Budget svc → DAOs: uses · Budget service depends on DAO implementations.
- Category svc → DAOs: uses · Category service depends on DAO implementations.
- Transaction svc → DAOs: uses · Transaction service depends on DAO implementations.
- Stats svc → DAOs: reads · Dashboard computations read data from persistence.
- DAOs → Base DAO: extends · Concrete DAO classes share common JDBC behavior.
- Base DAO → DB config: connects · DAO base uses the JDBC connection setup.
- DB config → DB props: configures · Connection settings are externalized in properties.
- DB config → Schema: targets · Application data is stored in the PostgreSQL schema.
- Account svc → Duplicate rule: raises · Duplicate detection is surfaced as a service-level exception.
- Budget svc → Duplicate rule: raises · Budget operations enforce uniqueness constraints.
- Category svc → Duplicate rule: raises · Category operations enforce uniqueness constraints.
- Transaction svc → Entities: maps · Transactions are transformed to and from domain entities.
- Account svc → Entities: maps · Account business logic operates on domain entities.
- Budget svc → Entities: maps · Budget business logic operates on domain entities.
- Category svc → Entities: maps · Category business logic operates on domain entities.
- Stats svc → Entities: aggregates · Statistics and dashboard metrics are derived from entities.
- Styles → FXML views: styles · Packaged stylesheet supports the JavaFX layouts.