How rmr193/super-intel works
1. System purpose
- This repo is a three-tier decision-support platform for MFS agent liquidity and risk monitoring in Bangladesh.
- It combines operational state, anomaly detection, forecasting, and human triage for bKash, Nagad, and Rocket.
2. Top-level architecture
- The system is split into:
- Frontend: interactive operator dashboard
- Backend: API and persistence layer
- ML service: separate inference service for anomaly/risk signals
- These services are designed to run locally in parallel and communicate over HTTP.
3. Frontend boundary
- The /frontend app is a React + Vite + TypeScript single-page dashboard.
- Its main job is presentation and operator interaction: charts, agent details, alert center, stakeholder queue, simulator panel, and dashboard views.
- The frontend also hosts the scenario controller used to trigger demo states and observe system behavior.
4. Frontend data responsibilities
- It appears to consume operational data from the backend and render:
- wallet/cash liquidity state
- alert status
- case/audit workflow
- forecast confidence and fallback states
- The frontend is the user-facing boundary for triage roles such as retail agent, field officer, central ops, and risk analyst.
5. Backend boundary
- The /backend service is the API layer, built with Node.js, Express, TypeScript, and Prisma ORM.
- It owns application logic and persistence access, and likely exposes endpoints consumed by the dashboard.
- The presence of src/app.ts, src/server.ts, and backend/api/index.ts suggests a standard Express app plus a deployment entrypoint.
6. Persistence layer
- The backend uses SQLite locally through Prisma, matching the README’s “stable execution without complex database dependencies” goal.
- prisma/schema.prisma defines the data model, and seed.ts initializes the system with sample agents and historical records.
- This makes the database the source of truth for agent state, case data, and historical operational signals.
7. ML inference boundary
- /ml-service is a separate Python FastAPI service.
- It provides analytics and inference rather than core app state.
- The repo includes trained artifacts such as anomaly_model.pkl and supervised_classifier.pkl, indicating the service performs offline-trained inference at runtime.
8. ML service role in the flow
- The ML service is used for:
- transaction anomaly detection
- velocity/risk scoring
- fallback-aware prediction support
- The README describes blended behavior: isolation-forest-style anomaly detection, z-score logic, and a rules-based fallback when feeds are delayed or unreliable.
9. Primary data flow
- User action begins in the frontend.
- The frontend requests current operational data from the backend.
- The backend reads/writes SQLite via Prisma.
- For risk/anomaly insights, the backend or frontend integrates with the ML service over HTTP.
- The resulting alerts, forecasts, and case states flow back to the dashboard for rendering and triage.
10. Scenario-driven simulation path
- The simulator is a core architectural feature, not just a UI demo.
- It injects controlled conditions such as:
- provider-specific cash shortage
- physical cash pressure plus suspicious transactions
- delayed provider data with fallback mode
- escalation and audit workflow
- This means the frontend is both a visualization layer and a scenario driver for the rest of the stack.
11. Alerting and triage workflow
- The system is organized around an alert lifecycle:
- detection
- display in the alert center
- queueing for stakeholder review
- acknowledgement or escalation
- audit trail persistence
- This creates a clear separation between automated detection and human decision-making.
12. Operational boundaries
- The platform distinguishes among:
- physical cash drawer liquidity
- provider wallet balances
- transaction behavior/anomaly signals
- case management / auditability
- That separation is important for an architecture diagram because it shows multiple correlated but distinct data domains.
13. Local runtime and packaging
- Each service has its own runtime and packaging:
- frontend: Vite dev server and static build
- backend: Node/Express process
- ML service: Uvicorn-hosted FastAPI app
- Dockerfiles exist for each component, and there is a docker-compose.yml, but the README emphasizes local multi-terminal execution with SQLite as the simplest stable path.
14. Deployment hints
- vercel.json files at the root and backend level suggest the project may have been prepared for serverless or hosted deployment, but the repository’s operational design is clearly service-based and local-first.
- For diagramming, treat deployment as optional packaging around the three core services rather than the main architectural driver.
15. What to show in an architecture diagram
- The diagram should emphasize:
- a React dashboard at the edge
- an Express/Prisma/SQLite application backend in the middle
- a separate Python ML inference service
- bidirectional flows for alerts, forecasts, and case updates
- an audit/triage loop that keeps human operators in control
Main entry points: App.tsx Dashboard · app.ts API App · main.py Inference API · docker-compose.yml Compose
Components 18
Frontend
React operator dashboard and scenario driver
- Dashboard · Operator-facing interface for monitoring, triage, and simulation
frontend/src/App.tsx - Entry · Frontend application bootstrap and mount point
frontend/src/main.tsx - Overview · Main operational dashboard and summary panels
frontend/src/components/DashboardView.tsx - Agents · Agent liquidity and detail inspection panel
frontend/src/components/AgentDetailsView.tsx - Alerts · Alert display and triage center
frontend/src/components/AlertsCenterView.tsx - Queue · Stakeholder review and escalation queue
frontend/src/components/StakeholderQueueView.tsx - Simulator · Controls for injecting demo states and operational stress
frontend/src/components/SimulatorPanel.tsx
Backend
Express API and persistence layer
- API App · HTTP application layer and business logic
backend/src/app.ts - Server · Backend runtime entrypoint and listener
backend/src/server.ts - API Entry · Alternate backend entry used for hosting or routing
backend/api/index.ts - Schema · Database schema for agents, cases, and operational state
backend/prisma/schema.prisma - Seed · Initial sample agents and historical records
backend/prisma/seed.ts - SQLite · Source of truth for persistent operational state
ML Service
Python inference and alert scoring service
- Inference API · Python service for anomaly and risk scoring
ml-service/main.py - Anomaly Model · Offline-trained anomaly detector used at inference time
ml-service/anomaly_model.pkl - Classifier · Supervised scoring model for fallback-aware prediction support
ml-service/supervised_classifier.pkl
Connections 20
- Entry → Dashboard: mounts · Bootstraps the dashboard UI
- Dashboard → Overview: renders · Composes the main operational overview
- Dashboard → Agents: renders · Shows per-agent liquidity and status
- Dashboard → Alerts: renders · Surfaces active alerts for triage
- Dashboard → Queue: renders · Supports escalation and review workflow
- Dashboard → Simulator: drives · Injects scenario conditions and demo states
- Dashboard → API App: http · Fetches and updates operational data
- Server → API App: starts · Runs the Express application process
- API Entry → API App: entry · Alternative hosted entrypoint
- API App → Schema: uses · Implements persistence contract through Prisma
- API App → SQLite: reads/writes · Stores agent state, cases, and history
- Seed → SQLite: initializes · Loads sample records into the database
- API App → Inference API: http · Requests anomaly and risk signals
- Inference API → Anomaly Model: loads · Uses trained detector at runtime
- Inference API → Classifier: loads · Uses supervised model for scoring support
- Simulator → API App: scenario api · Triggers controlled operational scenarios
- Compose → Dashboard: runs · Coordinates frontend service container
- Compose → API App: runs · Coordinates backend service container
- Compose → Inference API: runs · Coordinates ML service container
- Vercel → API Entry: hosts · Optional deployment routing for backend entry