Skip to content
SafeVixAIPublic

About

AI-powered road safety and smart mobility platform for India. Features real-time hazard detection, emergency SOS dispatch, challan risk calculator, and voice-enabled assistant.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

807 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


πŸ›‘οΈ SafeVixAI

Enterprise AI-Powered Road Safety & Emergency Response Platform

Offline-first PWA Β· Zero-downtime AI Β· Zero infrastructure cost

Backend CI Frontend CI Chatbot CI CodeQL

Coverage Documentation OpenSSF Scorecard License

Python Next.js FastAPI Docker Community

Vision β€’ Features β€’ Tech Stack β€’ Quick Start β€’ Architecture β€’ Full Documentation β†—

Built for the IIT Madras Road Safety Hackathon 2026. Offline-first PWA with zero-downtime AI fallback.


🎯 Project Vision

Every second counts in a road emergency. SafeVixAI puts life-saving information β€” nearest hospitals, traffic laws, first aid protocols β€” directly in the hands of citizens, officers, and first responders.

πŸ”Œ Offline-First

When rural or disaster-struck networks fail, SafeVixAI keeps working. DuckDB-Wasm + IndexedDB + Service Workers ensure full offline operation.

🧠 Zero-Downtime AI

A 10-provider LLM cascading chain with automatic fallback ensures the AI assistant never goes silent.

πŸ’° Zero Cost

100% open source. Infrastructure runs on free tiers (Vercel, Render, Supabase, Upstash). Accessible to every government agency.


✨ Key Features

Feature Description Enterprise Capabilities
🚨 Emergency Locator Geospatial hospital, police, and fire station search PostGIS spatial indexing, 50ms latency routing
πŸ€– AI Agentic Chatbot Traffic law, challan calculation, and first aid guidance Agentic RAG, 10-LLM fallback chain, ChromaDB vector store
🧾 Challan Calculator Deterministic MVA 2019 fine calculation with overrides DuckDB-Wasm in-browser, zero-latency offline processing
πŸ“Έ Road Reporter Community-driven road damage reporting with geotagging IndexedDB sync queue, background sync via Service Workers
πŸ“‘ SOS + Live Tracking Hold-to-activate emergency alert with live location Secure WebSockets, encrypted payload streaming
πŸ“Š Command Center Real-time agency dashboard with incident timelines Grafana integration, Prometheus metric scraping
πŸ—£οΈ Indian Language AI Hindi, Tamil, Telugu, Kannada + 10 Indian languages Sarvam AI routing, IndicSeamless speech translation
🩺 First Aid Protocols Step-by-step emergency medical guidance Offline-available, category-filtered protocol cards

πŸ› οΈ Technology Stack

SafeVixAI is built on a modern, cloud-native microservices architecture designed for extreme scale and fault tolerance.

Layer Technologies Purpose
Frontend Next.js 15 Β· React 19 Β· TypeScript 5 Β· Tailwind CSS 3 Β· MapLibre GL 5 PWA with offline-first architecture
Offline Engine WebLLM (Phi-3 Mini) Β· DuckDB-Wasm Β· IndexedDB Β· Service Workers Zero-network AI + SQL + data persistence
Backend API FastAPI Β· SQLAlchemy 2.0 Β· PostGIS Β· Redis 7 Β· DuckDB Emergency locator, challan calc, road reporting
AI Service FastAPI Β· ChromaDB Β· 10 LLM Providers Β· Sarvam AI Β· IndicSeamless Agentic RAG chatbot with Indian language support
Infrastructure Docker Compose Β· Kubernetes Β· Terraform (AWS) Β· Vercel Β· Render Container orchestration and deployment
Observability Prometheus Β· Grafana Β· Sentry Β· Structured JSON Logging Metrics, alerts, error tracking, audit trails
CI/CD GitHub Actions (34 workflows) Β· CodeQL Β· Dependabot Β· SLSA Automated testing, security scanning, provenance

πŸš€ Quick Start

SafeVixAI is containerized for rapid developer onboarding. Get a local instance running in minutes.

Prerequisites

  • Docker & Docker Compose (Recommended for full-stack)
  • Node.js 20+ & Python 3.11+ (For bare-metal deployment)

Containerized Deployment (Recommended)

Launch the entire stack β€” PostgreSQL, Redis, Backend, AI Service, Frontend β€” with a single command:

# Clone the repository
git clone https://github.com/SafeVixAI/SafeVixAI.git
cd SafeVixAI

# Boot the microservices
docker compose up --build -d
Service URL Health Check
Frontend http://localhost:3000 PWA available
Backend API http://localhost:8000 GET /health
Chatbot Service http://localhost:8010 GET /health

Bare-Metal Local Development

Click to expand step-by-step instructions

1. Backend API (Port 8000)

cd backend
python -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
uvicorn main:app --reload --port 8000

2. AI Chatbot Service (Port 8010)

cd chatbot_service
python -m venv .venv
source .venv/bin/activate      # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
uvicorn main:app --reload --port 8010

3. Frontend PWA (Port 3000)

cd frontend
npm ci
cp .env.local.example .env.local
npm run dev

πŸ›οΈ System Architecture

SafeVixAI uses a highly decoupled, cloud-native architecture. It strictly separates edge-client offline durability from heavy backend processing and AI orchestration, with a rigorous data plane optimized for spatial indexing and vector retrieval.

