The Definitive Blueprint of India’s Open Multi-Modal AI Document, Identity & Fraud Verification Platform
Author: Shubham Dubey • Version: 2.4 (Production Architecture) • Date: August 2026
- Executive Summary & Vision
- Non-Technical & Business Architecture
- End-to-End System Architecture
- Deep Technical Breakdown by Stage
- Stage 1: Multi-Format Ingestion & OpenCV Preprocessing
- Stage 2: Indic Neural OCR (Sarvam Vision 3B)
- Stage 3: Deterministic Indian Identity Checksums
- Stage 3.5: Deep Image Forensics (ELA & Sensor Noise)
- Stage 4: ML Anomaly Classifier (11 Features)
- Stage 5: Risk-Tiered Indic LLM Routing (Sarvam 30B / 105B)
- Stage 6: Multi-Modal Score Fusion & Override Engine
- Stage 6.5: Authenticated Ground-Truth Verification Bridge
- Stage 7: Domain-Tailored Results Dashboard
- Frontend & User Experience Architecture
- Backend, Database & Storage Architecture
- MLOps, Performance & Latency Engineering (90s → <15s)
- Codebase Map & Directory Guide
- Future Roadmap & Open Source Ecosystem
TrustScan AI is an open-source, multi-modal fraud detection and document verification platform designed specifically for the Indian digital ecosystem.
Unlike traditional KYC vendors that merely extract text or rely on expensive, private government API lookups for every document, TrustScan implements a defense-in-depth, 7-stage hybrid architecture:
-
Mathematical Checksum Rigor: Immediate zero-cost algorithmic proof (Aadhaar Verhoeff Dihedral
$D_5$ , PAN 4th-character entity rules, GSTIN state code alignment, MCA 21-digit CIN decoding). - Computer Vision & Pixel Forensics: Error Level Analysis (ELA), camera sensor noise variance, and EXIF software signature detection to catch image manipulations (Photoshop, Canva, fake UPI generators).
- Indic Multilingual OCR: Deep 23-language document layout digitization via Sarvam Vision 3B.
-
Risk-Tiered LLM Reasoning: Dynamic routing between
sarvam-30b(fast extraction) andsarvam-105b(deep forensic reasoning). - Domain-Specific Result Portals: Customized audits tailored for Government IDs, Corporate MCA records, Career Offer Letters, and Payment Receipts.
India processes billions of digital interactions monthly via UPI, DigiLocker, and online recruitment portals. However, cyber fraud and document forgery have surged exponentially:
- Fake Job & Internship Scams: Unemployed graduates receive fraudulent offer letters with fake company seals, requesting "laptop security deposits" or "training fees".
- Forged Government IDs: Aadhaar and PAN images are casually edited using mobile apps to open fraudulent accounts, obtain SIMs, or rent properties.
- Fake UPI Payment Generators: Fraudsters use modified Android APKs that generate authentic-looking Google Pay, PhonePe, or Paytm success screens to cheat merchants.
- Shell Company Impersonation: Scammers invent corporate names and issue fake invoices without valid Ministry of Corporate Affairs (MCA) registration.
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ MARKET POSITIONING │
├────────────────────────────────┬────────────────────────────────────────────────────────┤
│ Traditional KYC Solutions │ TrustScan AI Platform │
├────────────────────────────────┼────────────────────────────────────────────────────────┤
│ • Expensive per-API call fees │ • Multi-stage local validation (90% free / instant) │
│ • Generic OCR (fails in Hindi) │ • Indic VLM (Sarvam Vision 3B) supporting 23 languages │
│ • Blind to pixel tampering │ • Deep ELA pixel forensics + noise anomaly analysis │
│ • Binary Pass/Fail response │ • Explainable audit with red flags & actionable advice │
│ • Closed-source enterprise │ • Open-source core with community developer ecosystem │
└────────────────────────────────┴────────────────────────────────────────────────────────┘
- Job Seekers & Students: Upload internship/job offer letters to confirm if the issuing company has real MCA/CIN records and whether the salary arithmetic is legitimate.
- Retail Merchants & Businesses: Verify high-value UPI payment screenshots against fake APK font splicing patterns.
- HR & Compliance Officers: Audit candidate identity documents (Aadhaar/PAN) for tampering before initiating expensive background checks.
- General Consumers: Scan suspicious SMS, WhatsApp forwards, or phishing links before clicking or transferring money.
- Zero Real PII Retention: TrustScan operates on an ephemeral memory model. Uploaded identity documents are parsed in memory, evaluated, and immediately destroyed.
- UIDAI & Masking Compliance: Aadhaar numbers are automatically masked (
XXXX XXXX 1234) across logs, database records, and UI displays. - Ethical AI & Explainability: TrustScan never declares a document fraudulent without citing the exact mathematical rule, tamper heatmap, or missing corporate registry record.
TrustScan is deployed live in production at trustscanai.in:
- 🌐 Google Search Impressions:
8,260+ - 🖱️ Organic Clicks:
617(Page 1 Google rank for key Indian fraud search queries) - 📊 Real Production Scans Analyzed:
19,339+ scans- Text & WhatsApp Scans: 11,790 (61.0%)
- Payment & Transaction Receipts: 7,261 (37.5%) — Massive organic merchant demand
- Career & Identity Documents: 288 (1.5%)
flowchart TD
User([👤 User / Merchant / HR]) -->|Uploads PDF / Image / Text| Portals[🌐 4-Portal Scanner UI]
subgraph S1 [Stage 1: Preprocessing & Splitting]
Portals --> Ingest[Document Pipeline]
Ingest --> Scale[PyMuPDF 2.0x DPI Resolution Scaling]
Ingest --> Denoise[OpenCV Contrast & Grayscale Normalization]
end
subgraph S2 [Stage 2 & 3: Multi-Modal Extraction]
Scale --> OCR[🌐 Sarvam Vision 3B - Indic OCR]
OCR --> TextExtract[23-Language Text & Layout Trees]
TextExtract --> Checksums[⚖️ Deterministic Indian Checksums]
Denoise --> Forensics[🔬 Deep Image Forensics: ELA & Noise]
end
subgraph S3 [Stage 4 & 5: AI & Forensic Classification]
Checksums --> ML[📊 11-Feature Document ML Classifier]
Forensics --> ML
ML --> Router{Risk-Tiered Router}
Router -->|Low Risk p < 0.3| Sarvam30B[⚡ Sarvam-30B Fast Mode]
Router -->|High Risk p >= 0.3| Sarvam105B[🧠 Sarvam-105B Forensic Mode]
end
subgraph S4 [Stage 6 & 7: Fusion & Domain Display]
Sarvam30B --> Fusion[🎯 Multi-Modal Score Fusion Engine]
Sarvam105B --> Fusion
Fusion --> Bridge[🏛️ Ground-Truth Verification Bridge]
Bridge --> Results[📊 Tailored Domain Result Dashboard]
end
Results --> User
- Primary Source:
server/services/processing/documentPipeline.js - Ingestion: Supports PDF, JPEG, PNG, and WebP formats up to 10MB.
- PyMuPDF Rendering: Multi-page PDFs are rendered page-by-page into high-density bitmap buffers at
scale = 2.0(300 DPI) to preserve small Hindi/English fonts. - OpenCV Preprocessing: Applies adaptive Otsu thresholding, contrast normalization, and aspect ratio correction.
- Primary Source:
server/services/analysis/sarvamService.js - Technology: Sarvam AI Vision 3B Multilingual Visual Language Model (VLM).
- Capabilities:
- Supports English and 22 scheduled Indian languages (Hindi, Marathi, Bengali, Tamil, Telugu, Gujarati, etc.).
- Extracts structural hierarchy (headers, key-value fields, tabular rows).
- Primary Source:
server/services/engine/rulesEngine.js
-
Aadhaar Verhoeff Algorithm (
$D_5$ Dihedral Group):- Uses the non-commutative Dihedral group of order 10 with multiplication table
$d(j, k)$ and permutation table$p(i, j)$ :$$c = \sum_{i=0}^{n-1} p\left(i \bmod 8, a_i\right) = 0$$ - Any single-digit error or adjacent transposition fails instantly with zero network overhead.
- Uses the non-commutative Dihedral group of order 10 with multiplication table
-
PAN Card 10-Character Syntax:
- Format:
[A-Z]{3}[PCHFATBLJG][A-Z][0-9]{4}[A-Z] - 4th character strictly categorizes the entity (
P= Person,C= Company,F= Partnership Firm,T= Trust,H= HUF).
- Format:
-
GSTIN 15-Digit Tax Code:
- 2-digit State prefix (
01–37) + 10-digit embedded PAN + 1-digit entity count (1–Z) +Z+ 1-digit checksum.
- 2-digit State prefix (
-
MCA 21-Digit Corporate Identity Number (CIN):
- Format:
[U/L][0-9]{5}[STATE][YEAR][PTC/PLC][0-9]{6} - Decodes whether the company is Listed (
L) or Unlisted (U), its 5-digit Industry Code, State of Registration, Year of Incorporation, and Ownership type (PTC= Private Limited,PLC= Public Limited).
- Format:
- Primary Source:
server/scripts/image_forensics.py+server/services/analysis/imageForensicsService.js
-
Error Level Analysis (ELA):
- Re-compresses the image at 90% JPEG quality.
- Subtracts the compressed image from the original:
$\Delta = |I_{\text{original}} - I_{\text{recompressed}}|$ . - Calculates the standard deviation of error
$\sigma_{\text{ELA}}$ . Spliced text and copy-pasted numbers have distinct compression histories and light up as intense high-variance anomalies.
-
Laplacian Noise Consistency:
- Divides the image into
$32 \times 32$ patches and calculates Laplacian kernel variance. Natural photos have uniform noise distribution; modified regions show sudden variance drops.
- Divides the image into
-
EXIF & Software Signature Scanner:
- Inspects binary metadata for software tags (
Adobe Photoshop,Canva,GIMP,CorelDraw,Midjourney).
- Inspects binary metadata for software tags (
-
Primary Source:
server/scripts/train_document_rules.py - Trained logistic regression and random forest models auditing 11 weighted signals:
[lowOcrConfidence, structuralAnomalies, docAnomalies, metadataAnomalies, corporateAnomalies, invalidBusinessId, businessContextMismatch, isAiGenerated, isManipulated, registrationFee, unofficialDomain] -
Performance:
$100%$ fraud recall against adversarial Indian document datasets.
-
Primary Source:
server/services/analysis/sarvamService.js - Dynamic routing strategy minimizing API latency and cost while maximizing forensic accuracy:
- 🟢 Tier 1 (
$p < 0.30$ and Checksums Valid): Routed tosarvam-30bfor sub-second structured extraction. - 🔴 Tier 2 (
$p \ge 0.30$ or Checksum/ELA Failure): Routed tosarvam-105bfor multi-step forensic reasoning and cross-examination.
- 🟢 Tier 1 (
-
Primary Source:
server/services/engine/rulesEngine.js -
Deterministic Math Floor: If an Aadhaar Verhoeff checksum fails, a PAN entity code is invalid, or a salary slip breaks arithmetic balance, the overall Trust Score is strictly capped at
$\le 10%$ (High Risk) regardless of LLM sentiment. -
Standard Fusion Formula:
$$\text{FinalTrustScore} = (0.40 \times \text{ML_Score} + 0.60 \times \text{LLM_Score}) \times 100$$
- Primary Source:
server/services/verification/verificationBridge.js - Non-blocking ground-truth connectors:
- MCA Master Data API: Validates real-time corporate filing status.
- GST Search Registry: Validates active taxpayer status.
- RBI IFSC Directory: Resolves 11-digit bank IFSC codes to Branch, City, and State.
- Primary Source:
client/src/app/results-dashboard/components/Instead of a generic screen, TrustScan dynamically renders one of 4 dedicated result experiences:
- 🏛️
GovIdVerificationCard.tsx: Checksum status badge, Roboflow visual landmark checks, and ELA tamper variance scores. - 💳
PaymentReceiptCard.tsx: 12-digit UPI UTR audit, NPCI syntax check, IFSC branch resolver, and fake APK font tampering alerts. - 💼
CareerDocumentCard.tsx: MCA corporate cross-match, CTC arithmetic balance breakdown, and Canva/Photoshop edit traces. - 🏢
BusinessVerificationCard.tsx: 21-digit MCA CIN decoding and GSTIN state mapping.
- Framework: Next.js 16 (App Router) + React 19 + TypeScript.
- Styling & Design System: Tailwind CSS + Vanilla CSS tokens, glassmorphism, responsive dark mode, and micro-animations.
- Core User Flow:
- Landing Page (
client/src/app/page.tsx): Hero banner, live stats, interactive quick scanner modal. - Universal Scanner (
client/src/app/scan-interface/): 4 distinct tabs (Company, Document, Govt ID, UPI Receipt) with drag-and-drop file upload. - Results Dashboard (
client/src/app/results-dashboard/): Instant threat score, domain cards, explainable red flags, and PDF report downloads.
- Landing Page (
- Server Runtime: Node.js v18+ with Express REST API and Python 3.10 microservices.
- Dual-Database Architecture:
- 🍃 MongoDB Atlas: Houses flexible, unstructured document payloads, extracted OCR trees, signal hashes, and deep scan reports.
- 🐘 PostgreSQL: Houses relational user accounts, authentication tokens, API keys, and audit logging metrics.
- Authentication & Rate Limiting: JWT-based stateless tokens with tiered rate-limiting protecting against abuse.
- Initial Bottleneck: Synchronous execution of multi-page rendering, deep neural OCR, and LLM inference on the main Node.js event loop caused 90-second timeouts.
- Engineering Solution:
- Implemented an asynchronous worker pool with concurrency limits.
- De-coupled CPU-heavy image forensics into isolated Python subprocesses.
- Added parallel pipeline execution for deterministic checksums and ML scoring while the OCR stream finishes.
- Overall processing time reduced by 85% (under 15 seconds for multi-page documents).
CheckIt/
├── ARCHITECTURE.md # Quick 7-Stage Pipeline Guide for Contributors
├── CONTRIBUTING.md # Open-source Contribution & PR Guidelines
├── TRUSTSCAN_MASTER_ARCHITECTURE_GUIDE.md # Master Comprehensive Blueprint (This File)
├── README.md # Project Overview & Visual Showcase
│
├── client/ # Next.js 16 Frontend Application
│ └── src/app/
│ ├── scan-interface/ # 4-Portal Scanner UI
│ ├── results-dashboard/ # Domain-Specific Result Cards
│ ├── company-report/ # MCA Master Data Viewer
│ └── admin/ # Admin Analytics & Telemetry
│
├── server/ # Node.js Backend Server
│ ├── routes/ # Express REST Endpoints (/api/scan, /api/auth)
│ ├── services/
│ │ ├── processing/ # Document Pipeline, OCR Processor, Report Generator
│ │ ├── analysis/ # Sarvam AI, Image Forensics, Visual Inspector
│ │ ├── engine/ # Rules Engine & Recommendation Engine
│ │ └── verification/ # MCA, GSTIN, and IFSC Verification Bridge
│ └── scripts/ # Python ML & Forensics Microservices
│
└── data/kaggle/ # Ground-truth Indian Fraud & Scam Datasets
- 📱 Mobile Native SDKs: Lightweight React Native / Flutter SDK for on-device Indian ID verification.
- 🚗 MoRTH Driving License & Passport MRZ Parsers: Expand deterministic rules to Driving Licenses and International Civil Aviation Organization (ICAO 9303) passport formats.
- 🏛️ DigiLocker Integration: Direct OAuth2 verification for verifiable credential issuance.
- 🌐 Community Threat Intelligence: Crowdsourced scam database for newly emerging fraudulent UPI handles and WhatsApp scam numbers across India.
© 2026 TrustScan AI. Designed & Engineered with ❤️ by Shubham Dubey. 🛡️💎🇮🇳