๐ 2nd Runner-Up | SHIELD 1.0 Hackathon | BPR&D X MNIT Jaipur Best Solution for Track #3: Real-Time Database for Delivery Personnel Verification
- Overview
- Problem Statement
- Solution
- Key Features
- Architecture
- Technology Stack
- Getting Started
- User Portals
- How It Works
- API Documentation
- Deployment
- Demo Credentials
- Project Structure
- Security Features
- Contributing
- License
- Acknowledgments
VerifyChain is a comprehensive, AI-powered real-time verification database system designed to secure India's gig economy by enabling instant background verification of 10+ million delivery personnel and banking agents. The platform provides a centralized, decentralized verification network accessible to multiple stakeholders including law enforcement, employers, banks, and citizens.
- โ Multi-Stakeholder Platform: Serves workers, employers, police, banks, and citizens
- โ Real-Time Verification: Instant QR code, OTP, and face recognition-based checks
- โ AI-Powered Risk Analysis: Claude AI integration for intelligent threat detection
- โ GPS Tracking: Live location monitoring and route validation
- โ Trust Score System: Dynamic 0-100 scoring based on 6 weighted factors
- โ Government Integration: Aadhaar/DigiLocker verification support
- โ Enterprise-Ready: Built with scalability, security, and compliance in mind
Context: With the explosive growth of India's gig economy (food delivery, e-commerce, banking agents), there's an urgent need for a centralized verification system that enables:
- Household Safety: On-demand identity verification for delivery personnel visiting homes
- Law Enforcement: Rapid background checks at checkpoints or incident sites
- Banking Security: Verification of Banking Correspondents (BC) handling Aadhaar Enabled Payment System (AePS)
- Regulatory Compliance: Streamlined police verification for gig workers
Target Beneficiaries:
- ๐ Citizens receiving deliveries at home
- ๐ฎ Police Officers conducting checkpoint verifications and investigations
- ๐ข Employers (Swiggy, Zomato, Dunzo, Amazon, Flipkart)
- ๐ฆ Banks authorizing agents for AePS transactions
- ๐ต Gig Workers seeking legitimate employment and trust-building
VerifyChain provides a comprehensive verification ecosystem that addresses all stakeholders' needs:
- Scan QR codes on delivery personnel's devices for instant verification
- Get color-coded risk status (๐ข GREEN / ๐ก YELLOW / ๐ด RED)
- Track live delivery location with ETA
- Report incidents directly through the platform
- Checkpoint verification via QR scan, phone lookup, or worker ID
- Access complete worker history: employment, incidents, police records
- AI-powered risk analysis with actionable recommendations
- Real-time status checks and investigation tools
- Pattern detection for coordinated fraud attempts
- Streamlined worker onboarding with Aadhaar verification
- Create and assign delivery tasks with auto-generated QR codes
- Real-time fleet tracking and analytics dashboard
- Monitor worker performance and trust scores
- Manage incident reports and compliance
- Verify Banking Correspondents before AePS transactions
- Check agent authorization status in real-time
- Maintain compliance with RBI regulations
- Track agent performance and incident history
- Quick registration with Aadhaar integration
- Build trust through verified employment history
- Display QR codes for easy verification
- Track earnings and performance metrics
- Transparent trust score with improvement tips
- Dynamic Time-Limited Tokens: HMAC-SHA256 signed tokens with 60-minute expiry
- Replay Attack Prevention: Nonce-based system prevents token reuse
- Embedded Assignment Data: Contains worker ID, employer ID, assignment details
- Offline-First Design: Works with limited connectivity
- 6-Digit Codes: Redis-backed with 10-minute TTL
- SMS/WhatsApp Delivery: Integrated with MSG91/Twilio
- Door-to-Door Scenarios: Ideal for situations where QR scanning is difficult
- AWS Rekognition Integration: Enterprise-grade facial matching
- Pre-Trip Selfie Verification: Match delivery personnel with registered photo
- 90% Confidence Threshold: Prevents false positives from drawings/posters
- Privacy-First: Face embeddings stored, not raw images
- Instant Search: Direct database queries for emergency situations
- Police Access: Available at checkpoints and investigation scenarios
Claude AI Integration for:
- Worker Risk Scoring: Comprehensive profile analysis with confidence levels
- Anomaly Detection: Identifies unusual behavior patterns
- Incident NLP Analysis: Extracts key entities from incident reports
- Pattern Clustering: Detects coordinated fraud attempts
- Fraud Detection: Behavioral analysis from verification history
- Actionable Recommendations: Specific steps for police/employers
Calculated from 6 weighted components:
| Component | Weight | Description |
|---|---|---|
| Background Score | 20% | Police verification status, criminal record checks |
| Employment Score | 15% | Tenure with employers, termination history |
| Performance Score | 30% | Total deliveries completed, customer ratings |
| Incident Score | 15% | Deductions based on severity (Low: -2, Critical: -10) |
| Compliance Score | 10% | Document validity, regulatory adherence |
| Verification Score | 10% | Successful verification count |
Status Determination:
- ๐ข GREEN (Safe): Score โฅ70 + Clean record + No major incidents
- ๐ก YELLOW (Caution): Score 40-69 or minor incidents
- ๐ด RED (High Risk): Score <40 or flagged by police or โฅ5 incidents
- Continuous Location Logging: Updates every minute (configurable)
- WebSocket Live Streaming: Real-time tracking interface
- Route Validation: Detects deviations from expected paths
- Geofencing Alerts: Notifications when leaving authorized zones
- ETA Prediction: Accurate delivery time estimates using Google Maps API
- Geocoding Services: Address โ Coordinates conversion
Incident Types:
- Theft, Harassment, Fraud, Impersonation, Assault, Verbal Abuse, Property Damage, Suspicious Behavior
Severity Levels:
- ๐ข Low โ ๐ก Medium โ ๐ High โ ๐ด Critical
Status Workflow:
- Reported โ Investigating โ Resolved/Dismissed/Escalated
Features:
- Geolocation tagging at time of report
- Evidence URL storage (photos, videos)
- AI-powered incident analysis
- Reporter anonymity options
- Automatic trust score adjustments
- Aadhaar Verification: DigiLocker OAuth integration for identity verification
- Police Records API: Background check integration (mock mode available)
- Regulatory Compliance: Aligns with BPR&D and RBI requirements
- Data Privacy: Stores only Aadhaar hash, not full number
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FRONTEND LAYER โ
โ (Next.js 14 + React 18) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Worker Portal โ Police Portal โ Employer Portal โ Admin โ
โ Bank Portal โ Public Verification โ GPS Tracking โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ (REST API + WebSocket)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BACKEND LAYER โ
โ (FastAPI + Uvicorn) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Authentication โ Verification โ Trust Score โ GPS โ
โ Incident Mgmt โ AI Analysis โ QR/OTP โ Tracking โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PostgreSQL โ Redis โ External Services โ
โ (Primary DB) โ (Cache/OTP) โ โ AWS Rekognition โ
โ โ Users โ โ Sessions โ โ AWS S3 โ
โ โ Workers โ โ OTPs โ โ Anthropic Claude AI โ
โ โ Assignments โ โ Rate Limits โ โ Google Maps API โ
โ โ Verifications โ โ Live Data โ โ DigiLocker/Aadhaar โ
โ โ Incidents โ โ โ MSG91/Twilio (SMS) โ
โโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโ
โ 1. Worker โ โ Registers with Aadhaar
โ Registrationโ โ Photo Upload + Face Embedding
โโโโโโโโฌโโโโโโโ
โ
โโโโโโโโโโโโโโโ
โ 2. Employerโ โ Creates Assignment
โ Assignment โ โ Generates QR + OTP
โโโโโโโโฌโโโโโโโ
โ
โโโโโโโโโโโโโโโ
โ 3. Worker โ โ Accepts Job
โ Accepts โ โ Pre-Trip Selfie (Face Match)
โโโโโโโโฌโโโโโโโ โ Starts GPS Tracking
โ
โโโโโโโโโโโโโโโ
โ 4. Citizen/ โ โ Scans QR / Enters OTP
โ Police โ โ Backend Validates Token
โ Verificationโ โ Fetches Worker Profile
โโโโโโโโฌโโโโโโโ โ Calculates Trust Score
โ โ Runs AI Risk Analysis
โโโโโโโโโโโโโโโ
โ 5. Response โ โ GREEN/YELLOW/RED Status
โ Display โ โ Worker Info + Warnings
โโโโโโโโฌโโโโโโโ โ AI Recommendations
โ
โโโโโโโโโโโโโโโ
โ 6. Logging โ โ Records Verification Event
โ & Analyticsโ โ Updates Trust Score
โโโโโโโโโโโโโโโ โ Sends Notifications
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 14.1.0 | React framework with SSR/SSG |
| React | 18.x | UI component library |
| TypeScript | 5.x | Type-safe JavaScript |
| Tailwind CSS | 3.3.0 | Utility-first CSS framework |
| Radix UI | Latest | Accessible component primitives |
| Lucide React | Latest | Icon library |
| html5-qrcode | 2.3.8 | QR code scanning |
| react-qr-code | 2.0.12 | QR code generation |
| Google Maps API | Latest | Maps integration |
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | 0.109.0 | Modern Python web framework |
| Uvicorn | 0.27.0 | ASGI server |
| SQLAlchemy | 2.0.25 | Async ORM |
| PostgreSQL | 15+ | Primary database |
| asyncpg | 0.29.0 | Async PostgreSQL driver |
| Redis | 5.0.1 | Caching & session management |
| Pydantic | 2.5.3 | Data validation |
| python-jose | 3.3.0 | JWT token handling |
| bcrypt | 4.0.1 | Password hashing |
| Pillow | 10.2.0 | Image processing |
| qrcode | 7.4.2 | QR generation |
| Service | Purpose |
|---|---|
| Anthropic Claude AI | Risk analysis, NLP, pattern detection |
| AWS Rekognition | Face recognition & verification |
| AWS S3 | Image and file storage |
| Google Maps API | Geocoding, directions, distance matrix, ETA |
| DigiLocker | Aadhaar verification (government API) |
| MSG91/Twilio | SMS and WhatsApp notifications |
| Technology | Purpose |
|---|---|
| Docker | Containerization |
| Docker Compose | Local development orchestration |
| Railway | Deployment platform |
| AWS | Cloud infrastructure (RDS, ElastiCache, Lightsail) |
| GitHub | Version control |
Before you begin, ensure you have the following installed:
- Python 3.11 or higher (Download)
- Node.js 18.x or higher (Download)
- PostgreSQL 15+ (Download)
- Redis 7+ (Download) (Optional - in-memory fallback available)
- Git (Download)
- Docker & Docker Compose (Optional, for containerized setup) (Download)
-
Clone the repository
git clone https://github.com/yourusername/verifychain.git cd verifychain -
Set up environment variables
# Copy example env files cp backend/.env.example backend/.env cp frontend/.env.example frontend/.env -
Start all services
docker-compose up --build
This will start:
- PostgreSQL database on port
5432 - Redis on port
6379 - Backend API on port
8000 - Frontend on port
3000
- PostgreSQL database on port
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Navigate to backend directory
cd backend -
Create virtual environment
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up PostgreSQL database
# Create database createdb verifychain # Or using psql psql -U postgres CREATE DATABASE verifychain; \q
-
Configure environment variables
Create
backend/.envfile:# Database DATABASE_URL=postgresql+asyncpg://postgres:password@localhost:5432/verifychain REDIS_URL=redis://localhost:6379 # Security (generate with: python -c "import secrets; print(secrets.token_hex(32))") SECRET_KEY=your-super-secret-key-min-32-characters ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=1440 REFRESH_TOKEN_EXPIRE_DAYS=30 # Application ENVIRONMENT=development DEBUG=true APP_NAME=VERIFYCHAIN FRONTEND_URL=http://localhost:3000 ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000 # Mock Modes (set to true for development without API keys) AADHAAR_MOCK=true POLICE_RECORDS_MOCK=true SMS_MOCK=true FACE_RECOGNITION_MOCK=true GPS_TRACKING_MOCK=true CLAUDE_AI_MOCK=true # Optional: External Services (add when available) # ANTHROPIC_API_KEY=sk-ant-api03-... # AWS_ACCESS_KEY_ID=... # AWS_SECRET_ACCESS_KEY=... # GOOGLE_MAPS_API_KEY=AIza... # DIGILOCKER_CLIENT_ID=...
-
Initialize database
# Run migrations (creates tables) python -m app.database # Seed demo data (optional) python scripts/seed_demo_data.py
-
Start backend server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Open new terminal and navigate to frontend
cd frontend -
Install dependencies
npm install
-
Configure environment variables
Create
frontend/.env.localfile:NEXT_PUBLIC_API_URL=http://localhost:8000 NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-key (optional)
-
Start development server
npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API Docs: http://localhost:8000/docs
# Database Configuration
DATABASE_URL=postgresql+asyncpg://user:password@host:5432/database
# For development with SQLite:
# DATABASE_URL=sqlite+aiosqlite:///./verifychain.db
# Redis (Optional - in-memory fallback if not provided)
REDIS_URL=redis://localhost:6379
# Security (CRITICAL - Generate strong secret)
SECRET_KEY=<generate-with-python-secrets-token-hex-32>
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440 # 24 hours
REFRESH_TOKEN_EXPIRE_DAYS=30
# Application
ENVIRONMENT=development # or production
DEBUG=true # false in production
APP_NAME=VERIFYCHAIN
FRONTEND_URL=http://localhost:3000
ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000# Anthropic Claude AI
ANTHROPIC_API_KEY=sk-ant-api03-...
CLAUDE_MODEL=claude-sonnet-4-20250514
CLAUDE_AI_MOCK=false
# AWS Services
AWS_REGION=ap-south-1
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
S3_BUCKET=verifychain-assets
# Face Recognition
FACE_RECOGNITION_MOCK=false
# Google Maps
GOOGLE_MAPS_API_KEY=AIza...
GPS_TRACKING_MOCK=false
# Aadhaar/DigiLocker
DIGILOCKER_CLIENT_ID=...
DIGILOCKER_CLIENT_SECRET=...
DIGILOCKER_REDIRECT_URI=http://localhost:8000/api/v1/aadhaar/callback
AADHAAR_API_URL=https://stage1.uidai.gov.in
AADHAAR_MOCK=false
# SMS Provider
SMS_PROVIDER=msg91 # or twilio
SMS_MOCK=false
MSG91_AUTH_KEY=...
MSG91_SENDER_ID=VCHAIN
# Or for Twilio:
# TWILIO_ACCOUNT_SID=...
# TWILIO_AUTH_TOKEN=...
# TWILIO_WHATSAPP_NUMBER=...
# Police Records
POLICE_RECORDS_MOCK=false# Enable mock modes for development without API keys
AADHAAR_MOCK=true
POLICE_RECORDS_MOCK=true
SMS_MOCK=true
FACE_RECOGNITION_MOCK=true
GPS_TRACKING_MOCK=true
CLAUDE_AI_MOCK=trueNEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your-google-maps-keypython -c "import secrets; print(secrets.token_hex(32))"With Docker Compose:
docker-compose upManual (Two Terminals):
Terminal 1 - Backend:
cd backend
source venv/bin/activate # or venv\Scripts\activate on Windows
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Terminal 2 - Frontend:
cd frontend
npm run devBackend:
cd backend
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4Frontend:
cd frontend
npm run build
npm startcd backend
python -m app.database # Creates all tables
python scripts/seed_demo_data.py # Seeds demo dataFor gig workers and delivery personnel
Features:
- ๐ Registration: Aadhaar verification, photo upload, profile setup
- ๐ซ QR Code Display: Show dynamic verification code to customers/police
- ๐ Dashboard: View trust score, active assignments, earnings
- ๐ GPS Tracking: Automatic location logging during deliveries
- โญ Performance: Track ratings, completed deliveries, reviews
- ๐ฑ Notifications: Assignment updates, verification alerts
Access: http://localhost:3000/worker
For law enforcement officers
Features:
- ๐ Checkpoint Verification: Scan QR, enter phone number, or worker ID
- ๐ Investigation Tools: Complete worker history, employment records
- ๐จ Incident Management: View reports, update investigation status
- ๐ค AI Risk Analysis: Claude-powered threat assessment with recommendations
- ๐ Analytics Dashboard: Verification statistics, pattern detection
- ๐ฉ Flagging System: Mark high-risk individuals, add notes
Access: http://localhost:3000/police
For delivery companies (Swiggy, Zomato, etc.)
Features:
- ๐ฅ Workforce Management: Onboard/offboard workers, view roster
- ๐ฆ Assignment Creation: Create delivery tasks with auto-generated QR/OTP
- ๐ Fleet Tracking: Real-time GPS monitoring of all active workers
- ๐ Analytics Dashboard: Performance metrics, completion rates, incidents
- โญ Rating System: Rate workers after delivery completion
- ๐จ Incident Reports: Report and track worker-related incidents
Access: http://localhost:3000/employer
For banking institutions managing AePS agents
Features:
- ๐ฆ Agent Verification: Verify Banking Correspondents before transactions
- ๐ Authorization Management: Grant/revoke AePS access
- ๐ Compliance Dashboard: Monitor agent performance, incident history
- ๐จ Risk Alerts: AI-powered fraud detection for banking agents
- ๐ Audit Logs: Complete verification history for regulatory compliance
Access: http://localhost:3000/bank
For super administrators
Features:
- โ๏ธ System Configuration: Manage platform settings, feature flags
- ๐ฅ User Management: Create/edit users across all portals
- ๐ข Employer Management: Onboard new companies, manage subscriptions
- ๐ Platform Analytics: System-wide statistics, usage metrics
- ๐ง Maintenance Tools: Database backups, system health monitoring
Access: http://localhost:3000/admin
For citizens and general public
Features:
- ๐ Verify Worker: Scan QR code or enter OTP to verify delivery person
- ๐ Track Delivery: Real-time GPS tracking with ETA
- ๐ Worker Registration: Public registration form for new workers
- ๐จ Report Incident: Anonymous incident reporting
- ๐งช Demos: Face recognition and GPS tracking demonstrations
Access:
- Verification: http://localhost:3000/verify
- Tracking: http://localhost:3000/tracking
Worker โ Fills registration form โ Aadhaar verification (DigiLocker)
โ Photo upload โ Face embedding generation โ Profile created
โ Initial trust score: 50 (YELLOW status)
Employer โ Creates assignment for worker โ System generates:
โโ QR Code (HMAC-signed, 60-min expiry, nonce-based)
โโ 6-digit OTP (Redis-stored, 10-min TTL)
โโ Assignment record (origin, destination, GPS coordinates)
โ Worker notified via SMS/WhatsApp
Worker โ Accepts assignment โ Captures pre-trip selfie
โ Face recognition match (90% confidence required)
โ GPS tracking starts โ Status: EN_ROUTE
Citizen/Police โ Scans QR code OR enters OTP
โ Backend validates:
โโ Token signature (HMAC-SHA256)
โโ Expiry timestamp
โโ Nonce uniqueness (prevents replay attacks)
โโ Worker status (active/suspended)
โ Fetches worker profile from database
โ Calculates real-time trust score (6 components)
โ Runs Claude AI risk analysis (if enabled)
โ Returns response:
โโ ๐ข GREEN (Safe): Score โฅ70, clean record
โโ ๐ก YELLOW (Caution): Score 40-69 or minor issues
โโ ๐ด RED (High Risk): Score <40 or flagged
If incident reported:
โ System assigns severity (LOW/MEDIUM/HIGH/CRITICAL)
โ Claude AI analyzes description (NLP)
โ Pattern clustering identifies related incidents
โ Trust score recalculated (deductions applied)
โ Notifications sent to employer, worker, police
โ Auto-flag if threshold exceeded (e.g., 5+ incidents)
During delivery:
โ GPS location logged every minute
โ Route validation (compares actual vs expected path)
โ Geofence alerts if leaving authorized zone
โ ETA updated based on real-time traffic
โ Employer sees live tracking dashboard
Worker โ Marks delivery complete โ Final selfie (optional)
โ Customer rates worker (1-5 stars)
โ Trust score updated (performance component)
โ Verification log stored immutably for audit
โ Payment processed to worker
- Development:
http://localhost:8000 - Production:
https://your-domain.com
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
All authenticated endpoints require JWT token in header:
Authorization: Bearer <your_jwt_token>
POST /api/v1/auth/register # User registration
POST /api/v1/auth/login # Login (returns JWT + refresh token)
POST /api/v1/auth/refresh # Refresh access token
GET /api/v1/auth/me # Get current user profile
POST /api/v1/auth/change-password # Change passwordPOST /api/v1/verify/qr # Verify by QR code
POST /api/v1/verify/otp # Verify by OTP
GET /api/v1/verify/assignment/{id} # Check assignment statusPOST /api/v1/workers/register # Register new worker (with Aadhaar)
GET /api/v1/workers/me # Get worker profile
POST /api/v1/workers/{id}/upload-photo # Upload profile photo
GET /api/v1/workers/{id} # Get public worker info
PUT /api/v1/workers/{id} # Update worker profilePOST /api/v1/assignments # Create assignment
GET /api/v1/assignments # List assignments
GET /api/v1/assignments/{id} # Get assignment details
PUT /api/v1/assignments/{id}/status # Update status
POST /api/v1/assignments/{id}/pre-trip-selfie # Upload selfiePOST /api/v1/police/checkpoint/verify # Checkpoint verification
GET /api/v1/police/workers/{id} # Investigate worker
GET /api/v1/police/incidents # List incidents
POST /api/v1/police/incidents/{id}/investigate # Update investigationGET /api/v1/employers/me # Get employer profile
GET /api/v1/employers/me/stats # Get analytics
GET /api/v1/employers/workers # List workers
POST /api/v1/employers/workers/{id}/employment # Onboard worker
DELETE /api/v1/employers/workers/{id}/employment # Offboard workerPOST /api/v1/tracking/location # Log location
GET /api/v1/tracking/assignment/{id} # Get live location
WS /api/v1/tracking/live/{id} # WebSocket live streamPOST /api/v1/banking/agents/verify # Verify banking agent
GET /api/v1/banking/agents/{id} # Get agent details
POST /api/v1/banking/agents # Register agentPOST /api/v1/reports/incident # Report incident
GET /api/v1/reports/incidents # List reports
GET /api/v1/reports/summary # Analytics summary
PUT /api/v1/reports/incidents/{id} # Update incidentGET /health # Basic health check
GET /api/v1/health # Detailed status (mock modes)curl -X POST "http://localhost:8000/api/v1/workers/register" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Rajesh Kumar",
"phone_number": "+919876543210",
"email": "rajesh@example.com",
"aadhaar_number": "123456789012",
"address": "123 Main St, Jaipur"
}'curl -X POST "http://localhost:8000/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "worker1@demo.com",
"password": "password123"
}'curl -X POST "http://localhost:8000/api/v1/verify/qr" \
-H "Content-Type: application/json" \
-d '{
"qr_token": "eyJhIjoxLCJ3IjoyLCJlIjozLCJuIjoiYWJjZCIsIngiOjE3MDAwMDAwMDAsInMiOiJzaWduYXR1cmUifQ=="
}'Response:
{
"verification_id": 123,
"status": "GREEN",
"trust_score": 85,
"worker": {
"id": 2,
"full_name": "Rajesh Kumar",
"phone_number": "+919876543210",
"photo_url": "https://...",
"employer_name": "Swiggy"
},
"assignment": {
"order_id": "ORD-12345",
"destination": "45 Park Street, Jaipur"
},
"warnings": [],
"ai_analysis": {
"risk_level": "LOW",
"confidence": 0.95,
"recommendations": ["Verified safe for delivery"]
}
}Railway configuration is already included in railway.toml.
-
Install Railway CLI
npm install -g @railway/cli
-
Login to Railway
railway login
-
Create new project
railway init
-
Add environment variables
railway variables set DATABASE_URL="postgresql://..." railway variables set SECRET_KEY="your-secret-key" # Add all required environment variables
-
Deploy
railway up
Railway will automatically:
- Provision PostgreSQL and Redis
- Build Docker containers
- Deploy frontend and backend
- Provide HTTPS URLs
See detailed guide in DEPLOY_AWS.md
# Create instance
aws lightsail create-container-service \
--service-name verifychain \
--power small \
--scale 1
# Deploy containers
aws lightsail push-container-image --service-name verifychain --label backend --image verifychain-backend
aws lightsail push-container-image --service-name verifychain --label frontend --image verifychain-frontend# Deploy backend
aws apprunner create-service \
--service-name verifychain-backend \
--source-configuration '{
"ImageRepository": {
"ImageIdentifier": "your-ecr-repo/backend:latest",
"ImageRepositoryType": "ECR"
}
}'- Launch EC2 instance (Ubuntu 22.04)
- Install Docker and Docker Compose
- Clone repository
- Set environment variables
- Run
docker-compose -f docker-compose.prod.yml up -d
- Set
ENVIRONMENT=production - Set
DEBUG=false - Generate strong
SECRET_KEY(32+ characters) - Use production database (PostgreSQL on AWS RDS)
- Set up Redis cluster (AWS ElastiCache)
- Configure AWS S3 for file storage
- Add AWS Rekognition credentials
- Set up Anthropic Claude API key
- Configure Google Maps API key
- Set up SMS provider (MSG91/Twilio)
- Enable HTTPS (SSL/TLS certificates)
- Configure CORS allowed origins
- Set up database backups
- Enable monitoring and logging
- Configure rate limiting
- Set up CDN for static files
- Disable all mock modes
- Test all verification flows end-to-end
Pre-seeded accounts for testing (after running seed_demo_data.py):
| Role | Password | Access | |
|---|---|---|---|
| Worker | worker1@demo.com | password123 | Worker Portal |
| Police Officer | officer@jaipur.police | password123 | Police Portal |
| Employer (Swiggy) | employer@swiggy.demo | password123 | Employer Portal |
| Bank Admin (SBI) | employer@sbi.demo | password123 | Bank Portal |
| Super Admin | superadmin@verifychain.in | password123 | Admin Portal |
Demo Worker Profile:
- Name: Ramesh Kumar
- Phone: +919876543210
- Trust Score: 75 (GREEN)
- Total Deliveries: 150
- Rating: 4.5/5
Test QR Code Generation: After logging in as employer, create an assignment to generate a test QR code and OTP.
verifychain-main/
โ
โโโ backend/ # Python FastAPI Backend
โ โโโ app/
โ โ โโโ __init__.py
โ โ โโโ main.py # FastAPI app initialization
โ โ โโโ config.py # Settings & environment variables
โ โ โโโ database.py # SQLAlchemy async database setup
โ โ โ
โ โ โโโ models/ # SQLAlchemy ORM Models
โ โ โ โโโ __init__.py
โ โ โ โโโ user.py # User authentication model
โ โ โ โโโ worker.py # Worker profile model
โ โ โ โโโ employer.py # Employer/company model
โ โ โ โโโ assignment.py # Delivery assignment model
โ โ โ โโโ verification.py # Verification event log
โ โ โ โโโ incident.py # Incident report model
โ โ โ โโโ employment.py # Worker-employer relationship
โ โ โ โโโ location_log.py # GPS tracking history
โ โ โ โโโ banking_auth.py # Banking agent credentials
โ โ โ
โ โ โโโ schemas/ # Pydantic Request/Response Schemas
โ โ โ โโโ __init__.py
โ โ โ โโโ user.py
โ โ โ โโโ worker.py
โ โ โ โโโ assignment.py
โ โ โ โโโ verification.py
โ โ โ โโโ ...
โ โ โ
โ โ โโโ routers/ # API Route Handlers
โ โ โ โโโ __init__.py
โ โ โ โโโ auth.py # Authentication endpoints
โ โ โ โโโ verification.py # Public verification API
โ โ โ โโโ workers.py # Worker management
โ โ โ โโโ assignments.py # Assignment CRUD
โ โ โ โโโ police.py # Police checkpoint & investigation
โ โ โ โโโ employers.py # Employer management
โ โ โ โโโ tracking.py # GPS tracking (+ WebSocket)
โ โ โ โโโ banking.py # Banking agent verification
โ โ โ โโโ reports.py # Incident reporting
โ โ โ
โ โ โโโ services/ # Business Logic Services
โ โ โ โโโ __init__.py
โ โ โ โโโ trust_score_service.py # Trust score calculation
โ โ โ โโโ claude_ai_service.py # AI risk analysis
โ โ โ โโโ face_service.py # AWS Rekognition integration
โ โ โ โโโ gps_service.py # Google Maps integration
โ โ โ โโโ qr_service.py # QR token generation/validation
โ โ โ โโโ otp_service.py # OTP generation/validation
โ โ โ โโโ aadhaar_service.py # DigiLocker integration
โ โ โ โโโ sms_service.py # MSG91/Twilio integration
โ โ โ โโโ police_records_service.py # Police verification API
โ โ โ
โ โ โโโ security/ # Authentication & Authorization
โ โ โ โโโ __init__.py
โ โ โ โโโ jwt.py # JWT token handling
โ โ โ โโโ password.py # Password hashing (bcrypt)
โ โ โ โโโ permissions.py # Role-based access control
โ โ โ
โ โ โโโ utils/ # Utility Functions
โ โ โโโ __init__.py
โ โ โโโ redis_client.py # Redis connection manager
โ โ โโโ validators.py # Custom validators
โ โ
โ โโโ scripts/
โ โ โโโ seed_demo_data.py # Database seeding script
โ โ
โ โโโ requirements.txt # Python dependencies
โ โโโ Dockerfile # Backend Docker image
โ โโโ .env.example # Example environment variables
โ
โโโ frontend/ # Next.js Frontend
โ โโโ src/
โ โ โโโ app/ # Next.js 14 App Router
โ โ โ โโโ layout.tsx # Root layout
โ โ โ โโโ page.tsx # Homepage (portal selection)
โ โ โ โ
โ โ โ โโโ verify/ # Public verification
โ โ โ โ โโโ page.tsx
โ โ โ โโโ tracking/ # Live delivery tracking
โ โ โ โ โโโ page.tsx
โ โ โ โ
โ โ โ โโโ worker/ # Worker Portal
โ โ โ โ โโโ login/
โ โ โ โ โโโ dashboard/
โ โ โ โ โโโ profile/
โ โ โ โ โโโ assignments/
โ โ โ โ
โ โ โ โโโ police/ # Police Portal
โ โ โ โ โโโ login/
โ โ โ โ โโโ checkpoint/
โ โ โ โ โโโ investigation/
โ โ โ โ โโโ incidents/
โ โ โ โ
โ โ โ โโโ employer/ # Employer Portal
โ โ โ โ โโโ login/
โ โ โ โ โโโ dashboard/
โ โ โ โ โโโ workers/
โ โ โ โ โโโ assignments/
โ โ โ โ โโโ analytics/
โ โ โ โ
โ โ โ โโโ bank/ # Bank Admin Portal
โ โ โ โ โโโ login/
โ โ โ โ โโโ dashboard/
โ โ โ โ โโโ agents/
โ โ โ โ
โ โ โ โโโ admin/ # Super Admin Portal
โ โ โ โโโ login/
โ โ โ โโโ dashboard/
โ โ โ โโโ users/
โ โ โ
โ โ โโโ components/ # Reusable React Components
โ โ โ โโโ ui/ # UI primitives (Radix-based)
โ โ โ โโโ QRScanner.tsx
โ โ โ โโโ QRCodeDisplay.tsx
โ โ โ โโโ TrustScoreCard.tsx
โ โ โ โโโ MapView.tsx
โ โ โ โโโ ...
โ โ โ
โ โ โโโ lib/ # Utilities & API Client
โ โ โโโ api.ts # Axios/fetch wrapper
โ โ โโโ auth.ts # Authentication helpers
โ โ โโโ utils.ts # Helper functions
โ โ
โ โโโ public/ # Static assets
โ โโโ package.json # Node dependencies
โ โโโ Dockerfile # Frontend Docker image
โ โโโ tailwind.config.ts # Tailwind CSS config
โ โโโ tsconfig.json # TypeScript config
โ โโโ .env.example # Example environment variables
โ
โโโ docker-compose.yml # Development orchestration
โโโ docker-compose.prod.yml # Production orchestration
โโโ railway.toml # Railway deployment config
โโโ DEPLOY_AWS.md # AWS deployment guide
โโโ README.md # This file
โโโ LICENSE # MIT License
- JWT-based authentication with access + refresh tokens
- bcrypt password hashing (12 rounds)
- Role-based access control (RBAC) with 6 distinct roles
- Token expiry: Access (24h), Refresh (30 days)
- Password strength validation
- Rate limiting on auth endpoints
- Aadhaar number hashing - never stores plain text
- Face embeddings stored - not raw images
- SQL injection protection via SQLAlchemy ORM
- XSS prevention with input sanitization (bleach library)
- CORS configuration with allowed origins
- HTTPS enforcement in production
- Environment variable security - secrets not in code
- HMAC-SHA256 QR signatures - prevents token forgery
- Nonce-based replay prevention - tokens can't be reused
- Time-limited tokens - 60-minute QR expiry, 10-minute OTP
- Redis-backed OTP storage with TTL
- Face recognition confidence minimum 90%
- Device fingerprinting for suspicious activity detection
- Rate limiting via Redis (configurable per endpoint)
- Request validation with Pydantic schemas
- SQL injection protection via parameterized queries
- Content Security Policy (CSP) headers
- HSTS headers for HTTPS enforcement
- Audit logging of all verification events
- GDPR-inspired data minimization - only essential data stored
- Right to deletion - users can request data removal
- Data encryption at rest (database level)
- Data encryption in transit (HTTPS/TLS)
- Anonymized incident reporting option
- Consent management for data processing
We welcome contributions from the community! Here's how you can help:
-
Fork the repository
git clone https://github.com/yourusername/verifychain.git cd verifychain git checkout -b feature/your-feature-name -
Set up development environment
- Follow installation instructions above
- Enable mock modes for easier development
-
Make your changes
- Write clean, documented code
- Follow existing code style (PEP 8 for Python, ESLint for TypeScript)
- Add unit tests for new features
-
Test thoroughly
# Backend tests cd backend pytest tests/ # Frontend tests cd frontend npm run test
-
Commit with clear messages
git add . git commit -m "Add: Feature description"
-
Push and create Pull Request
git push origin feature/your-feature-name
- Code Style:
- Python: PEP 8, type hints preferred
- TypeScript: ESLint + Prettier
- Commits: Use conventional commits (feat:, fix:, docs:, etc.)
- Documentation: Update README for new features
- Tests: Maintain >80% code coverage
- Security: Never commit secrets or API keys
- ๐ Bug fixes and issue resolution
- โจ New verification methods (biometric, document scan)
- ๐ Internationalization (Hindi, regional languages)
- ๐ฑ Mobile app (React Native)
- ๐งช Test coverage improvements
- ๐ Documentation enhancements
- ๐จ UI/UX improvements
- โก Performance optimizations
Use GitHub Issues with:
- Bug Report: Describe expected vs actual behavior
- Feature Request: Explain use case and benefits
- Security Vulnerability: Email team directly (do not post publicly)
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 VerifyChain Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
[Full MIT License text...]
- Event: SHIELD 1.0 Hackathon
- Organizers: Bureau of Police Research & Development (BPR&D) ร MNIT Jaipur
- Venue: Centre for Development of Technical Institutions (CDTI), Jaipur
- Achievement: ๐ฅ 2nd Runner-Up | Best Solution for Track #3
- Problem Statement: Real-Time Database for Delivery Personnel Verification (Gig Workers) & Banking Agents
Special thanks to all team members who contributed to this project during the 48-hour hackathon and subsequent development.
- Anthropic - Claude AI for risk analysis
- Amazon Web Services (AWS) - Rekognition, S3, RDS, ElastiCache
- Google - Maps API for geocoding and tracking
- UIDAI - Aadhaar verification infrastructure
- Open Source Community - FastAPI, Next.js, PostgreSQL, Redis
- BPR&D officials for problem statement guidance
- MNIT faculty for technical mentorship
- Law enforcement professionals for domain expertise
- API Docs: http://localhost:8000/docs (Swagger)
- GitHub Repository: https://github.com/yourusername/verifychain
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions and share ideas
- Email: support@verifychain.in (if applicable)
- Star โญ the repository if you find it useful
- Follow for updates on new features
- Share your implementations and use cases
- Multi-portal system (Worker, Police, Employer, Bank, Admin)
- QR code and OTP verification
- Trust score calculation system
- Basic GPS tracking
- Incident management
- Claude AI integration
- Mobile applications (iOS & Android)
- Advanced face recognition (liveness detection)
- Offline verification mode
- Multi-language support (Hindi, regional languages)
- Voice-based verification
- Enhanced analytics dashboard
- Multi-tenant architecture for different states
- Blockchain integration for immutable audit logs
- Advanced ML fraud detection models
- Integration with national crime databases
- WhatsApp Business API integration
- Predictive risk scoring
- Open API for third-party integrations
- Marketplace for gig platforms
- Insurance integration based on trust scores
- Credit scoring for gig workers
- Training and certification modules
- Community safety network
- โฑ๏ธ Built in 48 hours
- ๐ฅ Solves problems for 10+ million gig workers in India
- ๐ฏ Addresses critical safety concerns for households and law enforcement
- ๐ Recognized as best solution in Track #3
- Citizens: Safer home deliveries and service visits
- Police: 90% faster checkpoint verifications
- Employers: Reduced onboarding time from days to minutes
- Banks: Enhanced AePS security and compliance
- Workers: Better employment opportunities through verified profiles
- FastAPI Documentation
- Next.js Documentation
- PostgreSQL Documentation
- Anthropic Claude API
- AWS Rekognition Guide
- BPR&D Official Website
- Aadhaar Authentication
- Gig Economy in India - Reports (Add relevant links)