# arbaaz-khan-tech/hackverse_2025_suraksha_setu architecture

> Architecture diagram of the GitHub repository arbaaz-khan-tech/hackverse_2025_suraksha_setu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu
- Repository: https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu

## Overview

##### Project type and purpose
- SurakshaSetu is a full-stack, AI-powered public-safety platform.
- It comprises three major subsystems:
- AI Detection Modules (facial recognition, hidden-weapon detection, intrusion sensing)
- Police Dashboard (Flask web app)
- Citizen Mobile App (Expo React Native)

##### File structure
- Top-level directories:
- Facial_Recognition(Criminal+Missing Person Detection) – Flask app + embeddings
- Hidden_Weapon_Detection – Streamlit app + ML weights
- The_Sword_App – renamed “backend” folder is actually the Police Dashboard, plus a “citizen” folder for React Native
- Config & code:
- app.py in each subfolder – entry points for each service
- embeddings/*.npy – stored face vectors
- *.pt files – YOLO/Infrared weapon-detection models
- requirements.txt – Python deps
- citizen/src – mobile screens, socket service, API config
- backend/templates & static – Jinja2 pages, JavaScript libs

##### README for additional insights
- AI modules run as independent microservices or local processes.
- Police Dashboard (Flask) calls ML services and MongoDB.
- Citizen App communicates via REST/Socket to the Flask backend.
- Uses Twilio for SMS/WhatsApp, MongoDB Atlas for data persistence, NVIDIA GPU for inference.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% AI Services Layer
    subgraph "AI Services"
        direction TB
        IS["Edge Sensor Gateway"]:::ai
        CCTV["CCTV Streams"]:::external
        FRS["Facial Recognition Service"]:::ai
        FR_EMB["Embeddings (.npy)"]:::artifact
        FR_TPL["Templates (HTML)"]:::artifact
        WDTS["Hidden Weapon Detection Service"]:::ai
        WD_MOD["Models (.pt)"]:::artifact
        WD_UI["Static & UI"]:::artifact
    end

    %% Backend Layer
    subgraph "Flask Backend (Police Dashboard)"
        direction TB
        FB["Flask Backend"]:::backend
        BE_MOD["Model Artifacts (.pt)"]:::artifact
        BE_EMB["Embeddings (.npy)"]:::artifact
        BE_TPL["Templates (Jinja2)"]:::artifact
        BE_ST["Static Assets"]:::artifact
        BE_UTIL["Utilities (json_encoder.py)"]:::artifact
    end

    %% Mobile Layer
    subgraph "Citizen Mobile App"
        direction TB
        CA["Expo React Native App"]:::mobile
        MSCR["Screens"]:::artifact
        MCOMP["Components"]:::artifact
        MCONF["Config (api.js)"]:::artifact
        MSVC["Services (socketService)"]:::artifact
        MCTX["Context & Navigation"]:::artifact
    end

    %% External Services & Infrastructure
    Mongo["MongoDB Atlas"]:::db
    Twilio["Twilio API"]:::external
    GPU["NVIDIA GPU"]:::external

    %% Data Flows
    CCTV -->|"video feed"| FRS
    CCTV -->|"video feed"| WDTS
    IS -->|"sensor data"| FB

    FRS -->|"identify API"| FB
    WDTS -->|"detect API"| FB

    FB -->|"store/retrieve"| Mongo
    FB -->|"send alerts"| Twilio
    FB -->|"inference"| GPU

    CA -->|"REST API"| FB
    CA -.->|"WebSocket"| FB

    %% Click Events
    click FRS "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Facial_Recognition(Criminal+Missing Person Detection)/app.py"
    click FR_EMB "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Facial_Recognition(Criminal+Missing Person Detection)/embeddings/*.npy"
    click FR_TPL "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Facial_Recognition(Criminal+Missing Person Detection)/templates/*.html"
    click WDTS "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Hidden_Weapon_Detection/app.py"
    click WD_MOD "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Hidden_Weapon_Detection/best.pt"
    click WD_MOD "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Hidden_Weapon_Detection/best3.pt"
    click WD_MOD "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Hidden_Weapon_Detection/thermal.pt"
    click WD_UI "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/tree/master/Hidden_Weapon_Detection/static/"
    click WD_UI "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/Hidden_Weapon_Detection/templates/index.html"
    click FB "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/app.py"
    click BE_MOD "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/arms_detect.pt"
    click BE_MOD "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/viodec_mk1.pt"
    click BE_EMB "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/person1_embedding.npy"
    click BE_EMB "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/ranu.npy"
    click BE_TPL "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/templates/Police/*.html"
    click BE_TPL "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/templates/police_base.html"
    click BE_ST "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/static/pmap.js"
    click BE_UTIL "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/backend/utils/json_encoder.py"
    click CA "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/tree/master/The_Sword_App/citizen/"
    click MSCR "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/Screens/*.js"
    click MSCR "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/Screens/SafeWalk.css"
    click MCOMP "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/components/*.js"
    click MCONF "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/config/api.js"
    click MSVC "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/services/socketService.js"
    click MCTX "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/context/*.js"
    click MCTX "https://github.com/arbaaz-khan-tech/hackverse_2025_suraksha_setu/blob/master/The_Sword_App/citizen/src/navigation/AppNavigator.js"

    %% Styles
    classDef ai fill:#ffe4e1,stroke:#d2691e,stroke-width:2px
    classDef backend fill:#e6f7ff,stroke:#4682b4,stroke-width:2px
    classDef mobile fill:#f0fff0,stroke:#228b22,stroke-width:2px
    classDef artifact fill:#fffacd,stroke:#daa520,stroke-width:1px
    classDef db fill:#faf0e6,stroke:#a0522d,stroke-width:2px
    classDef external fill:#f5f5f5,stroke:#696969,stroke-width:2px
```
