BankDB is a relational database designed to support the core operations of a modern bank.
It manages customers, accounts (checking & savings), cards, loans, transactions, employees, and bank branches.
The system enables efficient data storage, retrieval, updates, integrity constraints, and relational querying.
- Customer, account, loan, card & transaction management
- Many-to-many relationships (customers ↔ accounts, accounts ↔ cards)
- Branch & employee hierarchy
- Useful SQL views (customer account summary, employee branch summary)
- ER model & relational schema included
- SQL-based relational DBMS (MySQL)
- Normalized database schema with constraints
- ER & relational diagrams
- Backend: Python (Flask)
- Frontend: Bootstrap 5, Jinja2
This is a full-stack web application developed using Python (Flask) and MySQL.
It provides a secure interface for customers to:
- View bank accounts
- Perform money transfers
- Pay loans and credit cards
- Manage personal details
- Locate bank branches
Before running the application, ensure you have the following installed:
- Python 3.x
- MySQL Server (must be running properly)
- Python libraries:
flaskmysql-connector-python
pip install flask mysql-connector-pythonThe application relies on a MySQL database named BankDB.
You must set this up manually because the provided SQL dump file may not create the database automatically.
- Open your terminal / command prompt
- Log in to MySQL:
mysql -u root -p
- Create the database:
CREATE DATABASE IF NOT EXISTS BankDB; EXIT;
- Import the SQL dump (from the project directory):
mysql -u root -p BankDB < Dump20251219.sql
The application connects to the database using credentials defined in app.py.
Locate the db_config dictionary (approximately line 11):
db_config = {
'host': 'localhost',
'user': 'root',
'password': 'YOUR_MYSQL_PASSWORD',
'database': 'BankDB'
}Important:
The current code uses password1234.
Change this to match your local MySQL root password.
-
Navigate to the project directory:
cd path/to/project_folder -
Run the Flask application:
Windows (recommended):
python app.py
Linux / macOS:
python3 app.py
-
If successful, you will see:
Running on http://127.0.0.1:5000 -
Open your web browser and go to:
http://127.0.0.1:5000
- No separate
userstable is used - Authentication is performed using Customer TIN
- Any password is accepted
Example valid TIN:
123456789
(User: Maria Papadopoulou)
After login, the dashboard displays:
- All customer accounts
- Account Number
- Currency
- Status
- Current Balance
Notes:
- Balances are calculated dynamically using the
accounts_balanceSQL view - Total Net Worth includes balances from all accounts, active or inactive
- Click Transfer
- Select the source account
- Enter the destination account number
Example:GR1311891434567890123456789 - Enter a positive amount
- Click Confirm Transfer
Validation Includes:
- Sufficient funds
- Valid destination account
- Click Branches
- View all bank branches with:
- Address
- Operating hours
- Contact details
- View active loan details:
- Loan amount
- Expiration date
- Current debt
- Select an account to pay from
- Enter payment amount
- System prevents overpayment and insufficient balance
- Displays credit cards with outstanding debt
- Select:
- Credit card
- Source account
- Enter payment amount
- Credit card available balance is updated accordingly
From the Settings page, users can:
- View personal details (Name, TIN, phone numbers)
- Update physical address
- Manage email addresses:
- Add
- Update
- Delete
- Backend: Python Flask
- Frontend: Bootstrap 5, Jinja2
- Database: MySQL
- Prepared statements for all queries (SQL Injection protection)
- Flask session management for authentication
- ACID-compliant database transactions:
conn.start_transaction()commit()rollback()
- Guarantees no partial or lost money transfers
- Transaction IDs generated manually (
MAX(TransactionID) + 1) - Extensive use of SQL Views:
customer_accountsaccounts_balance- Summary and reporting views
- MySQL server must be running before starting the app
- Database must be created before importing the dump
- Always verify database credentials
- Intended for academic and educational use
End of README