Protecting βΉ4,000 Crore of small business dreams. One alert at a time.
π Quick Start Β β’Β ποΈ Architecture Β β’Β π§ ML Engine Β β’Β π Project Structure Β β’Β π§ͺ Testing Β β’Β π₯ Demo Video
India is witnessing the world's most successful digital payment revolution via UPI. However, this success has a dark side. Small merchants β the backbone of Bharat β are being targeted by sophisticated fraud syndicates.
Important
The Problem:
- Language Barrier: 100% of existing fraud tools are in English. Rural merchants are left in the dark.
- Latency Gap: Bank-side fraud detection takes minutes. Fraudsters vanish in seconds.
- Cost Barrier: Enterprise security costs thousands of dollars. Small merchants have zero budget.
PaySentinel was born to bridge this gap. We built a system that doesn't just block transactions β it explains them to the merchant in their native tongue, for free, in under 100 milliseconds.
"Why this over existing fraud tools?" This section answers that directly.
| Capability | Traditional Bank Fraud Stack | Generic SME Fraud SaaS | PaySentinel |
|---|---|---|---|
| Primary user focus | Large institutions | Online businesses | Indian small merchants (UPI-first) |
| Language accessibility | Mostly English | Mostly English | Kannada + Hindi + Tamil + Telugu + English |
| Explainability for non-technical users | Low | Medium | High (plain-language explanation + SHAP reasons) |
| Voice-based actionability | Rare | Rare | Built-in multilingual voice alerts |
| Offline fallback for alerts | Rare | Rare | Available (pyttsx3 fallback) |
| Forensic evidence output | Internal systems only | Limited exports | PDF fraud certificates + QR proof |
| Real-time simulation + stream pipeline | Internal only | Often add-on | Native Kafka + SSE support |
| Cost profile for small shops | High | Medium | Open-source and low-cost deployable |
- Bharat-first design: Built for the exact UPI merchant segment that is underserved by English-only fraud tools.
- Trust + action, not just score: Detection, explanation, voice warning, and forensic report in one flow.
- Deployability: Works as local Flask app, containerized production stack, and stream-enabled architecture.
- Enterprise controls: API key protection, rate limiting, signed model cache, security headers, and rotating logs.
PaySentinel is built as a high-performance, forensic-grade application with a clear separation of concerns.
graph TD
subgraph "External Sources"
A[UPI CSV Logs] --> D[Forensic Gateway]
B[Kafka Live Stream] --> D
end
subgraph "PaySentinel Core (Python/Flask)"
D --> E[Feature Engineering Engine]
E --> F{Triple ML Ensemble}
F --> G[Isolation Forest]
F --> H[One-Class SVM]
F --> I[Local Outlier Factor]
F --> J[Inference Merger]
J --> K[SHAP Explainer]
end
subgraph "Output Layer"
K --> L[Regional Voice Engine]
K --> M[Forensic PDF Generator]
K --> N[Stark-Tech Dashboard]
L --> O[Kannada/Hindi/Tamil Alerts]
M --> P[QR-Signed Certificates]
end
style D fill:#0d1117,stroke:#00f5d4,stroke-width:2px
style F fill:#0d1117,stroke:#ff7043,stroke-width:2px
style K fill:#0d1117,stroke:#ffc107,stroke-width:2px
We follow a clean, modular Frontend-Backend Separation designed for high-speed delivery and auditability.
Pay_Sentinel/
βββ src/ # π§ Core Engine
β βββ app.py # Flask API Gateway & Controller
β βββ model.py # Triple ML Ensemble Core
β βββ generate_data.py # Forensic Synthetic Data Generator
β βββ pdf_report.py # Bilingual QR-Signed Certificates
β βββ voice_alerts.py # Regional NLP Voice Engine
β β
β βββ frontend/ # π¨ Modern UI Layer
β βββ templates/ # Index & Dashboard (Glassmorphism)
β βββ static/ # Frontend Assets
β βββ images/ # HUD, Backgrounds, Section Visuals
β βββ css/ # Global Styles & Animations
β
βββ tests/ # π§ͺ Quality Assurance (99 Tests)
βββ models/ # πΎ Serialized ML Models
βββ docs/ # π Enterprise Documentation
βββ Dockerfile # π³ Production Containerization
βββ requirements.txt # π¦ Pinned Dependencies
The journey of a transaction from a raw log to a regional voice alert follows a strict, high-speed pipeline.
- Raw Data: CSV upload or Kafka stream.
- Validation: Deep check for SQLi, XSS, and mathematical anomalies (negative amounts, extreme outliers).
- Sanitization: Bleach-based HTML stripping for merchant names.
We transform raw timestamps and amounts into 11 forensic features including velocity engines and merchant fingerprinting.
The heart of PaySentinel is a weighted ensemble of three unsupervised models:
- Isolation Forest (35%)
- One-Class SVM (35%)
- LOF (20%)
- Heuristics (10%)
- Explainability: SHAP identifies the top 4 reasons for the flag.
- Vocalize: Regional voice alerts in Kannada, Hindi, or Tamil.
| Stage | Process | Technology | Latency |
|---|---|---|---|
| Ingest | Stream / Upload | Flask + Kafka | 5ms |
| Engine | 11-Feature Vector | Pandas + NumPy | 15ms |
| Neural | Triple Ensemble | Scikit-Learn | 30ms |
| Explain | SHAP Values | SHAP Library | 35ms |
| Alert | Regional Voice | gTTS / pyttsx3 | <100ms |
# Clone the vault
git clone https://github.com/Yashaswini-V21/Pay_Sentinel.git
cd Pay_Sentinel
# Install dependencies
pip install -r requirements.txt
# Ignite the engine
python src/app.pyTip
Visit http://localhost:5000/dashboard to experience the Stark-Tech command center.
We maintain a 99% test pass rate across three specialized suites.
pytest tests/ -v --cov=.