# kaashu23/atm_simulator architecture

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

- Interactive diagram: https://gitdiagram.com/kaashu23/atm_simulator
- Repository: https://github.com/kaashu23/atm_simulator

## Overview

##### Main Components of the System
- User Interface (UI) Module:
- Represented by the Swing GUI (all Java classes under the src/atm_simulator directory). Key screens include:
- ATM_Simulator.java (likely the main entry point)
- User operations: Create_User.java, UserInterface.java, Deposite.java, Withdraw.java, Balance.java, Transaction_History.java, Forgot_Password.java, Dashboard.java
- Admin panel: AdminPage.java
- Database Module:
- Represents MySQL as the persistent storage.
- DBConnection.java is the dedicated class to handle JDBC connectivity.
- External Libraries:
- mysql-connector-j jar (located in dist/lib) is a critical dependency for establishing the connection to the MySQL database. Represent this dependency clearly.

##### Relationships and Interactions
- The UI modules (Swing components) trigger operations (login, deposit, withdraw, etc.) and invoke methods provided by backend classes (e.g., DBConnection.java).
- DBConnection.java establishes and manages the connection to the MySQL database, facilitating SQL queries.
- The admin components (AdminPage.java) provide extended functionalities to modify user data and manage transactions. They rely on DBConnection for direct database operations.
- Data flow from UI (client side interaction) to the DBConnection (business logic) to the MySQL database.
- Control flow from the main entry point to various subscreens (e.g., login → dashboard, admin actions → transactional updates).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project clearly separates the UI (Swing components) from the Database access layer (JDBC via DBConnection.java).
- Presentation Layer: All Swing-based user interface classes.
- Business Logic/Data Access Layer: DBConnection and application logic embedded within UI event handlers.
- Data Storage Layer: MySQL database.

##### Summarized Steps for the Principal Software Engineer
- Inside the GUI block, list all the screens: ATM_Simulator (main), Login, Create User, Dashboard, Withdraw, Deposit, Balance, Transaction History, Admin Panel.
- Mysql-connector-j library as an external dependency linked to the DBConnection.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer (Swing UI)
    subgraph "Presentation Layer (Swing UI)"
        UI1["ATM_Simulator (Main Entry)"]:::ui
        UI2["UserInterface (Login/Main UI)"]:::ui
        UI3["Create_User (User Creation)"]:::ui
        UI4["Dashboard"]:::ui
        UI5["Deposite"]:::ui
        UI6["Withdraw"]:::ui
        UI7["Balance Inquiry"]:::ui
        UI8["Transaction History"]:::ui
        UI9["Forgot Password"]:::ui
        UI10["Admin Page"]:::ui
    end

    %% Business Logic & Data Access Layer
    subgraph "Business Logic & Data Access"
        DB["DBConnection (JDBC)"]:::backend
        EL["mysql-connector-j"]:::external
    end

    %% Data Storage Layer
    subgraph "Data Storage"
        MySQL["MySQL Database"]:::database
    end

    %% Project Configuration (NetBeans)
    PC["NetBeans Project Config"]:::config

    %% UI Flow between Screens
    UI1 -->|"launch"| UI2
    UI2 -->|"login_success"| UI4
    UI2 -->|"forgot_password"| UI9
    UI2 -->|"create_account"| UI3
    UI4 -->|"withdraw_request"| UI6
    UI4 -->|"deposit_request"| UI5
    UI4 -->|"check_balance"| UI7
    UI4 -->|"transaction_history"| UI8
    UI4 -->|"admin_access"| UI10

    %% UI invoking backend operations
    UI2 -->|"validate_login"| DB
    UI3 -->|"create_user"| DB
    UI5 -->|"deposit"| DB
    UI6 -->|"withdraw"| DB
    UI7 -->|"balance_inquiry"| DB
    UI8 -->|"fetch_transactions"| DB
    UI9 -->|"reset_password"| DB
    UI10 -->|"admin_actions"| DB

    %% Backend communicating with the Database
    DB -->|"SQL_query"| MySQL

    %% External library dependency
    EL -->|"connector_dependency"| DB

    %% Click Events for UI Module Components
    click UI1 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/ATM_Simulator.java"
    click UI2 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/UserInterface.java"
    click UI3 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Create_User.java"
    click UI4 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Dashboard.java"
    click UI5 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Deposite.java"
    click UI6 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Withdraw.java"
    click UI7 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Balance.java"
    click UI8 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Transaction_History.java"
    click UI9 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/Forgot_Password.java"
    click UI10 "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/AdminPage.java"

    %% Click Event for Database Module Component
    click DB "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/src/atm_simulator/DBConnection.java"

    %% Click Event for External Library
    click EL "https://github.com/kaashu23/atm_simulator/blob/main/ATM_Simulator/dist/lib/mysql-connector-j-9.1.0.jar"

    %% Click Event for Project Configuration
    click PC "https://github.com/kaashu23/atm_simulator/tree/main/ATM_Simulator/nbproject/"

    %% Style Definitions
    classDef ui fill:#AED6F1,stroke:#1E90FF,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef database fill:#82E0AA,stroke:#27AE60,stroke-width:2px;
    classDef external fill:#E59866,stroke:#D35400,stroke-width:2px;
    classDef config fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
