Skip to content

priyabratasahoo780/Infinity_Coders-v2v

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SafeSphere AI Logo

SafeSphere AI

Predict. Protect. Prevent.

A Zero-Trust, Predictive Safety Ecosystem
Next-generation intelligent safety platform leveraging Edge AI and zero-touch triggers.



🚨 The Reality of Women's Safety

In high-stress emergency situations, existing personal safety applications consistently fail at their core premise. They rely on a fundamentally reactive model: expecting a victim who is under physical threat, harassment, or extreme panic to possess the fine motor skills and time required to pull out a phone, unlock the screen, navigate to an app, and manually press an SOS button.

When a real threat occurs, physical interaction with a device is often the first thing compromised. By the time a user manages to trigger an alarm, the critical window for prevention has already closed. Current apps act as passive digital pagers, failing victims exactly when they need an active shield the most.


πŸ›‘οΈ SafeSphere: A Predictive Approach

SafeSphere AI removes the burden of action from the victim. We are shifting personal safety from a model of reactive panic to predictive intelligence and zero-touch intervention.

We built a platform that acts as an autonomous digital bodyguard. By continuously analyzing environmental, spatial, and behavioral telemetry, SafeSphere detects risks before they escalate. If a threat materializes or the user is incapacitated, the system triggers invisible, hardware-level safeguardsβ€”broadcasting live location, recording encrypted evidence, and notifying guardiansβ€”all without requiring a single tap on the screen. SafeSphere knows when you are in danger and acts on your behalf.


✨ Core Capabilities

1. Predictive Risk Engine

Instead of waiting for an emergency, the system calculates a real-time Safety Score (0-100) using high-frequency telemetry data:

  • Spatial: Live GPS against crowd-sourced crime heatmaps.
  • Environmental: Ambient light sensor data and time-of-day.
  • Behavioral: Accelerometer motion patterns and travel speed anomalies.

2. Multi-Modal Zero-Touch SOS

When physical interaction with a device is compromised, SafeSphere provides alternative, invisible triggers:

  • Voice Recognition: Always-listening local ML model detecting distress keywords ("Help", "Stop").
  • Inertial Triggers: High-G accelerometer shake detection.
  • Hardware Gestures: Volume button sequence mapping.

3. Autonomous Legal Evidence Collection

Upon emergency activation, the system bypasses user interaction to secure verifiable, tamper-proof evidence:

  • Simultaneous front/back camera photo capture.
  • Continuous audio/video recording.
  • Instant Cloud Sync: AES-256 encrypted payloads uploaded immediately to prevent data loss if the device is destroyed.

4. Guardian Telemetry Dashboard

Authorized contacts receive real-time access to a low-latency dashboard featuring:

  • High-precision GPS tracking.
  • Device health (Battery %, Network strength).
  • Live Safety Score and activity status.

πŸ—οΈ System Architecture

The platform operates on a Feature-First Clean Architecture spanning the mobile client, Supabase backend, Edge Functions, and AI processing layer. Every component is purpose-built for high-throughput safety analytics at scale:

flowchart TD
    subgraph Client ["🌐 Client Tier β€” React Native Expo"]
        direction TB
        UI["βš›οΈ Feature UI<br>(Expo Router + NativeWind)"]
        
        State["🧠 Local State & Cache<br>(Zustand + TanStack Query)"]
        
        UI --> State
        
        Sync["πŸ”„ Sync Engine<br>(Expo SQLite Outbox)"]
        State --> Sync
    end

    Client -- "REST / Realtime" --> Backend

    subgraph Backend ["☁️ Backend Tier β€” Supabase"]
        direction TB
        Auth["πŸ” Supabase Auth<br>(JWT)"]
        
        Postgres["πŸ—„οΈ PostgreSQL Database<br>(Row Level Security + PostGIS)"]
        
        Storage["πŸ“ Supabase Storage<br>(AES-256 Encrypted Evidence)"]
        
        Edge["⚑ Edge Functions<br>(Deno / AI Integration)"]
        
        Realtime["πŸ”” Supabase Realtime<br>(Live Location Tracking)"]

        Auth --> Postgres
        Postgres --> Edge
        Postgres --> Realtime
        Postgres --> Storage
    end

    Backend -- "Serverless / RPC" --> AI

    subgraph AI ["πŸ€– AI Engine Tier"]
        direction TB
        Gemini["🧠 Gemini 2.0 Flash<br>(Risk Analysis + Chatbot)"]
        TFLite["πŸ“Š TensorFlow Lite<br>(On-device Pattern Detection)"]
        
        Gemini ~~~ TFLite
    end

    Backend -- "REST API" --> Maps

    subgraph Maps ["πŸ“ Location & Maps Tier"]
        direction TB
        SDK["πŸ—ΊοΈ Maps SDK<br>(Live Heatmaps)"]
        Places["πŸ₯ Places API<br>(Nearby Safe Zones)"]
        
        SDK ~~~ Places
    end

    %% Node Styling (Matching the provided screenshots)
    style React fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Zustand fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Router fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Services fill:#1E3A8A,color:#fff,stroke:#3B82F6

    style Auth fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style Firestore fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style Storage fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style FCM fill:#4C1D95,color:#fff,stroke:#8B5CF6

    style Gemini fill:#065F46,color:#fff,stroke:#10B981
    style TFLite fill:#065F46,color:#fff,stroke:#10B981

    style SDK fill:#9F1239,color:#fff,stroke:#F43F5E
    style Places fill:#9F1239,color:#fff,stroke:#F43F5E

    %% Subgraph Styling (Grey background, no borders)
    style Client fill:#424242,stroke:none,color:#fff
    style Backend fill:#424242,stroke:none,color:#fff
    style AI fill:#424242,stroke:none,color:#fff
    style Maps fill:#424242,stroke:none,color:#fff
Loading

πŸ”’ Security Architecture

The platform implements a Zero-Trust, Defense-in-Depth security model across both client and server tiers:

flowchart LR
    subgraph APISide ["βš™οΈ API-Side Security"]
        direction TB
        Rules["πŸ›‘οΈ Postgres RLS<br>(Row Level Security)"]
        CORS["🌐 CORS Whitelist<br>(Only allowed origins)"]
        Rate["⏱️ Rate Limiting<br>Edge Functions (Vault secrets)"]
        StorageSec["πŸ“ Storage Security<br>(Auth-only Evidence Upload)"]
        NoSQL["🧹 Schema Validator<br>(Postgres constraints + Enums)"]
        JWT["πŸ” JWT Verify<br>(Supabase Auth)"]
        
        Rules --> CORS --> Rate --> StorageSec --> NoSQL --> JWT
    end

    subgraph ClientSide ["🌐 Client-Side Security"]
        direction LR
        Zod["βœ… Zod Schema Validation<br>(Client-side form guards)"]
        Route["πŸ›‘οΈ Route Guards<br>(Expo Router auth middleware)"]
        Store["πŸ”‘ Encrypted MMKV Store<br>(AES-256 for local state)"]
        Logout["πŸšͺ Auto Logout<br>(401 response -> clear token + redirect)"]
        Backoff["⏳ Exponential Backoff<br>(5xx retry: 1s -> 2s -> fail)"]

        Zod --> Route --> Store
        Store --> Logout
        Store --> Backoff
    end

    ClientSide -- "HTTPS / WSS" --> APISide

    %% Node Styling
    style Rules fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style CORS fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style Rate fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style StorageSec fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style NoSQL fill:#4C1D95,color:#fff,stroke:#8B5CF6
    style JWT fill:#4C1D95,color:#fff,stroke:#8B5CF6

    style Zod fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Route fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Store fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Logout fill:#1E3A8A,color:#fff,stroke:#3B82F6
    style Backoff fill:#1E3A8A,color:#fff,stroke:#3B82F6

    %% Subgraph Styling
    style APISide fill:#424242,stroke:none,color:#fff
    style ClientSide fill:#424242,stroke:none,color:#fff
Loading

πŸ—„οΈ Database Tier β€” PostgreSQL Schema

