IntelliEV is a real-time emergency response system for Electric Vehicles that automatically detects accidents, calculates severity, and dispatches the nearest emergency responder without human intervention.
🚀 Live App: https://intelli-ev-ts-realtime.vercel.app
Note: This demo requires two different browser sessions to simulate the workflow:
- User Role: To trigger SOS alerts.
- Emergency Role: To receive and view dispatched alerts.
- Real-time SOS Triggering: Manual or automated accident detection simulation.
- Intelligent Severity Engine: Server-side calculation of accident severity (0-100 score) based on vehicle telemetry.
- Automated Dispatch: Instantly assigns the nearest available responder using geospatial distance calculation.
- Live Tracking: Real-time map visualization of SOS events and responder locations.
- Role-Based Access: Distinct dashboards for EV Drivers and Emergency Responders.
- Auto-Recovery: Automatic state reset for responders upon incident resolution.
IntelliEV uses a serverless event-driven architecture. The React frontend communicates directly with Firestore for real-time data syncing, while Firebase Cloud Functions handle business logic, severity computation, and responder assignment in the background.
┌──────────────────────┐
│ Vercel Frontend │
│ (React + TS) │
└──────────┬───────────┘
│
HTTPS / REST / Webhook
│
┌───────────────────────┴───────────────────────┐
│ │
┌──────────────────────┐ ┌─────────────────────────┐
│ Firebase Firestore │ <-- realtime --> │ Firebase Realtime DB │
│ Firebase Auth │ └─────────────────────────┘
└──────────┬───────────┘
│ triggers
│
┌─────────▼──────────┐
│ Node Microservice │ (Firebase Cloud(GCP) Serverless Function)
│ "Incident Orchestrator"
│ - Assign responder
│ - Process SOS
│ - Log analytics
└─────────────────────┘
The backend logic is isolated in TypeScript Cloud Functions to ensure security and reliability.
- Trigger:
onCreateonsos_alerts/{id} - Logic: Analyzes vehicle telemetry (
g_force,airbags_deployed,delta_v,rollover_detected). - Output: Computes a
severityobject with a numeric score (0-100) and classification (low,moderate,high,critical).
- Trigger:
onUpdateonsos_alerts/{id}(specifically when severity becomeshighorcritical). - Logic: Queries available responders, calculates Haversine distance to the accident, and selects the nearest unit.
- Output: Updates the SOS document with
assignedResponderdetails and marks the responder asbusy.
- Trigger:
onUpdateonsos_alerts/{id}(when status changes toresolved). - Logic: Identifies the assigned responder and releases them from the current task.
- Output: Sets responder status back to
availableand timestamps the resolution.
Key TypeScript interfaces used across the application:
export interface Severity {
score: number;
level: "low" | "moderate" | "high" | "critical";
computedAt?: any; // Firestore Timestamp
}
export interface AssignedResponder {
uid: string;
name: string;
distanceKm: number;
}
export interface SosAlert {
id: string;
lat: number;
lng: number;
timestamp?: any;
triggerMethod?: string;
vehicleData?: Record<string, any>;
severity?: Severity;
assignedResponder?: AssignedResponder | null;
status?: string;
}- Framework: React 19 + TypeScript + Vite
- State Management: Real-time Firestore listeners (
onSnapshot) - Maps: React Leaflet with custom pulse animations for severity visualization
- Styling: Tailwind CSS for responsive, modern UI
sos_alerts: Stores all accident events, telemetry, and assignment status.users: Stores user profiles, roles (uservsemergency), and real-time location/status.
- Event: EV detects crash -> Writes to
sos_alerts. - Compute: Cloud Function calculates severity -> Updates
sos_alerts. - Dispatch: Cloud Function finds nearest responder -> Updates
sos_alerts&users. - Notify: Emergency Dashboard listener receives update -> Highlights map marker & triggers alert.
- Resolve: Responder marks complete -> Cloud Function resets state.
-
Clone the repository:
git clone https://github.com/modi-meet/IntelliEV-TS-Realtime.git cd IntelliEV-TS-Realtime -
Install dependencies:
npm install cd functions && npm install
-
Start Backend Emulators:
cd functions npm run serve -
Start Frontend:
# In a new terminal npm run dev
- Frontend: Deployed on Vercel (Auto-builds from
mainbranch). - Backend: Firebase Cloud Functions.
- Integration with TensorFlow.js for camera-based accident verification.
- Mobile app version for responders (React Native).
- Voice-activated SOS triggering.
- Historical data analytics dashboard.
MIT