Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ KAVACH - Smart UPI Payment App

KAVACH Logo Platform License

Next-Generation UPI Payment App with AI-Powered Fraud Detection & Multi-Language Voice Assistant

Features β€’ Tech Stack β€’ Installation β€’ Documentation β€’ Architecture


πŸ“± Overview

KAVACH is a comprehensive UPI payment application designed for the Indian market, featuring advanced security, multi-language support, and accessibility-first design. Built with cutting-edge fraud detection using Machine Learning and Natural Language Processing, KAVACH ensures safe and secure digital transactions for everyone.

🎯 Key Highlights

  • πŸ€– AI-Powered Fraud Detection - Real-time ML-based transaction and OTP fraud analysis
  • πŸ—£οΈ Voice Assistant - Voice-powered UPI transactions in 22+ Indian languages
  • πŸ”’ Advanced Security - Biometric authentication, behavioral analysis, SIM binding
  • πŸ’° Complete Loan System - Apply, track, and manage loans with EMI calculator
  • πŸ“± QR Payments - Scan and generate UPI QR codes instantly
  • 🚫 Spam Detection - Identify fraudulent SMS and calls
  • 🌍 Multi-Language - Support for 22 Indian regional languages
  • πŸ“΄ Offline OTP - TOTP-based offline OTP generation
  • πŸ“Š Behavior Analytics - Real-time user behavior monitoring

✨ Features

πŸ” Security & Fraud Protection

Feature Description
ML Fraud Detection Hugging Face BERT integration for OTP and transaction fraud analysis
Real-time Monitoring SMS and transaction monitoring with risk scoring
Behavioral Biometrics Touch patterns, typing speed, and cursor tracking analysis
Spam Detection AI-powered SMS and call spam identification
SIM Binding Auto-logout and data wipe on SIM card change
Screen Security Screenshot and screen recording prevention

πŸ’³ Payment Features

Feature Description
Voice Transactions Voice-powered UPI payments with speech-to-text
QR Code Payments Scan merchant QR codes or generate personal QR codes
Contact Picker Send money to contacts directly
Transaction History Complete payment history with fraud scores
Offline OTP TOTP-based OTP generation without internet
Balance Check Real-time balance inquiry

🏦 Loan Management

Feature Description
Loan Application Apply for Personal, Business, Education, Home, Vehicle loans
EMI Calculator Real-time EMI calculation with amortization schedule
Loan Dashboard Track all loans (Pending, Active, Completed)
EMI Payments Pay EMIs with due date reminders
Early Payment Calculate savings on early loan closure

🌐 Accessibility & Localization

Feature Description
22+ Languages Hindi, Bengali, Telugu, Tamil, Marathi, Gujarati, Kannada, Malayalam, Punjabi, Odia, Assamese, Urdu, and more
Voice Assistant Hands-free operation for visually impaired users
Text-to-Speech Screen reader support
Simple UI Senior-citizen friendly interface
Educational Videos UPI tutorial videos in regional languages

πŸ“Š Analytics & Monitoring

Feature Description
Behavior Dashboard Visualize typing patterns, cursor movements, gestures
Fraud Alerts Real-time notifications for suspicious activities
Activity Logs Complete audit trail of user actions
Security Dashboard Centralized security status overview
SMS Fraud Dashboard Monitor and manage SMS fraud detections

πŸ—οΈ Tech Stack

Frontend (Mobile App)

React Native 0.81.5 + Expo ~54.0.25
Category Technologies
Framework React Native, Expo
Navigation @react-navigation/native, @react-navigation/native-stack
State Management React Context API, React Hooks
UI Components react-native-gesture-handler, react-native-safe-area-context
Internationalization i18next, react-i18next
Authentication expo-local-authentication (Fingerprint/Face ID)
Camera & QR expo-camera, react-native-svg
Speech/Voice expo-speech, @deepgram/sdk
Security expo-screen-capture, expo-secure-store
Storage @react-native-async-storage/async-storage

Backend (API Server)

Node.js + Express + MongoDB
Category Technologies
Runtime Node.js
Framework Express 4.18.2
Database MongoDB, Mongoose 8.0.3
Authentication jsonwebtoken, bcryptjs
ML/NLP Natural 6.10.2, Axios (Hugging Face API)
Security OTPLib 12.0.1, express-validator
QR Codes qrcode 1.5.3
File Upload multer 1.4.5
CORS cors 2.8.5

External Services

Service Purpose
Hugging Face ML-based fraud detection (BERT models)
Deepgram Speech-to-Text for voice assistant
Cashfree Payment gateway integration
MongoDB Atlas Cloud database (production)

πŸš€ Installation

Prerequisites

  • Node.js (v18 or higher) - Download
  • MongoDB (v6.0 or higher) - Download
  • Git - Download
  • Expo CLI - Install via npm
  • Android Studio (for Android) or Xcode (for iOS)

Quick Start (Windows)

# Clone the repository
git clone https://github.com/Debjyoti-sarkar/KAVACH.git
cd KAVACH

# Run automated setup
.\quick-start.ps1

Manual Setup

1. Install Dependencies

# Install frontend dependencies
npm install

# Install backend dependencies
cd backend
npm install
cd ..

2. Configure Backend

Create backend/.env file:

# Server Configuration
PORT=5000
NODE_ENV=development

# Database
MONGO_URI=mongodb://localhost:27017/kavach

# Authentication
JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters

# ML Services (Optional)
HUGGING_FACE_TOKEN=your_huggingface_token_here