erDiagram
  PROFILES ||--o{ TRUSTED_CONTACTS : has
  PROFILES ||--o{ JOURNEYS : starts
  PROFILES ||--o{ SOS_EVENTS : triggers
  PROFILES ||--o{ COMMUNITY_REPORTS : submits
  PROFILES ||--o{ REPORT_VOTES : casts
  PROFILES ||--o{ PUSH_TOKENS : registers
  PROFILES ||--o{ ASSISTANT_CONVERSATIONS : owns
  SOS_EVENTS ||--o{ SOS_LOCATION_PINGS : streams
  SOS_EVENTS ||--o{ SOS_GUARDIANS : notifies
  SOS_EVENTS ||--o{ EVIDENCE_FILES : captures
  JOURNEYS ||--o{ JOURNEY_CHECKINS : records
  JOURNEYS ||--o| SOS_EVENTS : "may escalate to"
  TRUSTED_CONTACTS }o--|| PROFILES : "guardian profile"
  COMMUNITY_REPORTS ||--o{ REPORT_VOTES : receives
  COMMUNITY_REPORTS ||--o{ REPORT_COMMENTS : receives
  SAFETY_SCORES }o--|| GEO_CELLS : "computed for"
Loading

πŸ’» Tech Stack Highlights

Layer Technology Purpose
Core Framework React Native + Expo Cross-platform mobile architecture
State Management Zustand + React Query Predictable local and server state sync
Styling Engine NativeWind (Tailwind CSS) Utility-first, performant glassmorphism
Cloud Backend Supabase (Postgres/Auth/Edge/Realtime) Robust RLS and scalable backend
Offline Storage Expo SQLite (Drizzle ORM) Durable SOS outbox and sync engine
AI Processing Gemini 2.0 Flash + TF Lite Millisecond-latency risk analysis
Geolocation Google Maps Platform Routing, Heatmaps, and Safe Zones

πŸ“‚ Project Structure & Feature Mapping

We follow a strict Feature-First Clean Architecture. Each domain is isolated to prevent tangled dependencies.

Infinity_Coders-v2v/
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ features
β”‚   β”‚   β”œβ”€β”€ ai-assistant
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ community-reports
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ evidence-vault
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ journeys
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ profile-settings
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ safe-navigation
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ safety-score
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   β”œβ”€β”€ sos
β”‚   β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ offline
β”‚   β”‚   β”‚   β”œβ”€β”€ repository
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts
β”‚   β”‚   β”‚   └── types.ts
β”‚   β”‚   └── trusted-contacts
β”‚   β”‚       β”œβ”€β”€ components
β”‚   β”‚       β”œβ”€β”€ hooks
β”‚   β”‚       β”œβ”€β”€ repository
β”‚   β”‚       β”œβ”€β”€ index.ts
β”‚   β”‚       └── types.ts
β”‚   β”œβ”€β”€ i18n
β”‚   β”œβ”€β”€ navigation
β”‚   └── shared
β”‚       β”œβ”€β”€ constants
β”‚       β”œβ”€β”€ hooks
β”‚       β”œβ”€β”€ lib
β”‚       β”‚   β”œβ”€β”€ sync-engine
β”‚       β”‚   β”‚   β”œβ”€β”€ outbox.ts
β”‚       β”‚   β”‚   └── worker.ts
β”‚       β”‚   β”œβ”€β”€ axios-client.ts
β”‚       β”‚   β”œβ”€β”€ sqlite-db.ts
β”‚       β”‚   └── supabase-client.ts
β”‚       β”œβ”€β”€ stores
β”‚       └── ui
β”œβ”€β”€ supabase
β”‚   β”œβ”€β”€ functions
β”‚   β”‚   β”œβ”€β”€ ai-assistant-chat
β”‚   β”‚   β”œβ”€β”€ classify-report
β”‚   β”‚   β”œβ”€β”€ compute-safety-score
β”‚   β”‚   β”œβ”€β”€ notify-guardians
β”‚   β”‚   └── suggest-safe-route
β”‚   └── migrations
└── assets
    └── logo.png

πŸš€ Setup & Local Development

Prerequisites

  • Node.js v18+
  • Expo CLI
  • Docker (for local Supabase instance)
  • Supabase CLI

Installation

  1. Clone the repository:

    git clone https://github.com/your-org/Infinity_Coders-v2v.git
    cd Infinity_Coders-v2v
    npm install
  2. Configure Environment:

    cp .env.example .env
    # Add your API keys to .env
  3. Start Development Server:

    npx expo start

Designed and engineered for maximum reliability. Built by Infinity Coders.

About

A cross-platform mobile and web application built with Expo, featuring real-time interactive mapping and secure OTP authentication.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors