How kaivals/the-chronobank works
Project Type and Purpose
• The-ChronoBank is a monolithic Flask-based full-stack web app where “time” is the currency.
• Frontend: HTML templates (served by Flask), plus static assets (packaged in static.zip, admin.zip).
• Backend: Python, employing MVC-style separation via route modules and rich domain/service layer.
• Integrations: A blockchain network (blockchain.py) and a legacy banking system adapter (adapter_legacy_system.py).
Main Components
A. Client / Presentation Layer
• Web Browsers
• HTML templates (e.g. index.html, login.html, dashboard.html, etc.)
• Static assets (CSS/JS) unpacked from static.zip
B. Web Server / Controllers
• app.py (Flask entry point)
• Route modules:
– banking_routes.py
– alert_routes.py
– goal_routes.py
– strategy_routes.py
– Others: apply_loan.py, transactions.py, etc.
C. Business / Domain Layer
• Account management:
– account_factory.py (Factory pattern)
– account_state.py (State pattern)
– account_status.html (UI view)
• Loan & repayment:
– apply_loan.py
– repayment_strategy.py (Strategy pattern)
– repay.py, repayment_success.html
• Goals & commands:
– goal_base.html, goal_command.py, goal_models.py
• Transactions:
– transactions.py, view_transactions.html, money_time_transactions.py
• Account customization:
– customize_account.py, customize_account_builder.py (Builder pattern)
• Alerts & notifications:
– alert_routes.py, alerts.html
D. Integration & Infrastructure Layer
• singleton_db.py (Singleton DB connection, uses scripts in sql.zip)
• Adapter patterns:
– adapter.py (generic)
– adapter_legacy_system.py
• Facade: facade.py (simplify complex subsystems)
• Observer: observer.py (event subscription for alerts)
• Blockchain integration: blockchain.py
E. External Systems
• Decentralized blockchain network
• Legacy banking system
Relationships & Data Flow
• Client → HTTP request → Flask (app.py)
• Flask routes invoke Controllers → Domain services
• Domain services coordinate via design patterns (Factory, Strategy, Command, Observer, Builder, Facade)
• Services read/write via singleton_db.py (persistent store)
• Certain services call out to:
• Blockchain network (blockchain.py)
• Legacy system via adapter (adapter_legacy_system.py)
• Responses flow back through Controllers → Templates → Client
Architectural Patterns & Principles to Highlight
• Layered architecture: Presentation → Controller → Domain → Data/Infrastructure
• Design patterns ensuring modularity & extensibility:
• Factory (account creation)
• Builder (account customization)
• Strategy (repayment calculations)
• Command (goal operations)
• Observer (alerts)
• Adapter & Facade (external integrations)
• Singleton (database connection)