# erajasekar/simple-banking-system architecture

> Architecture diagram of the GitHub repository erajasekar/simple-banking-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erajasekar/simple-banking-system
- Repository: https://github.com/erajasekar/simple-banking-system

## Overview

##### Project type and purpose
- This is a small, monolithic, command-line banking system written in Python using OOP concepts.
- It consists of three main modules: bank.py (Bank class), client.py (Client class) and main.py (CLI entry point).

##### File structure
Top-level files:
- bank.py     – defines the Bank class, manages the “database” (a list of dicts), account creation, and authentication.
- client.py   – defines the Client class, holding account number, name, and balance, plus methods for deposit/withdrawal.
- main.py     – user interface loop: displays menus, gathers input, invokes Bank and Client operations.
- README.md   – project description.
- __pycache__ – compiled bytecode.

##### README for insights
- The Bank class holds a “database” (list of dicts) representing multiple Client instances.
- Workflow:
a) Instantiate Bank.
b) CLI: create new account → calls Client.__init__, generates a 5-digit account number, then Bank.add_client.
c) CLI: login existing account → Bank.authenticate returns a Client instance (current_client).
d) CLI: account operations (deposit, withdraw, check balance) invoked directly on current_client.

##### Main components & interactions
a. Components:
- CLI (main.py)
- Bank module (bank.py)
- Client module (client.py)
- In-memory database (Bank.database: list of dicts or list of Client objects)
b. Relationships:
- CLI ↔ Bank: CLI calls Bank.create_account(), Bank.authenticate()
- Bank ↔ Client: Bank stores references to Client; Bank.lookup returns Client.
- Client ↔ (self): deposit(), withdraw(), get_balance()
c. Architectural principles:
- Separation of concerns: CLI vs business logic vs data model
- Single responsibility: Bank manages accounts; Client manages individual account state.
d. Technologies:
- Python 3.x
- Standard library (random for account numbers, basic I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        CLI["main.py: CLI"]:::ui
    end

    subgraph "Business Logic Layer"
        Bank["bank.py: Bank"]:::logic
        Client["client.py: Client"]:::logic
    end

    subgraph "Data Store"
        DB["In-Memory Database"]:::datastore
    end

    CLI -->|"create_account(name, initial_deposit)"| Bank
    CLI -->|"authenticate(name, acct_no)"| Bank
    Bank -->|"add_client(Client)"| DB
    DB -->|"lookup client"| Bank
    Bank -->|"returns Client instance"| CLI
    CLI -->|"deposit()/withdraw()"| Client

    click CLI "https://github.com/erajasekar/simple-banking-system/blob/master/main.py"
    click Bank "https://github.com/erajasekar/simple-banking-system/blob/master/bank.py"
    click Client "https://github.com/erajasekar/simple-banking-system/blob/master/client.py"
    click README "https://github.com/erajasekar/simple-banking-system/blob/master/README.md"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px
    classDef datastore fill:#FFA500,stroke:#000,stroke-width:1px
```
