# viveeeekkkkkkk/infrasense architecture

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

- Interactive diagram: https://gitdiagram.com/viveeeekkkkkkk/infrasense
- Repository: https://github.com/viveeeekkkkkkk/infrasense

## Overview

INFRASENSE is a smart-city infrastructure monitoring application combining a public-facing web interface, citizen incident reporting, and an administrative monitoring dashboard. The main workflow is to open the app, inspect infrastructure status and alerts, and optionally submit a complaint; administrators can review monitoring data and schedule maintenance. The graph also preserves the map, location, and shared UI capabilities. Backend internals are not detailed in the supplied excerpts, so its implementation and persistence are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/pages/Dashboard.jsx`](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Dashboard.jsx) (Dashboard), [`frontend/src/context/LocationContext.jsx`](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/LocationContext.jsx) (Location services), [`frontend/src/context/AuthContext.jsx`](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/AuthContext.jsx) (Admin state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_home["Homepage<br/>[Homepage.jsx]"]
  node_backend["Backend API and sockets<br/>[server.js]"]
end

subgraph group_monitor["Monitoring and maps"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_alerts["Alerts page<br/>[Alerts.jsx]"]
  node_map_page["Map page<br/>[MapPage.jsx]"]
  node_map_view["Interactive map<br/>[MapView.jsx]"]
  node_status["Status grid<br/>[StatusGrid.jsx]"]
  node_charts["Trend charts<br/>[Charts.jsx]"]
  node_alert_panel["Alert panel<br/>[AlertPanel.jsx]"]
  node_maintenance["Maintenance view"]
end

subgraph group_civic["Citizen reporting"]
  node_complaints["Complaint workflow<br/>[Complaints.jsx]"]
end

subgraph group_shared["Shared state and UI"]
  node_auth["Admin state<br/>[AuthContext.jsx]"]
  node_location["Location services"]
  node_theme["Theme state<br/>[ThemeContext.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_theme_toggle["Theme toggle<br/>[ThemeToggle.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
end

node_visitor(("Visitor or admin"))
node_nominatim["Nominatim geocoding"]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_complaints
node_app -->|"routes to"| node_alerts
node_app -->|"routes to"| node_map_page
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_footer
node_app -->|"provides"| node_auth
node_app -->|"provides"| node_location
node_app -->|"provides"| node_theme
node_dashboard -->|"renders"| node_status
node_dashboard -->|"renders"| node_charts
node_dashboard -->|"renders"| node_alert_panel
node_dashboard -->|"renders"| node_maintenance
node_dashboard -->|"fetches data"| node_backend
node_dashboard -->|"opens socket"| node_backend
node_complaints -->|"submits complaint"| node_backend
node_complaints -->|"uses location"| node_location
node_complaints -->|"checks admin"| node_auth
node_dashboard -->|"checks admin"| node_auth
node_home -->|"uses location"| node_location
node_home -->|"checks admin"| node_auth
node_map_page -->|"renders"| node_map_view
node_map_view -->|"uses location"| node_location
node_location -->|"geocodes addresses"| node_nominatim
node_map_view -->|"reverse geocodes"| node_nominatim
node_navbar -->|"uses admin state"| node_auth
node_navbar -->|"renders"| node_theme_toggle
node_theme_toggle -->|"toggles theme"| node_theme

click node_app "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Homepage.jsx"
click node_dashboard "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Dashboard.jsx"
click node_alerts "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Alerts.jsx"
click node_map_page "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/MapPage.jsx"
click node_map_view "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/MapView.jsx"
click node_status "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/StatusGrid.jsx"
click node_charts "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Charts.jsx"
click node_alert_panel "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/AlertPanel.jsx"
click node_maintenance "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/MaintenanceView.jsx"
click node_complaints "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Complaints.jsx"
click node_auth "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/AuthContext.jsx"
click node_location "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/LocationContext.jsx"
click node_theme "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/ThemeContext.jsx"
click node_navbar "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Navbar.jsx"
click node_theme_toggle "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/ThemeToggle.jsx"
click node_footer "https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Footer.jsx"
click node_backend "https://github.com/viveeeekkkkkkk/infrasense/blob/main/backend/server.js"

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_app,node_home,node_backend toneBlue
class node_dashboard,node_alerts,node_map_page,node_map_view,node_status,node_charts,node_alert_panel,node_maintenance toneAmber
class node_complaints toneMint
class node_auth,node_location,node_theme,node_navbar,node_theme_toggle,node_footer toneRose
class node_visitor,node_nominatim toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Homepage](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Homepage.jsx): `frontend/src/pages/Homepage.jsx`
- [Backend API and sockets](https://github.com/viveeeekkkkkkk/infrasense/blob/main/backend/server.js): `backend/server.js`

### Monitoring and maps

- [Dashboard](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Alerts page](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Alerts.jsx): `frontend/src/pages/Alerts.jsx`
- [Map page](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/MapPage.jsx): `frontend/src/pages/MapPage.jsx`
- [Interactive map](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/MapView.jsx): `frontend/src/components/MapView.jsx`
- [Status grid](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/StatusGrid.jsx): `frontend/src/components/StatusGrid.jsx`
- [Trend charts](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Charts.jsx): `frontend/src/components/Charts.jsx`
- [Alert panel](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/AlertPanel.jsx): `frontend/src/components/AlertPanel.jsx`
- [Maintenance view](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/MaintenanceView.jsx): `frontend/src/components/MaintenanceView.jsx`

### Citizen reporting

- [Complaint workflow](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/pages/Complaints.jsx): `frontend/src/pages/Complaints.jsx`

### Shared state and UI

- [Admin state](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Location services](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/LocationContext.jsx): `frontend/src/context/LocationContext.jsx`
- [Theme state](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/context/ThemeContext.jsx): `frontend/src/context/ThemeContext.jsx`
- [Navigation](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Theme toggle](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/ThemeToggle.jsx): `frontend/src/components/ThemeToggle.jsx`
- [Footer](https://github.com/viveeeekkkkkkk/infrasense/blob/main/frontend/src/components/Footer.jsx): `frontend/src/components/Footer.jsx`

### Other components

- **Visitor or admin**
- **Nominatim geocoding**

## Connections

- Visitor or admin → App routing: opens (evidence: `README.md`)
- App routing → Homepage: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Complaint workflow: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Alerts page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Map page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App routing → Footer: renders (evidence: `frontend/src/App.jsx`)
- App routing → Admin state: provides (evidence: `frontend/src/App.jsx`)
- App routing → Location services: provides (evidence: `frontend/src/App.jsx`)
- App routing → Theme state: provides (evidence: `frontend/src/App.jsx`)
- Dashboard → Status grid: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Trend charts: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Alert panel: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Maintenance view: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Backend API and sockets: fetches data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Backend API and sockets: opens socket (evidence: `frontend/src/pages/Dashboard.jsx`)
- Complaint workflow → Backend API and sockets: submits complaint (evidence: `frontend/src/pages/Complaints.jsx`)
- Complaint workflow → Location services: uses location (evidence: `frontend/src/pages/Complaints.jsx`)
- Complaint workflow → Admin state: checks admin (evidence: `frontend/src/pages/Complaints.jsx`)
- Dashboard → Admin state: checks admin (evidence: `frontend/src/pages/Dashboard.jsx`)
- Homepage → Location services: uses location (evidence: `frontend/src/pages/Homepage.jsx`)
- Homepage → Admin state: checks admin (evidence: `frontend/src/pages/Homepage.jsx`)
- Map page → Interactive map: renders (evidence: `frontend/src/pages/MapPage.jsx`)
- Interactive map → Location services: uses location (evidence: `frontend/src/components/MapView.jsx`)
- Location services → Nominatim geocoding: geocodes addresses (evidence: `frontend/src/context/LocationContext.jsx`)
- Interactive map → Nominatim geocoding: reverse geocodes (evidence: `frontend/src/components/MapView.jsx`)
- Navigation → Admin state: uses admin state (evidence: `frontend/src/components/Navbar.jsx`)
- Navigation → Theme toggle: renders (evidence: `frontend/src/components/Navbar.jsx`)
- Theme toggle → Theme state: toggles theme (evidence: `frontend/src/components/ThemeToggle.jsx`)
