How drift-labs/v2-risk-dashboard works
Main Components
• Backend API Server:
– Indicate tasks such as snapshot processing (backend/tasks) which show asynchronous or background operations.
• Frontend Application:
– Represent pages or modules under src/page (asset_liability, deposits, health, etc.).
• Cache Generation Process:
– Represent a separate process or “Cache Generator” (triggered by gen.sh) that pre-computes the heavy endpoints.
• Shared Services/Libraries:
– Include the “shared” directory components and any common utilities (backend/utils, src/lib, etc.) that are used across the application.
• Infrastructure and Deployment Components:
– Docker: Represent Docker components (Dockerfile-backend, Dockerfile-frontend & docker-compose.yaml) indicating containerization.
Relationships and Interactions
• Directional flow from the Cache Generation Process to the Backend API, indicating that once the CPU-heavy data is computed, it is cached and then served by the API endpoints.
• Backend API to middleware components that manage caching and service readiness, highlighting data flow between these layers.
• That shared libraries and utilities are used across both the backend and frontend.
Architectural Patterns/Design Principles
• Separation of concerns:
– Frontend (UI/Presentation) in one container/process.
– Backend (API and data processing) in another.
• Use of background tasks for heavy computation and caching mechanisms.
• Deployment strategies (Docker containers, CI/CD pipelines, and Kubernetes) that allow clean separation and scaling.
Technologies and Frameworks
• Backend: Python, Gunicorn for the server, custom API modules, and middleware for caching and health checks.
• Frontend: Streamlit for the UI.
• Deployment: Docker (Dockerfiles and docker-compose), GitHub Actions for CI/CD, and Kubernetes for production deployment.
• Utility scripts: gen.sh and various scripts in backend/scripts to handle cache generation.
– Separate components for backend (with internal modules like API, middleware, tasks) and frontend.
– Clearly indicate the process for heavy computations and caching.
– Define integration points (HTTP requests, internal data flows) between components.
• Avoid oversimplifying. Instead, strive for clarity by breaking down the system into as many well-labeled, interacting parts as possible.