A modular banking system built with Python, demonstrating advanced Software Architecture, automated testing, and a modern REST API.
The application is containerized and automatically deployed to the cloud using a robust CI/CD pipeline.
- Live Landing Page: 👉 Nodrex Bank API (Azure)
- Interactive API Docs: 👉 Swagger UI (Azure)
- Deployment Status:
- Cloud Provider: Microsoft Azure (App Services)
- Containerization: Docker & GitHub Container Registry (GHCR)
- CI/CD: GitHub Actions (Automated Testing, Docker Build & Push)
- Web Framework: FastAPI (Asynchronous REST API)
- Advanced Architecture: Implements the Repository Pattern with a decoupled
StorageInterface, allowing seamless switching between JSON and SQL databases. - Persistence Layer: Structured data handling with JSON Storage (and upcoming SQLite/SQLAlchemy support).
- Smart Validation: Integrated duplicate name check with automated name suggestions (randomized suffixes) to ensure data integrity.
- OOP Core: Deep use of inheritance, encapsulation, and Python Decorators (
@property/@setter). - Modern UI: Custom HTML Landing Page with Dark Mode support and automated Swagger documentation.
- Quality Assurance: Comprehensive test coverage for business logic and API endpoints via
unittest. - Hybrid Storage Engine: Seamlessly switch between JSON and SQLite using a dynamic
StorageFactory. - Relational Persistence: Full SQL support with optimized
UPDATEoperations andUNIQUEconstraints. - Environment-Driven Configuration: Manage storage types, file paths, and security keys via
.envand Azure App Settings. - Interactive CLI: Choose your preferred storage mode directly at startup.
The application implements a professional logging and monitoring strategy to ensure system stability and performance:
- Centralized Logging: All critical operations, data persistence events, and errors are recorded in
logs/bank_api.logand streamed tostdoutfor Docker/Azure compatibility. - Performance Middleware: A custom FastAPI middleware automatically measures and logs the response time (latency) for every incoming request.
- Production Readiness: Structured logs allow for advanced error tracking and auditing in cloud environments like Azure App Service or Container Apps.
The API implements a robust security layer based on Industry Standards:
- JWT Authentication: Secure stateless authentication using JSON Web Tokens (HS256).
- RBAC (Role-Based Access Control): Different permission levels for
admin(full access) andDEMO_USER(restricted transactions). - Password Hashing: Industry-standard encryption using
bcryptto protect user credentials. - Environment Safety: Sensitive data (Secret Keys, Hashes) are managed via Environment Variables and
.envfiles, ensuring no secrets are leaked to the repository.
Ensure you have Python 3.10+ installed.
Clone the repository and install dependencies:
pip install -r requirements.txtThe project supports both an Interactive CLI and a Web API:
Interactive Menu (CLI):
python main.pyREST API (FastAPI):
uvicorn api:app --reloadOnce started, access the Interactive API Documentation (Swagger) at:
👉 http://localhost:8000/docs
The system is built for stability. Every commit is verified via GitHub Actions. The project follows a modular structure where business logic and test suites are strictly separated. Automated tests ensure the reliability of both account logic and API endpoints.
Prerequisites:
- API testing requires
httpx(included inrequirements.txt). - Note: The database (
konten.json) is automatically initialized with default data if it is missing during the test run.
python -m unittest discover -s testsBuild and run the containerized application locally:
docker build -t bank-api .
docker run -p 8000:8000 bank-apiTechnical documentation is auto-generated from docstrings using pdoc.
To generate documentation for a specific file:
pdoc ./[filename].py -o ./dokumentationTo generate the latest documentation (Windows): Simply run the provided batch script:
generate_docs.batThe output will be generated in the ./dokumentation folder.
Bank-Management-API/
├── .github/workflows/ # CI/CD Automatisierung
│ ├── main.yml # Haupt-Workflow für Deployment/Integration
│ └── python-app.yml # Build- und Test-Automatisierung für Python
├── static/ # Statische Medien-Dateien
│ ├── favicon.ico # Icon für Web-Browser
│ ├── nr_logo.jpg # Branding Logo (JPG)
│ ├── nr_logo.png # Branding Logo (PNG)
│ └── nr_logo.webp # Optimiertes Web-Bildformat
├── tests/ # Test-Suite für Qualitätssicherung
│ ├── __init__.py # Markiert Verzeichnis als Python-Modul
│ ├── test_api.py # Integrationstests für die REST-Endpunkte
│ ├── test_banken.py # Unit-Tests für die Bank-Logik
│ └── test_konto.py # Unit-Tests für Kontofunktionen
├── .dockerignore # Schließt lokale Dateien vom Docker-Build aus
├── .env.example # Vorlage für Umgebungsvariablen (Security!)
├── .gitignore # Verhindert Upload von Unrat (z.B. __pycache__, .db)
├── api.py # FastAPI-Routing und API-Logik
├── auth_handler.py # Sicherheit: JWT Token Handling & Verschlüsselung
├── Dockerfile # Bauanleitung für das Docker-Image
├── generate_docs.bat # Skript zur automatischen Generierung der Dokumentation
├── girokonto.py # Kontoklasse für Girokonten (Vererbung)
├── json_storage.py # Speicher-Provider für JSON-Dateien
├── konto.py # Abstrakte oder Basis-Kontoklasse
├── logger_config.py # Zentrale Konfiguration für das System-Logging
├── main.py # Startpunkt der Applikation (CLI & Controller)
├── PRODUKTION_CHECKLIST.md # Sicherheitsvorgaben für den Live-Betrieb
├── README.md # Hauptdokumentation des Projekts
├── requirements.txt # Python-Paketabhängigkeiten
├── sparkonto.py # Kontoklasse für Sparkonten (Vererbung)
├── sqlite_storage.py # Speicher-Provider für SQL-Datenbanken
├── storage_factory.py # Erzeugt dynamisch den gewählten Speichertyp
└── storage_interface.py # Definiert Standards für alle Speicherarten (Interface)
*Developed as a showcase for Python Backend Development, OOP