Real-Time Bank Transaction Simulator & Fraud Detection Engine
Features β’ Quick Start β’ Architecture β’ Contributing
- Overview
- The Problem
- Our Solution
- Key Features
- System Architecture
- Technology Stack
- Quick Start
- Demo Script
- API Documentation
- Roadmap
- Contributing
- License
SentinelBank is a real-time bank transaction simulator featuring a live rule-based fraud detection engine. Engineered for instantaneous risk scoring and monitoring, the system evaluates and classifies live transactions into Safe (green), Suspicious (orange), or Fraud (red) categories, updating connected clients instantly over WebSockets.
Provide a dynamic, interactive demonstration of real-time fraud analysis, moving beyond static spreadsheets to visualize how complex patterns like circular transactions and chain layering can be detected and mitigated instantly.
- Desktop Dashboard (
/): A monitoring center for tracking live events, fraud alerts, and engine telemetry. - Mobile Bank App (
/mobile): A client interface simulating user transfers and real-time push notifications. - Background Engine: A self-driving simulation core delivering autonomous transaction volume.
Traditional fraud monitoring often relies on delayed, batch-processed transaction analysis, leading to critical visibility gaps:
|
|
graph LR
A[Mobile Client] -->|POST Transaction| B[FastAPI Engine]
B --> C{Fraud Rules Engine}
C -->|NetworkX Path Check| D[Graph Analysis]
C --> E[SQLite Database]
E --> F[WebSocket Broadcaster]
F -->|Live Feed| G[Desktop Dashboard]
F -->|Instant Notification| H[Mobile Client]
style A fill:#667eea
style B fill:#764ba2
style C fill:#f093fb
style D fill:#4facfe
style E fill:#00f2fe
style F fill:#43e97b
style G fill:#38f9d7
style H fill:#4facfe
Every transaction is an active event.
The rule engine evaluates immediately.
The dashboard visualizes instantaneously.
By maintaining robust real-time synchronization, the platform ensures that system operators and account holders share a unified, immediate truth state.
| π Real-time Sync | π‘οΈ Fraud Engine | π Live Dashboard | π± Mobile Client |
|---|---|---|---|
| WebSocket Data | NetworkX Graph | Transaction Feed | Seeded Accounts |
| Live Reconnection | Value Thresholds | System Analytics | Instant Alerts |
| Sub-second Update | Multi-rule Scoring | Alert Feed | Block Visiblity |
- π View live, streaming transaction feeds in real-time.
- π¨ Receive immediate, color-coded Fraud Alerts.
- π― Inject demo fraud scenarios (e.g., Circular, Layering, Burst) on demand.
- βοΈ Control the background transaction generator (Start/Pause/Stop).
- πΈ Quickly select seeded demo accounts and execute transfers.
- π° Instantly receive incoming-payment notification banners.
- π Experience instant transaction blocking upon triggering a fraud rule.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Interfaces (React) β
β Desktop Dashboard (Monitor) β’ Mobile App (Accounts) β
ββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ²βββββββββ
HTTP REST β β WebSockets
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ΄βββββββββ
β Application Layer (FastAPI) β
β ββββββββββββββ¬ββββββββββββββ¬ββββββββββββββ¬βββββββββββββββ β
β β API β Fraud Core β Auto Engine β WS Manager β β
β ββββββββββββββ΄ββββββββββββββ΄ββββββββββββββ΄βββββββββββββββ β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β SQLAlchemy ORM
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β Database Layer (SQLite) β
β Accounts β’ Transactions β’ Alerts β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
sequenceDiagram
participant U as Mobile User
participant A as FastAPI API
participant E as Fraud Engine
participant D as SQLite DB
participant W as WebSocket
participant M as Dashboard Monitor
U->>A: Submit Transaction
A->>E: Evaluate Rules (Graph, Amounts)
E-->>A: Return Risk Score & Color
A->>D: Store Transaction & Alert (if any)
A->>W: Broadcast New State
W->>M: Instant Dashboard Refresh
W->>U: Show Success/Blocked
| Component | Technology | Purpose |
|---|---|---|
| Core API | Python + FastAPI | High-performance asynchronous API & WebSocket server |
| Storage | SQLite + SQLAlchemy | Persistence for accounts and transactions |
| Logic | NetworkX | Graph theory module for calculating circular transaction paths |
| UI Engine | React + Vite | Real-time interactive user interfaces |
| Styling | Tailwind CSS | Utility-driven UI rendering |
| State | Zustand | Managing live transaction streams frontend-side |
- Python 3.11+
- Node.js 18+
- Git
Step 1. Clone the repository
git clone https://github.com/sangsaist/SentinelBank.git
cd SentinelBank
git checkout devStep 2. Start the Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadStep 3. Configure Frontend Environment
Create .env inside the frontend directory using your Wi-Fi LAN IP address instead of localhost (vital for mobile device connectivity):
# In frontend/.env
VITE_API_URL=http://YOUR_LAN_IP:8000
VITE_WS_URL=ws://YOUR_LAN_IP:8000/wsStep 4. Start the Frontend
cd frontend
npm install
npm run dev- Desktop System Dashboard:
http://localhost:5173 - Mobile Simulator App:
http://YOUR_LAN_IP:5173/mobile(Access on your phone)
- Dashboard: Open
http://localhost:5173on a desktop. - Mobile Clients: Have team members open
http://YOUR_LAN_IP:5173/mobileon their smartphones. - Simulate Background Noise: Click the Start (
βΆοΈ ) button on the dashboard to enable the autonomous transaction engine. - Trigger Fraud: On a mobile client, log into Account A and transfer βΉ95,000 to Account B.
- Watch the desktop dashboard instantly flash a RED Alert (
HIGH_VALUE_TRANSFER). - The mobile client immediately receives a Blocked status.
- Watch the desktop dashboard instantly flash a RED Alert (
- Trigger Safe Txn: Send βΉ500 from A to B.
- Dashboard logs a GREEN (Safe) transaction.
- User B's phone displays a real-time π° Money Received banner.
- Inject Attacks: Use the dashboard's
Fraud Queue Builderto simulate Layering, Smurfing, or Circular bypass attempts.
| Method | Endpoint | Description |
|---|---|---|
GET |
/transactions |
Fetch latest historical transactions. |
GET |
/fraud-alerts |
Fetch queued history of fraud detections. |
POST |
/transaction |
Process a new transfer and run anti-fraud heuristics. |
POST |
/engine/start |
Ignite continuous background data simulator. |
POST |
/inject/{id} |
Inject specific attack vectors (Rapid Burst, Circular, etc). |
π View Transaction JSON Structure
Submit Transaction:
curl -X POST http://localhost:8000/transaction \
-H "Content-Type: application/json" \
-d '{
"sender_id": "A",
"receiver_id": "B",
"amount": 50000
}'WebSocket Live Broadcast Response:
{
"type": "transaction",
"data": {
"transaction_id": "f5a7d23a",
"sender_id": "A",
"receiver_id": "B",
"amount": 50000,
"timestamp": "2026-03-14T10:00:00.000000+00:00",
"is_fraud": 0,
"risk_score": 0.45,
"color": "orange",
"fraud_reason": "UNUSUAL_AMOUNT"
}
}- WebSockets for sub-second system observability
- NetworkX based multi-node loop mapping
- Injection tooling for mock-attack demos
- Migrate SQLite logic natively to PostgreSQL for deep-scale benchmarking
- Incorporate Machine Learning heuristic models alongside hardcoded rules
- Integrate React-Native framework structure for actual App Store simulation
SentinelBank/
βββ backend/
β βββ app/
β β βββ api/ # REST endpoint logic
β β βββ core/ # Fraud detection engine, scenario injector
β β βββ db/ # Schema models & data seeders
β β βββ schemas/ # Request/Response data contracts
β β βββ websocket/ # Live channel distributors
β βββ main.py # Server boot configuration
β βββ requirements.txt
βββ frontend/
β βββ src/
β β βββ api/ # Axial API clients
β β βββ components/ # Visual elements (StatsBar, FraudAlertFeed, etc.)
β β βββ hooks/ # Real-time WebSocket hook definitions
β β βββ pages/ # Layout routing endpoints (/ and /mobile)
β β βββ store/ # Zustand memory cache parameters
β βββ package.json
βββ README.md
Contributions are heavily encouraged for the advancement of real-time monitoring strategies!
- Fork the repository.
- Create a feature branch:
git checkout -b feature/enhanced-engine - Commit your progress:
git commit -m 'feat: Add parallel scanning queue' - Push into the branch:
git push origin feature/enhanced-engine - Open a Pull Request against
dev.
This repository is distributed under the MIT License. Check the LICENSE file for additional terms.
Visualizing complex cyber-financial telemetry before it settles.