A complete Bank Management System built using Python. This project includes two fully functional versions:
- ✔ Command-Line Interface (CLI) —
bank_project.py - ✔ Streamlit Web App —
app.py
Both versions allow users to create accounts, deposit and withdraw money, update details, and delete accounts — with all data stored safely in a JSON database.
This system simulates essential banking operations such as:
- Creating a bank account
- Depositing money
- Withdrawing money
- Viewing account details
- Updating personal details
- Deleting bank accounts
It uses a JSON file (data.json) for data persistence, making it lightweight and easy to run anywhere.
A menu-driven terminal interface that provides all banking features using user input.
- ✅ Create new bank accounts
- ✅ Auto-generate unique account numbers
- ✅ Login using Account Number + PIN
- ✅ Deposit money (limits included)
- ✅ Withdraw money with balance check
- ✅ Update name, email, or PIN
- ✅ Delete accounts with confirmation
- ✅ JSON-based data storage
A clean and modern web UI built using Streamlit.
- ✅ Create bank accounts via form
- ✅ Secure login system
- ✅ Dashboard showing balance
- ✅ Deposit / Withdraw money
- ✅ Update user details instantly
- ✅ Delete account with warning
- ✅ Smooth UI powered by
st.session_state - ✅ Automatic database updates
- ✅ User-friendly error handling
- Designing a
Bankclass with class-level attributes (data,database) shared across all instances - Using
@classmethodmethods so operations work on the shared class state - Implementing private methods (
__update,__generateaccountno) to encapsulate internal logic and prevent outside access
- Reading and writing a JSON file (
data.json) as a lightweight database - Using
json.loads()/json.dumps()for serialisation - Understanding why a file-based database is useful when a full SQL/NoSQL setup is not available
- Using
Path(filename).exists()to safely check if a file exists before reading it - Automatically creating the database file on first run if it is missing
- Validating age (must be 18 or above) before creating an account
- Validating PIN length (must be exactly 4 digits)
- Validating deposit limits (amount must be between 0 and 15,000)
- Checking sufficient balance before allowing a withdrawal
- Create — collecting user details and appending a new record to the JSON list
- Read — filtering the list with a list comprehension to find the matching account
- Update — selectively overwriting only the fields that changed, then saving back to disk
- Delete — removing the record by index and persisting the updated list
- Generating unique account numbers by combining
random.choices()onstring.ascii_letters,string.digits, and special characters - Using
random.shuffle()to randomise the order so the format is unpredictable
- Wrapping file I/O in
try/exceptblocks to catch unexpected errors on startup - Catching non-numeric input in the main menu loop with
try/except
- Building an interactive
while Trueloop that keeps running until the user presses 7 to quit - Mapping numeric choices to the appropriate method calls cleanly
- Converting the CLI program into a modern web app using Streamlit
- Using
st.session_stateto persist the logged-in user across page interactions - Building forms, radio buttons, number inputs, and conditional UI sections
- Calling
st.rerun()to refresh the page after state-changing operations
| Technology | Purpose |
|---|---|
| Python | Core language |
| Streamlit | Web app UI |
| JSON | Data storage |
| Pathlib | File path handling |
random & string |
Account number generation |
st.session_state |
Session / state management |
python bank_project.pyYou will see the following menu:
Press '1' to create an account
Press '2' to deposit money
Press '3' to withdraw money
Press '4' to see the details
Press '5' to update the details
Press '6' to delete an account
Press '7' to quit
Install Streamlit (if not already installed):
pip install streamlitRun the app:
streamlit run app.pyYour browser will open automatically at http://localhost:8501.
Account numbers are generated using:
- 6 random letters (
string.ascii_letters) - 3 random digits (
string.digits) - 2 random special characters (
$@!#%&) - All shuffled together using
random.shuffle()
Example output:
AjK$92xP1@