How saadmk11/banking-system works
Project Type and Purpose
• Full-stack web application built with Django (MTV/MVC)
• Provides online banking features: account creation, deposit/withdraw, transaction reports, interest calculation via Celery
• Uses Tailwind CSS for modern UI
File Structure
• Top-level “banking_system” folder: Django project settings (asgi.py, wsgi.py, settings.py, celery.py)
• Three Django apps under project root:
– accounts (user auth, registration, admin models)
– transactions (deposit/withdraw logic, models, Celery tasks)
– core (home page, shared views, base templates)
• templates/: frontend HTML (organized by app)
• Celery configuration in banking_system/celery.py, django-celery-beat scheduled tasks
• requirements.txt indicates Django, Celery, Redis
Key README Insights
• Monthly interest calculation scheduled via Celery Beat + Worker
• Redis as message broker
• PostgreSQL/MySQL (generic RDBMS) for persistence
• Local dev uses manage.py runserver + celery commands
Main Components
a. Client / Browser
– Sends HTTP/HTTPS requests
– Renders HTML/CSS (Tailwind)
b. Django Web Application (Monolith)
– HTTP Server (Gunicorn/ASGI or built-in dev server)
– URL Router (banking_system/urls.py → app URLs)
– View Layer (accounts/views.py, transactions/views.py, core/views.py)
– Template Layer (templates/*.html)
– Models/ORM (accounts/models.py, transactions/models.py, core/models.py)
c. Relational Database
– Stores Users, Accounts, Transactions, Interest rules, etc.
d. Message Broker (Redis)
– Queues Celery tasks
e. Celery Worker(s)
– Executes asynchronous tasks (calculating interest, sending notifications)
f. Celery Beat Scheduler
– Triggers periodic interest-calculation tasks
Relationships and Interactions
1) Client → Web App
• HTTP GET/POST → Django views → ORM → DB → render HTML → response
2) Web App → DB
• Synchronous reads/writes for accounts & transactions
3) Web App → Redis
• When a transaction occurs or at month-end, view or signal enqueues Celery task
4) Celery Beat → Redis
• Periodic “calculate monthly interest” tasks enqueued
5) Celery Worker → Redis
• Worker polls Redis, fetches tasks
6) Celery Worker → DB
• Updates account balances, writes transaction records
Architectural Patterns & Principles
• Monolithic Django “apps” as modules (accounts, transactions, core)
• MTV (Model-Template-View) pattern
• Asynchronous task processing (Celery for scalability & non-blocking work)
• Separation of concerns:
– HTTP request-response cycle vs. background job processing
– UI layer vs. business logic layer vs. data layer
Putting It All Together
• Layer 2 (Web App): Django (views/templates/models) → DB
↘ enqueue → Redis
• Layer 3 (Async): Celery Beat → Redis → Celery Worker → DB