Kavach
AI-Powered Personal Safety Companion

Project Overview
Kavach is a mobile-first personal safety companion engineered during the PromptWars x GDGoC MM(DU) Hackathon, where it secured a Top 30 position among 150+ student participants. Traditional panic button apps suffer from two major flaws: they require obvious manual activation at the exact moment a victim cannot safely operate their phone, and they merely alert remote contacts without offering any immediate actionable safe harbor. Kavach revolutionizes physical safety by combining a stealth incoming-call disguise with silent duress code detection, real-time routing to the nearest 3 verified SafePoints (pharmacies, security desks, warden posts), Google Gemini-powered multi-factor distress urgency scoring with a fail-safe sub-3s fallback, and passive journey anomaly monitoring.
System Architecture & Real-Time Engine
Kavach combines a responsive Next.js 14 App Router frontend with a high-throughput Node.js & Express backend. Real-time alert broadcast is powered by Socket.io, pushing live GPS coordinates, battery levels, and audio markers to guardians within 2 seconds. The data tier leverages PostgreSQL managed via Drizzle ORM, orchestrating relations for users, trusted contacts, emergency alerts, verified SafePoints, and passive journey breadcrumbs. All write operations are strictly validated against Google OAuth JWT session tokens to prevent unauthorized location spoofing.
AI Intelligence & Dual-Mode Urgency Scoring
Distress severity is evaluated using Google Gemini models via the Vercel AI SDK (`generateObject`) structured by Zod schemas. The AI analyzes free-text distress messages, ambient background context, time-of-day risks, and proximity to known safety havens to assign an Urgency Score from 0 to 100. ⢠**Fail-Safe Fallback:** Because emergency tooling cannot depend on external LLM uptime or network spikes, the AI pipeline races against an internal 2.5-second timeout. If the LLM call times out or errors, the system automatically falls back to deterministic rule-based lexical analysis, guaranteeing sub-3s scoring without blocking the SOS dispatch.
Stealth Protection: Fake Call & Silent Duress
For situations where pressing an obvious SOS button would escalate an attack, Kavach provides a deceptive incoming phone call screen. The user can interact with the disguised call interface naturally while speaking or typing a pre-configured silent duress keyword. The background service silently registers the trigger, captures pinpoint GPS coordinates, and alerts guardians with zero visual flash or UI change.
SafePoint Routing & Guardian Live Map
Rather than leaving someone in danger waiting helplessly for help, Kavach automatically calculates walking directions to the 3 closest verified safe points (24/7 pharmacies, campus security desks, warden offices, and police kiosks) using Leaflet and OpenStreetMap tiles. Simultaneously, trusted contacts receive a real-time guardian dashboard with synchronized live map tracking, battery metrics, and one-tap emergency escalation.
Journey Shield: Passive Anomaly Detection
Journey Shield enables hands-free passive travel monitoring for night commutes and solo transit. The background worker continuously tracks GPS pings against planned routes. If the traveler stalls unexpectedly, deviates off-course, or fails to confirm safe arrival within the expected ETA window, Kavach initiates automated check-in alerts and auto-escalates to trusted guardians.
Engineering Challenges & Solutions
Challenge
Achieving sub-2 second emergency alert dispatch to multiple distributed guardians across volatile mobile network conditions.
Solution
Built a lightweight Socket.io pub/sub event pipeline with optimistic UI reconciliation, keeping persistent bi-directional channels open and falling back to automated HTTP polling if WebSockets disconnect.
Challenge
Guaranteeing life-safety reliability when integrating cloud-based LLM scoring that could encounter API rate limits or latency.
Solution
Engineered a dual-mode fallback architecture: the Vercel AI SDK call is wrapped in a strict 2.5s abort controller. If the cloud LLM times out or is offline, a local rule-based heuristic scoring engine evaluates threat keywords instantly.
Challenge
Preventing an attacker from noticing that an emergency SOS trigger has been activated on the device.
Solution
Designed an authentic fake-call cover screen with standard dialer aesthetics. Duress phrases are matched discreetly without triggering screen flashes, audio beeps, or status bar indicators.
Hackathon Verification & Certificate
š Top 30 / 150 Finalist
Certificate of Participation & Working AI Prototype Deployment
PromptWars x GDGoC MM(DU), Mullana
Top 30 Finalist
Selected in the Top 30 out of 150 student competitors at PromptWars x GDGoC MM(DU) for deploying a functional AI safety prototype with Google Antigravity & Gemini.
View Official CertificateTechnologies Used
Key Metrics & Results
- š Ranked in the Top 30 out of 150 participating students at PromptWars x GDGoC MM(DU) Hackathon.
- Achieved <2s end-to-end latency from SOS trigger to real-time guardian dashboard notification.
- 100% resilient distress urgency scoring with sub-3s automated rule-based fallback.
- Successfully deployed working prototype with Google Antigravity on August 19, 2026.
- Recognized with official Certificate of Participation & Working AI Prototype Deployment (ID: MMEC/26-27/A/004/59).