flowchart TB
    classDef edge fill:#dbeafe,stroke:#3b82f6,stroke-width:2px,color:#1e3a5f
    classDef control fill:#dcfce7,stroke:#22c55e,stroke-width:2px,color:#14532d
    classDef ai fill:#f3e8ff,stroke:#a855f7,stroke-width:2px,color:#581c87
    classDef data fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#78350f
    classDef external fill:#f1f5f9,stroke:#94a3b8,stroke-width:2px,stroke-dasharray:5 5,color:#334155

    subgraph EdgeTier ["Edge Tier β€” Offline-First PWA"]
        direction LR
        UI["React 19 / Next.js 15"]:::edge
        SW["Service Worker"]:::edge
        IDB[("IndexedDB")]:::edge
        DW[("DuckDB-Wasm")]:::edge
        UI <--> SW
        UI <--> IDB
        UI <--> DW
    end

    subgraph ControlPlane ["Control Plane β€” Backend :8000"]
        direction TB
        API["FastAPI Gateway"]:::control
        Workers["Background Workers"]:::control
        API <--> Workers
    end

    subgraph AIOrchestration ["AI Orchestration β€” Chatbot :8010"]
        direction TB
        Router["Agentic Router"]:::ai
        LLM["10-Provider LLM Chain"]:::ai
        Router --> LLM
    end

    subgraph DataPlane ["Data Plane"]
        direction LR
        PG[("PostgreSQL + PostGIS")]:::data
        RD[("Redis 7")]:::data
        CR[("ChromaDB")]:::data
    end
    
    subgraph ThirdParty ["External Integrations"]
        direction LR
        Maps["OpenStreetMap / Data.gov.in"]:::external
    end

    EdgeTier -- "HTTPS / WSS" --> ControlPlane
    EdgeTier -- "Semantic Queries" --> AIOrchestration
    
    ControlPlane --> PG
    ControlPlane --> RD
    ControlPlane -. "Geocoding" .-> Maps
    
    AIOrchestration --> CR
    AIOrchestration --> RD
Loading

Data Flow β€” Emergency Query Lifecycle

sequenceDiagram
    autonumber
    participant U as User
    participant PWA as Frontend PWA
    participant GW as FastAPI Gateway
    participant AI as AI Chatbot
    participant DB as PostgreSQL + PostGIS
    participant EXT as OpenStreetMap

    U->>PWA: "Find nearest hospital"
    
    alt Online Mode
        PWA->>GW: POST /api/emergency/nearby
        GW->>DB: ST_DWithin spatial query
        DB-->>GW: Ranked results
        GW->>EXT: Reverse geocode addresses
        EXT-->>GW: Formatted addresses
        GW-->>PWA: Emergency response payload
    else Offline Mode
        PWA->>PWA: Query DuckDB-Wasm cache
        PWA->>PWA: Calculate distance via Turf.js
        PWA-->>U: Cached emergency data
    end

    PWA-->>U: Display nearest hospitals on MapLibre
Loading

πŸ“ˆ Test Coverage

SafeVixAI maintains enterprise-grade test coverage across all three services.

Service Tests Coverage Framework
Backend 2,908 100% pytest (asyncio)
Chatbot 1,819 97%+ pytest (asyncio)
Frontend 2,956 87%+ Jest + RTL
E2E 55 β€” Playwright
Total 7,738 β€” β€”

πŸ“š Documentation

SafeVixAI is exhaustively documented. Our enterprise documentation portal is built with MkDocs Material and hosted on GitHub Pages.

Section Key Documents
πŸ—οΈ Architecture System Design Β· Offline Architecture Β· Tech Stack
🧠 AI & Agents AI System · RAG Pipeline · Memory Architecture
πŸ‘¨β€πŸ’» Developer Guide Setup Β· Testing Β· Style Guide
πŸ”Œ API Reference SDK Guide Β· Error Codes Β· Webhooks
πŸ“ˆ SRE & Ops Operations Β· Monitoring Β· Deployment
πŸ›‘οΈ Security Threat Model Β· Privacy Β· Auth

πŸ“– Full documentation portal: safevixai.github.io/SafeVixAI


🀝 Contributing

We believe in the power of open source to save lives. Whether you're optimizing a PostGIS query, expanding the AI RAG corpus, or fixing a UI bug, your contributions are critical.

  1. Review our Code of Conduct
  2. Read the Contributing Guide for Git workflow standards
  3. Check the Good First Issues to jump right in

πŸ›‘οΈ Security & Trust

Security is our top priority. SafeVixAI utilizes strict SBOM tracking, CodeQL static analysis, SLSA provenance, and regular dependency audits via Dependabot.

If you discover a vulnerability, please refer to our Security Policy and report it directly to [email protected]. We adhere to responsible disclosure guidelines.


πŸ’¬ Community & Support

Channel Link
Discussions GitHub Discussions
Issues GitHub Issues
Support SLAs SUPPORT.md
Governance GOVERNANCE.md

✨ Contributors

Contributors

πŸ“ˆ Star History

Star History Chart


Built with ❀️ and extreme engineering by the SafeVixAI Team for a safer tomorrow.

Released under the MIT License.

About

AI-powered road safety and smart mobility platform for India. Features real-time hazard detection, emergency SOS dispatch, challan risk calculator, and voice-enabled assistant.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages