# mandavavasanth/rakshaknet architecture

> Architecture diagram of the GitHub repository mandavavasanth/rakshaknet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mandavavasanth/rakshaknet
- Repository: https://github.com/mandavavasanth/rakshaknet

## Overview

RakshakNet is a disaster-response command center for receiving field alerts, coordinating rescue teams, and monitoring operations. Its main workflow runs from LoRa hardware packets through the serial bridge into the API, where alerts are validated, stored, and broadcast to connected dashboards; operators review locations and dispatch teams. The product also provides mission history and reports, team inventory, dispatch chat, statistics, and AI-intelligence views. Backend route details for several auxiliary domains and implementation details of some frontend pages were not excerpted, so those links are limited to documented or indexed evidence.

Main entry points: [`src/App.jsx`](https://github.com/mandavavasanth/rakshaknet/blob/main/src/App.jsx) (Dashboard App), [`routes/alerts.py`](https://github.com/mandavavasanth/rakshaknet/blob/main/routes/alerts.py) (Alert API), [`main.py`](https://github.com/mandavavasanth/rakshaknet/blob/main/main.py) (FastAPI Application), [`routes/teams.py`](https://github.com/mandavavasanth/rakshaknet/blob/main/routes/teams.py) (Team API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field["Field Intake"]
  node_serial["Serial Bridge<br/>[bridge.py]"]
end

subgraph group_backend["API and Operations"]
  node_api["FastAPI Application<br/>[main.py]"]
  node_alerts["Alert API<br/>[alerts.py]"]
  node_teams["Team API<br/>[teams.py]"]
  node_other_routes["Other API Routes"]
  node_schemas["Request Schemas<br/>[schemas.py]"]
  node_security["API Key Checks<br/>[security.py]"]
  node_ws_manager["WebSocket Broadcast"]
end

subgraph group_frontend["Command Dashboard"]
  node_app["Dashboard App<br/>[App.jsx]"]
  node_api_client["API Client<br/>[api.js]"]
  node_ws_hook["WebSocket Hook<br/>[useWebSocket.js]"]
  node_alerts_ui["Alert Dispatch<br/>[ActiveAlerts.jsx]"]
  node_map_ui["Live GPS Map<br/>[LiveGPSMap.jsx]"]
  node_dashboard_ui["Dashboard View<br/>[Dashboard.jsx]"]
  node_teams_ui["Rescue Teams View<br/>[RescueTeams.jsx]"]
  node_chat_ui["Dispatch Chat<br/>[DispatchChat.jsx]"]
  node_history_ui["Mission History<br/>[MissionHistory.jsx]"]
  node_inventory_ui["Team Inventory<br/>[RescueTeams.jsx]"]
  node_ai_ui["AI Intelligence<br/>[AIIntelligence.jsx]"]
  node_settings_ui["Settings<br/>[Settings.jsx]"]
  node_voice["Voice Controls<br/>[voiceController.js]"]
  node_stats_ui["Operations Statistics<br/>[StatsCard.jsx]"]
end

subgraph group_records["Operational Records"]
  node_db[("Database Session<br/>[database.py]")]
  node_models["Operational Models<br/>[models.py]"]
end

node_operator(("Emergency Operator"))
node_hardware{{"LoRa Nodes"}}

node_hardware -->|"sends packets"| node_serial
node_serial -.->|"submits alerts"| node_api
node_api -->|"registers routes"| node_alerts
node_api -->|"registers routes"| node_teams
node_api -->|"registers routes"| node_other_routes
node_alerts -->|"validates payloads"| node_schemas
node_alerts -->|"checks keys"| node_security
node_alerts -->|"opens sessions"| node_db
node_alerts -->|"queries records"| node_models
node_teams -->|"opens sessions"| node_db
node_teams -->|"queries records"| node_models
node_teams -->|"checks keys"| node_security
node_alerts -->|"broadcasts updates"| node_ws_manager
node_teams -->|"broadcasts changes"| node_ws_manager
node_api -->|"accepts socket"| node_ws_manager
node_operator -->|"uses dashboard"| node_app
node_app -->|"loads data"| node_api_client
node_app -->|"subscribes updates"| node_ws_hook
node_ws_hook -->|"delivers messages"| node_app
node_app -->|"renders page"| node_alerts_ui
node_app -->|"renders page"| node_map_ui
node_app -->|"renders page"| node_dashboard_ui
node_app -->|"renders page"| node_teams_ui
node_app -->|"renders page"| node_chat_ui
node_app -->|"renders page"| node_history_ui
node_app -->|"renders page"| node_ai_ui
node_app -->|"renders page"| node_settings_ui
node_alerts_ui -->|"updates alerts"| node_api_client
node_api_client -->|"calls endpoints"| node_alerts
node_ws_manager -.->|"broadcasts events"| node_ws_hook
node_operator -.->|"uses controls"| node_voice
node_dashboard_ui -.->|"shows metrics"| node_stats_ui
node_teams_ui -.->|"manages supplies"| node_inventory_ui
node_operator -->|"downloads reports"| node_history_ui
node_operator -->|"tracks incidents"| node_map_ui

click node_serial "https://github.com/mandavavasanth/rakshaknet/blob/main/serial_bridge/bridge.py"
click node_api "https://github.com/mandavavasanth/rakshaknet/blob/main/main.py"
click node_alerts "https://github.com/mandavavasanth/rakshaknet/blob/main/routes/alerts.py"
click node_teams "https://github.com/mandavavasanth/rakshaknet/blob/main/routes/teams.py"
click node_other_routes "https://github.com/mandavavasanth/rakshaknet/tree/main/routes"
click node_schemas "https://github.com/mandavavasanth/rakshaknet/blob/main/schemas.py"
click node_security "https://github.com/mandavavasanth/rakshaknet/blob/main/security.py"
click node_ws_manager "https://github.com/mandavavasanth/rakshaknet/blob/main/websocket_manager.py"
click node_db "https://github.com/mandavavasanth/rakshaknet/blob/main/database.py"
click node_models "https://github.com/mandavavasanth/rakshaknet/blob/main/models.py"
click node_app "https://github.com/mandavavasanth/rakshaknet/blob/main/src/App.jsx"
click node_api_client "https://github.com/mandavavasanth/rakshaknet/blob/main/src/utils/api.js"
click node_ws_hook "https://github.com/mandavavasanth/rakshaknet/blob/main/src/hooks/useWebSocket.js"
click node_alerts_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/ActiveAlerts.jsx"
click node_map_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/LiveGPSMap.jsx"
click node_dashboard_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/Dashboard.jsx"
click node_teams_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/RescueTeams.jsx"
click node_chat_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/DispatchChat.jsx"
click node_history_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/MissionHistory.jsx"
click node_inventory_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/RescueTeams.jsx"
click node_ai_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/AIIntelligence.jsx"
click node_settings_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/Settings.jsx"
click node_voice "https://github.com/mandavavasanth/rakshaknet/blob/main/src/voice/voiceController.js"
click node_stats_ui "https://github.com/mandavavasanth/rakshaknet/blob/main/src/components/StatsCard.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_serial toneBlue
class node_api,node_alerts,node_teams,node_other_routes,node_schemas,node_security,node_ws_manager toneAmber
class node_app,node_api_client,node_ws_hook,node_alerts_ui,node_map_ui,node_dashboard_ui,node_teams_ui,node_chat_ui,node_history_ui,node_inventory_ui,node_ai_ui,node_settings_ui,node_voice,node_stats_ui toneMint
class node_db,node_models toneRose
class node_operator,node_hardware toneIndigo
```

## Components

### Field Intake

- [Serial Bridge](https://github.com/mandavavasanth/rakshaknet/blob/main/serial_bridge/bridge.py): `serial_bridge/bridge.py`

### API and Operations

- [FastAPI Application](https://github.com/mandavavasanth/rakshaknet/blob/main/main.py): `main.py`
- [Alert API](https://github.com/mandavavasanth/rakshaknet/blob/main/routes/alerts.py): `routes/alerts.py`
- [Team API](https://github.com/mandavavasanth/rakshaknet/blob/main/routes/teams.py): `routes/teams.py`
- [Other API Routes](https://github.com/mandavavasanth/rakshaknet/tree/main/routes): `routes`
- [Request Schemas](https://github.com/mandavavasanth/rakshaknet/blob/main/schemas.py): `schemas.py`
- [API Key Checks](https://github.com/mandavavasanth/rakshaknet/blob/main/security.py): `security.py`
- [WebSocket Broadcast](https://github.com/mandavavasanth/rakshaknet/blob/main/websocket_manager.py): `websocket_manager.py`

### Command Dashboard

- [Dashboard App](https://github.com/mandavavasanth/rakshaknet/blob/main/src/App.jsx): `src/App.jsx`
- [API Client](https://github.com/mandavavasanth/rakshaknet/blob/main/src/utils/api.js): `src/utils/api.js`
- [WebSocket Hook](https://github.com/mandavavasanth/rakshaknet/blob/main/src/hooks/useWebSocket.js): `src/hooks/useWebSocket.js`
- [Alert Dispatch](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/ActiveAlerts.jsx): `src/pages/ActiveAlerts.jsx`
- [Live GPS Map](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/LiveGPSMap.jsx): `src/pages/LiveGPSMap.jsx`
- [Dashboard View](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Rescue Teams View](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/RescueTeams.jsx): `src/pages/RescueTeams.jsx`
- [Dispatch Chat](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/DispatchChat.jsx): `src/pages/DispatchChat.jsx`
- [Mission History](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/MissionHistory.jsx): `src/pages/MissionHistory.jsx`
- [Team Inventory](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/RescueTeams.jsx): `src/pages/RescueTeams.jsx`
- [AI Intelligence](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/AIIntelligence.jsx): `src/pages/AIIntelligence.jsx`
- [Settings](https://github.com/mandavavasanth/rakshaknet/blob/main/src/pages/Settings.jsx): `src/pages/Settings.jsx`
- [Voice Controls](https://github.com/mandavavasanth/rakshaknet/blob/main/src/voice/voiceController.js): `src/voice/voiceController.js`
- [Operations Statistics](https://github.com/mandavavasanth/rakshaknet/blob/main/src/components/StatsCard.jsx): `src/components/StatsCard.jsx`

### Operational Records

- [Database Session](https://github.com/mandavavasanth/rakshaknet/blob/main/database.py): `database.py`
- [Operational Models](https://github.com/mandavavasanth/rakshaknet/blob/main/models.py): `models.py`

### Other components

- **Emergency Operator**
- **LoRa Nodes**

## Connections

- LoRa Nodes → Serial Bridge: sends packets (evidence: `README.md`)
- Serial Bridge → FastAPI Application: submits alerts (evidence: `README.md`)
- FastAPI Application → Alert API: registers routes (evidence: `main.py`)
- FastAPI Application → Team API: registers routes (evidence: `main.py`)
- FastAPI Application → Other API Routes: registers routes (evidence: `main.py`)
- Alert API → Request Schemas: validates payloads (evidence: `routes/alerts.py`)
- Alert API → API Key Checks: checks keys (evidence: `routes/alerts.py`)
- Alert API → Database Session: opens sessions (evidence: `routes/alerts.py`)
- Alert API → Operational Models: queries records (evidence: `routes/alerts.py`)
- Team API → Database Session: opens sessions (evidence: `routes/teams.py`)
- Team API → Operational Models: queries records (evidence: `routes/teams.py`)
- Team API → API Key Checks: checks keys (evidence: `routes/teams.py`)
- Alert API → WebSocket Broadcast: broadcasts updates (evidence: `routes/alerts.py`)
- Team API → WebSocket Broadcast: broadcasts changes (evidence: `routes/teams.py`)
- FastAPI Application → WebSocket Broadcast: accepts socket (evidence: `main.py`)
- Emergency Operator → Dashboard App: uses dashboard (evidence: `README.md`)
- Dashboard App → API Client: loads data (evidence: `src/App.jsx`)
- Dashboard App → WebSocket Hook: subscribes updates (evidence: `src/App.jsx`)
- WebSocket Hook → Dashboard App: delivers messages (evidence: `src/hooks/useWebSocket.js`)
- Dashboard App → Alert Dispatch: renders page (evidence: `src/App.jsx`)
- Dashboard App → Live GPS Map: renders page (evidence: `src/App.jsx`)
- Dashboard App → Dashboard View: renders page (evidence: `src/App.jsx`)
- Dashboard App → Rescue Teams View: renders page (evidence: `src/App.jsx`)
- Dashboard App → Dispatch Chat: renders page (evidence: `src/App.jsx`)
- Dashboard App → Mission History: renders page (evidence: `src/App.jsx`)
- Dashboard App → AI Intelligence: renders page (evidence: `src/App.jsx`)
- Dashboard App → Settings: renders page (evidence: `src/App.jsx`)
- Alert Dispatch → API Client: updates alerts (evidence: `src/pages/ActiveAlerts.jsx`)
- API Client → Alert API: calls endpoints (evidence: `src/utils/api.js`)
- WebSocket Broadcast → WebSocket Hook: broadcasts events (evidence: `README.md`)
- Emergency Operator → Voice Controls: uses controls
- Dashboard View → Operations Statistics: shows metrics
- Rescue Teams View → Team Inventory: manages supplies (evidence: `README.md`)
- Emergency Operator → Mission History: downloads reports (evidence: `README.md`)
- Emergency Operator → Live GPS Map: tracks incidents (evidence: `README.md`)
