# gaiusparasa10-hash/atm-simulation architecture

> Architecture diagram of the GitHub repository gaiusparasa10-hash/atm-simulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gaiusparasa10-hash/atm-simulation
- Repository: https://github.com/gaiusparasa10-hash/atm-simulation

## Overview

This is a Java/MySQL ATM simulation with a browser UI and a console interface. Users authenticate by account number and PIN, then check balances, deposit or withdraw funds, and view recent transactions. The web flow uses JavaScript REST requests handled by the embedded HTTP server; the console flow is also documented and implemented in Main. ATMService owns banking rules and atomic money operations, with DAO classes persisting accounts and transaction history. The excerpts show these main calls; the README supplies the documented dual-interface and MySQL architecture.

Main entry points: [`src/service/ATMService.java`](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/service/ATMService.java) (ATM operations), [`src/dao/UserDAO.java`](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/UserDAO.java) (Account access), [`src/dao/TransactionDAO.java`](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/TransactionDAO.java) (Transaction history access), [`src/api/ATMHttpServer.java`](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/api/ATMHttpServer.java) (HTTP server and REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_web_ui["Web UI<br/>[script.js]"]
end

subgraph group_application["Application entry points"]
  node_main["Main launcher and CLI<br/>[Main.java]"]
  node_http_server["HTTP server and REST API<br/>[ATMHttpServer.java]"]
end

subgraph group_banking["Banking services"]
  node_atm_service["ATM operations<br/>[ATMService.java]"]
end

subgraph group_persistence["Persistence and domain"]
  node_user_dao["Account access<br/>[UserDAO.java]"]
  node_transaction_dao["Transaction history access"]
  node_user_model["Account model<br/>[User.java]"]
  node_transaction_model["Transaction model<br/>[Transaction.java]"]
  node_db_connection["JDBC connection manager"]
end

node_browser(("Web browser"))
node_cli_user(("Console user"))
node_mysql[("MySQL database")]

node_browser -->|"uses"| node_web_ui
node_web_ui -->|"calls REST"| node_http_server
node_http_server -->|"serves assets"| node_web_ui
node_cli_user -->|"uses CLI"| node_main
node_main -->|"starts server"| node_http_server
node_main -->|"calls operations"| node_atm_service
node_http_server -->|"routes requests"| node_atm_service
node_atm_service -->|"reads and updates"| node_user_dao
node_atm_service -->|"records and fetches"| node_transaction_dao
node_atm_service -->|"opens transaction"| node_db_connection
node_user_dao -->|"maps accounts"| node_user_model
node_transaction_dao -->|"maps transactions"| node_transaction_model
node_user_dao -->|"opens connections"| node_db_connection
node_transaction_dao -->|"opens connections"| node_db_connection
node_user_dao -->|"queries accounts"| node_mysql
node_transaction_dao -->|"stores history"| node_mysql
node_db_connection -->|"connects via JDBC"| node_mysql

click node_web_ui "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/frontend/script.js"
click node_main "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/Main.java"
click node_http_server "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/api/ATMHttpServer.java"
click node_atm_service "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/service/ATMService.java"
click node_user_dao "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/UserDAO.java"
click node_transaction_dao "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/TransactionDAO.java"
click node_user_model "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/model/User.java"
click node_transaction_model "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/model/Transaction.java"
click node_db_connection "https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/util/DatabaseConnection.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_ui,node_browser,node_cli_user toneBlue
class node_main,node_http_server,node_mysql toneAmber
class node_atm_service toneMint
class node_user_dao,node_transaction_dao,node_user_model,node_transaction_model,node_db_connection toneRose
```

## Components

### User interfaces

- [Web UI](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/frontend/script.js): `frontend/script.js`

### Application entry points

- [Main launcher and CLI](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/Main.java): `src/Main.java`
- [HTTP server and REST API](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/api/ATMHttpServer.java): `src/api/ATMHttpServer.java`

### Banking services

- [ATM operations](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/service/ATMService.java): `src/service/ATMService.java`

### Persistence and domain

- [Account access](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/UserDAO.java): `src/dao/UserDAO.java`
- [Transaction history access](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/dao/TransactionDAO.java): `src/dao/TransactionDAO.java`
- [Account model](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/model/User.java): `src/model/User.java`
- [Transaction model](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/model/Transaction.java): `src/model/Transaction.java`
- [JDBC connection manager](https://github.com/gaiusparasa10-hash/atm-simulation/blob/main/src/util/DatabaseConnection.java): `src/util/DatabaseConnection.java`

### Other components

- **Web browser**
- **Console user**
- **MySQL database**

## Connections

- Web browser → Web UI: uses (evidence: `README.md`)
- Web UI → HTTP server and REST API: calls REST (evidence: `frontend/script.js`)
- HTTP server and REST API → Web UI: serves assets (evidence: `src/api/ATMHttpServer.java`)
- Console user → Main launcher and CLI: uses CLI (evidence: `README.md`)
- Main launcher and CLI → HTTP server and REST API: starts server (evidence: `src/Main.java`)
- Main launcher and CLI → ATM operations: calls operations (evidence: `src/Main.java`)
- HTTP server and REST API → ATM operations: routes requests (evidence: `src/api/ATMHttpServer.java`)
- ATM operations → Account access: reads and updates (evidence: `src/service/ATMService.java`)
- ATM operations → Transaction history access: records and fetches (evidence: `src/service/ATMService.java`)
- ATM operations → JDBC connection manager: opens transaction (evidence: `src/service/ATMService.java`)
- Account access → Account model: maps accounts (evidence: `src/dao/UserDAO.java`)
- Transaction history access → Transaction model: maps transactions (evidence: `src/dao/TransactionDAO.java`)
- Account access → JDBC connection manager: opens connections (evidence: `src/dao/UserDAO.java`)
- Transaction history access → JDBC connection manager: opens connections (evidence: `src/dao/TransactionDAO.java`)
- Account access → MySQL database: queries accounts (evidence: `src/dao/UserDAO.java`)
- Transaction history access → MySQL database: stores history (evidence: `src/dao/TransactionDAO.java`)
- JDBC connection manager → MySQL database: connects via JDBC (evidence: `src/util/DatabaseConnection.java`)
