Pewarta Proxy

πŸ“‹ Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

βš™οΈ Pengaturan Proxy Target

Skip to content
anupmikaPublic

About

A simple Python banking system demonstrating OOP, file handling, transaction management, and error handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

36 Commits

Folders and files

Repository files navigation

πŸ’° PyBank

Streamlit Python codecov License: Apache-2.0

🏦 A modern dual-interface Python banking system showcasing clean architecture, OOP, Pydantic v2 validation, SQLite persistence, secure PIN authentication, and seamless CLI + Web experiences.

PyBank lets you register customers, open secured bank accounts, perform deposits, withdrawals, transfers, close accounts, and view detailed transaction histories with passbook-style statements. Built for learning and demonstration of production-grade patterns in Python.

Status: πŸš€ Early-stage educational project. Explore the Architecture Guide and User Guide for deeper insights.

πŸ“‹ Table of Contents

✨ Features

  • πŸ–₯️ Dual Interface – Intuitive terminal CLI (main.py) and feature-rich Streamlit web UI (streamlit_app.py)
  • πŸ‘€ Smart Account Registration – Captures Aadhaar, personal details, and sets up secure PIN protection
  • πŸ” Secure Authentication – 4-digit PINs hashed with PBKDF2-HMAC-SHA256 using unique salts
  • πŸ’΅ Deposits & Withdrawals – Real-time balance updates with PIN verification and validation
  • πŸ’Έ Fund Transfers – Secure transfers between accounts with atomic transactions and rollback on errors
  • πŸ”’ Account Management – Close/deactivate accounts with PIN verification
  • πŸ“Š Balance & Profile Views – Quick balance checks and comprehensive customer/account profiles
  • πŸ“œ Transaction History – Passbook-style statement with running balances and timestamps
  • βœ… Robust Validation – Pydantic v2 validates all inputs at the trust boundary
  • πŸ—ƒοΈ Reliable Persistence – SQLite with WAL journaling, schema auto-creation, and migrations
  • πŸ›οΈ Clean Design – Singleton connection manager, enum-based routing, and layered architecture
  • πŸ”„ Transactional Integrity – Commits on success, automatic rollback on errors

πŸ—οΈ Project Structure

pybank/
β”œβ”€β”€ main.py              # πŸšͺ CLI application entry point
β”œβ”€β”€ streamlit_app.py     # 🌐 Streamlit web UI
β”œβ”€β”€ pyproject.toml       # πŸ“¦ Project metadata & dependencies (uv)
β”œβ”€β”€ justfile             # ⚑ Task recipes
β”œβ”€β”€ README.md            # πŸ“– Project documentation
β”œβ”€β”€ LICENSE              # βš–οΈ Apache-2.0 License
β”œβ”€β”€ db/                  # πŸ’Ύ SQLite database (auto-created)
β”œβ”€β”€ docs/                # πŸ“š Documentation
β”‚   β”œβ”€β”€ architecture.md
β”‚   β”œβ”€β”€ components.md
β”‚   β”œβ”€β”€ presentation.md
β”‚   └── user-guide.md
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.py           # πŸ”„ CLI loop & BankAction router
β”‚   β”œβ”€β”€ const.py         # πŸ“‹ DB config & menu constants
β”‚   β”œβ”€β”€ enums.py         # πŸ”’ BankAction enumeration
β”‚   β”œβ”€β”€ sqlite_db.py     # πŸ—„οΈ Singleton SQLite connection + schema
β”‚   β”œβ”€β”€ validators/
β”‚   β”‚   └── models.py    # πŸ›‘οΈ Pydantic models
β”‚   β”œβ”€β”€ handlers/
β”‚   β”‚   └── pybank.py    # πŸ’Ό Core banking operations
β”‚   β”œβ”€β”€ helpers/
β”‚   β”‚   β”œβ”€β”€ design.py    # 🧬 SingletonMeta
β”‚   β”‚   └── security.py  # πŸ” PIN hashing
β”‚   └── utils/
β”‚       └── cli_utils.py # 🎨 Colored output
└── tests/               # πŸ§ͺ Test suite

πŸš€ Getting Started

Prerequisites

  • 🐍 Python 3.12+
  • ⚑ uv (recommended)

Installation

git clone https://github.com/anupmika/pybank.git
cd pybank
uv sync --no-cache

πŸ’» Usage

CLI Interface

python main.py
# or
uv run main.py
# or
just run

Web Interface

streamlit run streamlit_app.py
# or
uv run streamlit run streamlit_app.py
# or
just dev-ui
----------------------
|       PyBank       |
----------------------
| 1 |  Open Account  |
----------------------
| 2 | Deposite Money |
----------------------
| 3 | Withdraw Money |
----------------------
| 4 |  View Balance  |
----------------------
| 5 |  View History  |
----------------------
| 6 | Close  Account |
----------------------
| 7 | View   Account |
----------------------
| 8 | Transfer Money |
----------------------
| 9 |   Close  App   |
----------------------

See User Guide for detailed walkthroughs.

πŸ—„οΈ Data Model

users

Column Type Constraints Notes
id INTEGER PK (autoincrement) Primary key
aadhar_num TEXT UNIQUE NOT NULL 12-digit Aadhaar
name TEXT NOT NULL Full name
email TEXT NULL Optional
phone TEXT NOT NULL Phone number
age INTEGER NOT NULL Age
father_name TEXT NOT NULL Father's name
address TEXT NULL Optional
city TEXT NOT NULL City
initial_balance REAL NOT NULL Initial deposit
created_at TEXT NOT NULL (ISO) Created timestamp

accounts

Column Type Constraints Notes
account_num INTEGER UNIQUE NOT NULL 500000 + user_id
user_id INTEGER FK -> users(id) NOT NULL User reference
account_type TEXT DEFAULT 'savings' Account type
balance REAL DEFAULT 0 Current balance
currency TEXT DEFAULT 'INR' Currency
is_active INTEGER DEFAULT 1 1 active, 0 inactive
created_at TEXT NOT NULL (ISO) Created timestamp
pin_hash TEXT NULL PBKDF2-HMAC-SHA256 hash

transactions

Column Type Constraints Notes
id INTEGER PK (autoincrement) Primary key
account_num INTEGER FK -> accounts(account_num) Account reference
transaction_type TEXT NOT NULL deposit/withdraw/transfer_in/transfer_out
amount REAL NOT NULL Amount
balance_after REAL NOT NULL Balance after tx
timestamp TEXT NOT NULL (ISO) Timestamp

πŸ“š Documentation

Document Description
Architecture Guide Design patterns, layers, and flows
Component Reference Module/class/function details
User Guide Step-by-step usage for CLI and web
Presentation Project presentation and diagrams

πŸ› οΈ Development

just test      # Run tests
just coverage  # Run with coverage
just sync      # Install deps
just run       # CLI app
just dev-ui    # Streamlit app
just clean     # Clean artifacts

πŸ“œ License

Licensed under the Apache License 2.0. Made with ❀️ and Python πŸ’°

About

A simple Python banking system demonstrating OOP, file handling, transaction management, and error handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages