# nhuanld17/jrt-bank-demo architecture

> Architecture diagram of the GitHub repository nhuanld17/jrt-bank-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhuanld17/jrt-bank-demo
- Repository: https://github.com/nhuanld17/jrt-bank-demo

## Overview

##### Main Components

A. Presentation Layer (GUI)
- Three main GUI components:
- LoginGUI
- AdminGUI
- ClientGUI
- Use a rectangle with rounded corners to represent GUI components

B. Business Logic Layer (BUS)
- Business logic components:
- AccountBUS
- CheckingAccountBUS
- SavingAccountBUS
- ClientBUS
- TransactionBUS

C. Data Access Layer (DAO)
- DAO components:
- AccountDAO
- CheckingAccountDAO
- SavingAccountDAO
- ClientDAO
- TransactionDAO
- DBcon (Database Connection)

D. Server Components
- Include:
- Server
- ClientHandler

E. Support Components
- Utility components:
- SIDEFUNCTION package (HashPassword, SendMailOTP, etc.)
- COMPONENT package (Custom UI components)
- Use ovals

##### Relationships to Illustrate

A. Data Flow
- GUI → BUS → DAO → Database
- Server ↔ ClientHandler
- Client GUI ↔ Server

B. Dependencies
- Library dependencies:
- JFreeChart for charts/graphs
- MySQL Connector
- JavaMail API

##### Specific Implementation Details

A. Architecture Pattern
- 3-tier architecture:
- Presentation (GUI)
- Business Logic (BUS)
- Data Access (DAO)

B. Network Communication
- Client-server communication
- How ClientHandler manages multiple client connections

##### Additional Elements

A. External Systems
- Email Server (for OTP functionality)
- Database Server

B. Security Components
- Password Hashing
- OTP Generation/Validation

##### Notes
- Annotations for important features like:
- Authentication flow
- Transaction processing
- Account management
- Real-time updates

##### External service integration

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this banking application secure, scalable, and maintainable.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef gui fill:#e6f3ff,stroke:#666,stroke-width:2px
    classDef bus fill:#e6ffe6,stroke:#666,stroke-width:2px
    classDef dao fill:#ffe6cc,stroke:#666,stroke-width:2px
    classDef server fill:#f3e6ff,stroke:#666,stroke-width:2px
    classDef support fill:#f2f2f2,stroke:#666,stroke-width:2px
    classDef external fill:#fff0f0,stroke:#666,stroke-width:2px

    %% GUI Layer
    subgraph GUI
        Login[LoginGUI]:::gui
        Admin[AdminGUI]:::gui
        Client[ClientGUI]:::gui
    end

    %% Business Logic Layer
    subgraph BUS
        AccBUS[AccountBUS]:::bus
        ChkAccBUS[CheckingAccountBUS]:::bus
        SavAccBUS[SavingAccountBUS]:::bus
        ClientBUS[ClientBUS]:::bus
        TransBUS[TransactionBUS]:::bus
    end

    %% Data Access Layer
    subgraph DAO
        AccDAO[(AccountDAO)]:::dao
        ChkAccDAO[(CheckingAccountDAO)]:::dao
        SavAccDAO[(SavingAccountDAO)]:::dao
        ClientDAO[(ClientDAO)]:::dao
        TransDAO[(TransactionDAO)]:::dao
        DBCon[(DBcon)]:::dao
    end

    %% Server Components
    subgraph Server
        ServerMain{Server}:::server
        ClientHandler{ClientHandler}:::server
    end

    %% Support Components
    subgraph Support
        HashPass((HashPassword)):::support
        OTPSystem((SendMailOTP)):::support
        UIComp((Custom UI<br/>Components)):::support
    end

    %% External Systems
    EmailServer[Email Server]:::external
    Database[(MySQL Database)]:::external

    %% Relationships
    Login --> AccBUS
    Admin --> AccBUS
    Client --> AccBUS
    
    AccBUS --> AccDAO
    ChkAccBUS --> ChkAccDAO
    SavAccBUS --> SavAccDAO
    ClientBUS --> ClientDAO
    TransBUS --> TransDAO
    
    AccDAO --> DBCon
    ChkAccDAO --> DBCon
    SavAccDAO --> DBCon
    ClientDAO --> DBCon
    TransDAO --> DBCon
    
    DBCon --> Database
    
    Client --> ServerMain
    ServerMain --> ClientHandler
    ClientHandler --> TransBUS
    
    Login --> HashPass
    Login --> OTPSystem
    OTPSystem --> EmailServer
    
    %% Click Events
    click Login "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/GUI/LoginGUI.java"
    click Admin "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/GUI/AdminGUI.java"
    click Client "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/GUI/ClientGUI.java"
    click AccBUS "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/BUS/AccountBUS.java"
    click ChkAccBUS "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/BUS/CheckingAccountBUS.java"
    click SavAccBUS "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/BUS/SavingAccountBUS.java"
    click ClientBUS "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/BUS/ClientBUS.java"
    click TransBUS "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/BUS/TransactionBUS.java"
    click AccDAO "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/AccountDAO.java"
    click ChkAccDAO "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/CheckingAccountDAO.java"
    click SavAccDAO "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/SavingAccountDAO.java"
    click ClientDAO "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/ClientDAO.java"
    click TransDAO "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/TransactionDAO.java"
    click DBCon "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/DAO/DBcon.java"
    click ServerMain "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/SERVER/Server.java"
    click ClientHandler "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/SERVER/ClientHandler.java"
    click HashPass "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/SIDEFUNCTION/HashPassword.java"
    click OTPSystem "https://github.com/nhuanld17/JRT-BANK-DEMO/blob/main/src/SIDEFUNCTION/SendMailOTP.java"
    click UIComp "https://github.com/nhuanld17/JRT-BANK-DEMO/tree/main/src/COMPONENT"
```
