# ashgenz/banking-and-account-management-system architecture

> Architecture diagram of the GitHub repository ashgenz/banking-and-account-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashgenz/banking-and-account-management-system
- Repository: https://github.com/ashgenz/banking-and-account-management-system

## Overview

This is a console banking application: users choose menu actions in `Main`, which delegates account creation, deposits, withdrawals, transfers, and lookups to `Bank`. `Bank` manages an in-memory account index and invokes account-model operations; account types enforce their own withdrawal rules. The README documents these capabilities, while sampled source confirms the CLI and service wiring. Some validation errors are caught inside `Bank`, so failures do not always propagate to the CLI.

Main entry points: [`src/service/Bank.java`](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java) (Bank operations), [`src/models/Account.java`](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/Account.java) (Account base), [`src/main/Main.java`](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/main/Main.java) (Menu and CLI), [`src/models/SavingsAccount.java`](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/SavingsAccount.java) (Savings account)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Console interface"]
  node_main["Menu and CLI<br/>[Main.java]"]
end

subgraph group_service["Banking service"]
  node_bank["Bank operations<br/>[Bank.java]"]
  node_open["Open account<br/>[Bank.java]"]
  node_deposit["Deposit funds<br/>[Bank.java]"]
  node_withdraw["Withdraw funds<br/>[Bank.java]"]
  node_transfer["Transfer funds<br/>[Bank.java]"]
  node_lookup["Find account<br/>[Bank.java]"]
end

subgraph group_domain["Account domain"]
  node_account["Account base<br/>[Account.java]"]
  node_savings["Savings account"]
  node_current["Current account"]
  node_operations["Bank operations contract"]
end

subgraph group_state_errors["State and errors"]
  node_index[("Account index<br/>[Bank.java]")]
  node_exceptions["Domain exceptions"]
end

node_user(("Bank customer"))

node_user -->|"enters choices"| node_main
node_main -->|"dispatches actions"| node_bank
node_bank -->|"handles creation"| node_open
node_bank -->|"handles deposits"| node_deposit
node_bank -->|"handles withdrawals"| node_withdraw
node_bank -->|"handles transfers"| node_transfer
node_bank -->|"handles lookups"| node_lookup
node_open -->|"checks and stores"| node_index
node_lookup -->|"reads account"| node_index
node_open -->|"creates savings"| node_savings
node_open -->|"creates current"| node_current
node_deposit -->|"finds account"| node_lookup
node_withdraw -->|"finds account"| node_lookup
node_transfer -->|"finds both"| node_lookup
node_deposit -->|"calls deposit"| node_account
node_withdraw -->|"calls withdraw"| node_account
node_transfer -->|"withdraws and deposits"| node_account
node_main -->|"requests account"| node_lookup
node_main -->|"reads details"| node_account
node_savings -->|"extends"| node_account
node_current -->|"extends"| node_account
node_account -->|"implements"| node_operations
node_bank -->|"raises and catches"| node_exceptions
node_main -->|"catches lookup error"| node_exceptions

click node_main "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/main/Main.java"
click node_bank "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_open "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_deposit "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_withdraw "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_transfer "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_lookup "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_account "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/Account.java"
click node_savings "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/SavingsAccount.java"
click node_current "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/CurrentAccount.java"
click node_operations "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/interfaces/BankOperations.java"
click node_index "https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java"
click node_exceptions "https://github.com/ashgenz/banking-and-account-management-system/tree/main-dp/src/exceptions"

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_main toneBlue
class node_bank,node_open,node_deposit,node_withdraw,node_transfer,node_lookup toneAmber
class node_account,node_savings,node_current,node_operations toneMint
class node_index,node_exceptions toneRose
class node_user toneIndigo
```

## Components

### Console interface

- [Menu and CLI](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/main/Main.java): `src/main/Main.java`

### Banking service

- [Bank operations](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Open account](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Deposit funds](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Withdraw funds](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Transfer funds](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Find account](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`

### Account domain

- [Account base](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/Account.java): `src/models/Account.java`
- [Savings account](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/SavingsAccount.java): `src/models/SavingsAccount.java`
- [Current account](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/models/CurrentAccount.java): `src/models/CurrentAccount.java`
- [Bank operations contract](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/interfaces/BankOperations.java): `src/interfaces/BankOperations.java`

### State and errors

- [Account index](https://github.com/ashgenz/banking-and-account-management-system/blob/main-dp/src/service/Bank.java): `src/service/Bank.java`
- [Domain exceptions](https://github.com/ashgenz/banking-and-account-management-system/tree/main-dp/src/exceptions): `src/exceptions`

### Other components

- **Bank customer**

## Connections

- Bank customer → Menu and CLI: enters choices
- Menu and CLI → Bank operations: dispatches actions
- Bank operations → Open account: handles creation
- Bank operations → Deposit funds: handles deposits
- Bank operations → Withdraw funds: handles withdrawals
- Bank operations → Transfer funds: handles transfers
- Bank operations → Find account: handles lookups
- Open account → Account index: checks and stores
- Find account → Account index: reads account
- Open account → Savings account: creates savings
- Open account → Current account: creates current
- Deposit funds → Find account: finds account
- Withdraw funds → Find account: finds account
- Transfer funds → Find account: finds both
- Deposit funds → Account base: calls deposit
- Withdraw funds → Account base: calls withdraw
- Transfer funds → Account base: withdraws and deposits
- Menu and CLI → Find account: requests account
- Menu and CLI → Account base: reads details
- Savings account → Account base: extends
- Current account → Account base: extends
- Account base → Bank operations contract: implements
- Bank operations → Domain exceptions: raises and catches
- Menu and CLI → Domain exceptions: catches lookup error