3. Start MongoDB

Windows:

mongod --dbpath="C:\data\db"

macOS/Linux:

brew services start mongodb-community

4. Start Backend Server

cd backend
npm run dev

Verify at: http://localhost:5000

5. Configure Frontend API

Edit services/api.ts:

export const API_URL = __DEV__
  ? "http://localhost:5000/api"      // For emulator/simulator
  : "https://your-api.com/api";      // For production

For Android Emulator: Use http://10.0.2.2:5000/api

6. Start Expo App

npm start

Then:

  • Press i for iOS simulator
  • Press a for Android emulator
  • Scan QR code with Expo Go app for physical device

πŸ“– Documentation

Document Description
SETUP_GUIDE.md Complete installation and deployment guide
FEATURES_README.md Detailed feature documentation
MERGE_COMPLETE.md Feature integration summary
backend/README.md Backend API documentation
QUICKSTART.md Quick start guide

πŸ›οΈ Architecture

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Mobile App (Expo)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Screens  β”‚  β”‚ Services β”‚  β”‚ Context/Hooks   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚       β”‚             β”‚              β”‚                β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚                     β–Ό                               β”‚
β”‚            API Service (Axios)                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ HTTP/REST
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Backend (Express.js)                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Routes  β”‚β†’ β”‚ Services β”‚β†’ β”‚    Models       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚       β–²              β–²              β”‚               β”‚
β”‚       β”‚              └──────────────┼───────────┐   β”‚
β”‚       β”‚                             β–Ό           β”‚   β”‚
β”‚  Middleware                    MongoDB      ML API β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

KAVACH/
β”œβ”€β”€ πŸ“± Mobile App
β”‚   β”œβ”€β”€ screens/              # All UI screens
β”‚   β”œβ”€β”€ components/           # Reusable components
β”‚   β”œβ”€β”€ navigation/           # Navigation configuration
β”‚   β”œβ”€β”€ services/             # API & utility services
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ contexts/             # Context providers
β”‚   β”œβ”€β”€ constants/            # Theme, i18n config
β”‚   └── utils/                # Helper functions
β”‚
β”œβ”€β”€ πŸ”§ Backend
β”‚   β”œβ”€β”€ models/               # 8 Mongoose models
β”‚   β”œβ”€β”€ services/             # 8 Business logic services
β”‚   β”œβ”€β”€ routes/               # 12 API route handlers
β”‚   β”œβ”€β”€ middleware/           # Auth & validation
β”‚   β”œβ”€β”€ config/               # Database configuration
β”‚   └── server.js             # Express server entry
β”‚
└── πŸ“š Documentation
    β”œβ”€β”€ SETUP_GUIDE.md
    β”œβ”€β”€ FEATURES_README.md
    └── MERGE_COMPLETE.md

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user
  • PUT /api/auth/change-pin - Change PIN

Transactions

  • POST /api/transactions/send - Send money (with fraud check)
  • GET /api/transactions - Get transaction history
  • GET /api/transactions/:id - Get transaction details

Fraud Detection

  • POST /api/ml/analyze-text - ML text analysis
  • POST /api/ml/analyze-otp - OTP fraud detection
  • GET /api/fraud-alerts - Get fraud alerts
  • POST /api/fraud-alerts - Create fraud alert

Loans

  • POST /api/loans/apply - Apply for loan
  • GET /api/loans - Get user loans
  • GET /api/loans/:id - Get loan details
  • GET /api/loans/:id/emis - Get loan EMI schedule

EMI

  • GET /api/emi - Get user EMIs
  • GET /api/emi/due - Get due EMIs
  • POST /api/emi/:id/pay - Pay EMI

QR Codes

  • POST /api/qr/generate - Generate UPI QR code
  • POST /api/qr/parse - Parse QR code

Spam Detection

  • POST /api/spam/analyze-message - Analyze SMS
  • POST /api/spam/analyze-phone - Check phone number
  • POST /api/spam/check-otp-legitimacy - Verify OTP message

Offline OTP

  • GET /api/offline-otp/generate - Generate TOTP
  • POST /api/offline-otp/verify - Verify TOTP

Full API documentation: backend/README.md


πŸ§ͺ Testing

Backend Testing

cd backend

# Test health check
curl http://localhost:5000

# Test user registration
curl -X POST http://localhost:5000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"phoneNumber":"9876543210","name":"Test User","pin":"123456"}'

Frontend Testing

# Clear cache and restart
npm start -- --clear

# Run on specific platform
npm run ios
npm run android

πŸ” Security Features

  • βœ… JWT Authentication - Secure token-based auth
  • βœ… PIN Hashing - bcrypt password hashing
  • βœ… Biometric Auth - Fingerprint/Face ID support
  • βœ… Screen Security - Screenshot/recording prevention
  • βœ… SIM Binding - Device security with SIM verification
  • βœ… CORS Protection - Cross-origin request filtering
  • βœ… Input Validation - express-validator for all inputs
  • βœ… Activity Logging - Complete audit trail
  • βœ… Fraud Scoring - ML-based risk assessment

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘₯ Authors


πŸ™ Acknowledgments

  • Hugging Face for ML models
  • Expo team for the amazing framework
  • MongoDB for database solutions
  • React Native community

πŸ“ž Support

For issues and questions:


Made with ❀️ for safer digital payments in India

⭐ Star this repository if you find it helpful!

πŸ“₯ Download β€’ πŸ“– Docs β€’ πŸ› Report Bug

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages