← Back to Projects

Python Project

ABC Bank Simulation System

A Python and PostgreSQL banking simulation system built with layered architecture, repository and service patterns, atomic transactions, Alembic migrations, pytest testing, and a standard CLI workflow.

Problem

I wanted to build a practical banking system to understand real banking workflows and improve my Python software engineering discipline, including customer registration, account opening, deposits, withdrawals, transfers, account status rules, transaction ledger records, and audit-style operational logging.

Solution

I designed the system using a layered architecture where the CLI handles user interaction, service classes coordinate business workflows, repositories manage PostgreSQL persistence, and domain models enforce banking rules. The system uses Decimal for money handling, Alembic for database versioning, pytest fixtures for automated testing, and atomic database transactions with row-level locking to protect balance updates.

Technologies Used

  • Python
  • PostgreSQL
  • Pytest
  • Alembic
  • CLI
  • Repository Pattern
  • Service Layer
  • Domain Models
  • Row-Level Locking
  • Atomic Transactions

Engineering Highlights

  • Layered architecture using CLI, service layer, repository layer, and PostgreSQL persistence
  • Repository, model, and service-layer structure to separate user interaction, business logic, and database access
  • Account types including standard, savings, and reward accounts
  • Customer registration, account opening, deposit, withdrawal, transfer, and account status management workflows
  • Atomic deposit, withdrawal, and transfer operations with transaction ledger recording
  • PostgreSQL-backed persistence with database sequences for customer IDs, account numbers, and transaction references
  • Alembic migration versioning for database schema management
  • Pytest-based testing workflow with fixtures, service tests, repository tests, and integration tests
  • Direction-specific account status rules for incoming and outgoing transactions
  • Prepared architecture so the same business logic can later be reused in a Flask web interface

What I Learned

  • Practised layered software architecture using CLI, service, repository, and database boundaries
  • Improved understanding of banking workflows, ledger-style transaction records, and account status rules
  • Learned how to protect financial operations using atomic transactions and row-level locking
  • Strengthened PostgreSQL design skills using tables, sequences, constraints, and migrations
  • Improved pytest discipline through fixtures, service-level tests, repository tests, and integration testing
  • Built a stronger foundation for migrating the CLI system into a Flask-based web application