A terminal-based banking application built with Python and PostgreSQL. Users can sign up, log in, transfer funds, deposit money, view transaction history, and manage their profile β all from the command line.
- Authentication β Sign up with username validation, password requirements, and phone number verification. Log in with either your username or phone number.
- Forgot Password β Reset your password via a verification code sent to your registered phone number.
- Dashboard β View your account balance and navigate the app.
- Transfer Funds β Send money to another account by account number, with insufficient funds protection.
- Add Funds (Deposit) β Deposit money into any account using an account number.
- Transaction History β View a full record of money sent and received.
- Profile Management β View and edit your username and email after re-authenticating.
- Logging β All signup activity, login events, and errors are automatically written to log files.
BANK PRAC/
β
βββ AUTH/
β βββ auth.py # Signup, login, and auth menu
β βββ __init__.py
β
βββ DB/
β βββ db.py # Database connection and table initialization
β βββ db example.env # Example environment variable file
β βββ __init__.py
β
βββ MAIN/
β βββ bankpayment.py # Core banking logic β deposit, transfer, history, profile, dashboard, menu
β βββ __init__.py
β
βββ LOG/
β βββ loger.py # Logging configuration for signup and login events
β βββ __init__.py
β
βββ db.env # Your local environment variables (never commit this)
- Python 3.10 or higher (required for
match/casestatements) - PostgreSQL
- The following Python packages:
psycopg2python-dotenv
Install dependencies with:
pip install psycopg2 python-dotenv1. Clone or download the project
git clone <your-repo-url>
cd "BANK PRAC"2. Set up your PostgreSQL database
Make sure PostgreSQL is running and create a database for the project:
CREATE DATABASE your_database_name;3. Configure your environment variables
Copy the example env file and fill in your own database credentials:
cp "DB/db example.env" db.envThen open db.env and update the values:
DB_HOST=localhost
DB_NAME=your_database_name
DB_USER=your_postgres_username
DB_PASSWORD=your_postgres_password
DB_PORT=5432Important: Never commit
db.envto version control. It contains sensitive credentials. Theenvi.gitignorefile in the project is there to help with this β make sure it is renamed to.gitignore.
4. Run the application
python AUTH/auth.pyThe app will automatically create all required database tables on first run.
The app manages three tables in PostgreSQL:
| Table | Description |
|---|---|
auth_data |
Stores user accounts β username, email, password, phone number, account number, registration date |
payment_table |
Stores each user's balance and account number |
transaction_tab |
Records every transfer β sender, receiver, amount, and date |
The app writes four log files automatically in the project root:
| File | Contents |
|---|---|
signup_Info_record.log |
Successful new user registrations |
signup_error_record.log |
Errors during signup |
login_rec.log |
Successful login events |
login_errors.log |
Login errors and exceptions |
When a user signs up, their account number is automatically generated from their phone number β the leading 0 is removed and the remaining 10 digits become the account number. For example, phone number 08012345678 becomes account number 8012345678.
When you run the app you will see:
____________________________________________________________
BANK-PRAC LOGIN OR SIGNUP
1. SIGN_UP to get started
2. LOGIN if already have account
3. EXIT
From the banking home menu after login:
-------- BANK-PRAC HOME ---------
1. DASHBOARD
2. TRANSFER
3. ADD_FUNDS
4. HISTORY
5. PROFILE
6. LOG_OUT
7. EXIT APP
Built from scratch as a Python and PostgreSQL learning project, covering OOP inheritance, database design, error handling, and application architecture.