# aldoesp/heatmap architecture

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

- Interactive diagram: https://gitdiagram.com/aldoesp/heatmap
- Repository: https://github.com/aldoesp/heatmap

## Overview

This is a Wi-Fi heatmapping and survey application: users upload floor plans, mark access points or survey locations, collect Wi-Fi scans, then inspect history, analysis, and heatmaps. The frontend is a hash-routed React app backed by an Express API and SQLite. The sampled code shows scan normalization and persistence, plan management, and data access; the tree and source index identify additional survey, analysis, settings, and mapping capabilities. Some route wiring and unsampled feature internals are therefore shown only as unverified links.

Main entry points: [`frontend/src/App.tsx`](https://github.com/aldoesp/heatmap/blob/main/frontend/src/App.tsx) (App and routing), [`frontend/src/lib/api.ts`](https://github.com/aldoesp/heatmap/blob/main/frontend/src/lib/api.ts) (API client), [`backend/src/api/index.js`](https://github.com/aldoesp/heatmap/blob/main/backend/src/api/index.js) (API routing), [`backend/src/services/surveys.service.js`](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/surveys.service.js) (Survey service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App and routing<br/>[App.tsx]"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_plans["Plans and surveys"]
  node_planui["Plan upload<br/>[UploadPage.tsx]"]
  node_surveyui["Survey library"]
  node_surveywork["Survey capture<br/>[SurveysPage.tsx]"]
  node_planstore["Plan state<br/>[usePlanStore.ts]"]
  node_surveyhook["Survey data"]
  node_plansctl["Plan operations"]
  node_surveysctl["Survey operations"]
  node_plansservice["Plan file service<br/>[plans.service.js]"]
  node_surveysservice["Survey service<br/>[surveys.service.js]"]
end

subgraph group_wifi["Wi-Fi collection"]
  node_scanui["Scan workspace<br/>[ScanPage.tsx]"]
  node_scanstore["Scan state<br/>[useScanStore.ts]"]
  node_scanctl["Scan operations<br/>[scan.controller.js]"]
  node_scanservice["Scan normalization<br/>[scan.services.js]"]
  node_termux["Device scan source"]
  node_connection["Connection details"]
  node_iperf["Speed measurement<br/>[iperf.service.js]"]
  node_wifiutils["Wi-Fi interpretation<br/>[wifi.utils.js]"]
end

subgraph group_insights["Analysis and settings"]
  node_heatui["Heatmap view<br/>[HeatmapPage.tsx]"]
  node_analysisui["Analysis view<br/>[AnalysePage.tsx]"]
  node_settingsui["Settings view<br/>[SettingsPage.tsx]"]
  node_analysisctl["Analysis operations"]
  node_settingsctl["Settings operations"]
end

subgraph group_backend["API and persistence"]
  node_api["API routing<br/>[index.js]"]
  node_scansrepo["Scan history"]
  node_scanpointsrepo["Scan locations"]
  node_bssidrepo["BSSID rules"]
  node_plansrepo["Plan records"]
  node_surveysrepo["Survey records"]
  node_db[("SQLite database<br/>[db.js]")]
end

node_user(("Operator"))
node_android(("Android scan provider"))
node_iperfserver(("iperf3 server"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_planui
node_app -->|"routes to"| node_scanui
node_app -->|"routes to"| node_surveyui
node_app -->|"routes to"| node_surveywork
node_app -->|"routes to"| node_heatui
node_app -->|"routes to"| node_analysisui
node_app -->|"routes to"| node_settingsui
node_planui -.->|"manages"| node_planstore
node_scanui -.->|"manages"| node_scanstore
node_surveyui -.->|"loads"| node_surveyhook
node_surveywork -.->|"loads"| node_surveyhook
node_planstore -->|"calls"| node_webapi
node_scanstore -->|"calls"| node_webapi
node_surveyhook -->|"calls"| node_webapi
node_heatui -->|"requests data"| node_webapi
node_settingsui -->|"requests data"| node_webapi
node_analysisui -.->|"requests data"| node_webapi
node_webapi -.->|"sends HTTP"| node_api
node_api -.->|"dispatches"| node_plansctl
node_api -.->|"dispatches"| node_scanctl
node_api -.->|"dispatches"| node_surveysctl
node_api -.->|"dispatches"| node_analysisctl
node_api -.->|"dispatches"| node_settingsctl
node_plansctl -->|"validates files"| node_plansservice
node_plansctl -->|"reads and writes"| node_plansrepo
node_plansctl -->|"deletes points"| node_scanpointsrepo
node_surveysctl -->|"delegates"| node_surveysservice
node_scanctl -->|"normalizes scan"| node_scanservice
node_scanctl -->|"finds location"| node_scanpointsrepo
node_scanctl -->|"saves and reads"| node_scansrepo
node_scanctl -->|"measures speed"| node_iperf
node_scanservice -->|"collects scan"| node_termux
node_scanservice -->|"collects connection"| node_connection
node_scanservice -->|"filters and names"| node_bssidrepo
node_scanservice -->|"normalizes fields"| node_wifiutils
node_termux -.->|"reads device scan"| node_android
node_iperf -.->|"tests throughput"| node_iperfserver
node_surveysservice -->|"reads plans"| node_plansrepo
node_surveysservice -->|"reads and writes"| node_surveysrepo
node_surveysservice -->|"uses locations"| node_scanpointsrepo
node_surveysservice -->|"reads scans"| node_scansrepo
node_scansrepo -->|"queries"| node_db
node_scanpointsrepo -->|"queries"| node_db
node_bssidrepo -->|"queries"| node_db
node_plansrepo -->|"queries"| node_db

click node_app "https://github.com/aldoesp/heatmap/blob/main/frontend/src/App.tsx"
click node_planui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/upload/UploadPage.tsx"
click node_scanui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/scan/ScanPage.tsx"
click node_surveyui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/surveys/SurveysLibraryPage.tsx"
click node_surveywork "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/surveys/SurveysPage.tsx"
click node_heatui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/heatmap/HeatmapPage.tsx"
click node_analysisui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/analyse/AnalysePage.tsx"
click node_settingsui "https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/settings/SettingsPage.tsx"
click node_planstore "https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/usePlanStore.ts"
click node_scanstore "https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/useScanStore.ts"
click node_surveyhook "https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/useSurveysLibrary.ts"
click node_webapi "https://github.com/aldoesp/heatmap/blob/main/frontend/src/lib/api.ts"
click node_api "https://github.com/aldoesp/heatmap/blob/main/backend/src/api/index.js"
click node_plansctl "https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/plans.controller.js"
click node_surveysctl "https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/surveys.controller.js"
click node_scanctl "https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/scan.controller.js"
click node_analysisctl "https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/analysis.controller.js"
click node_settingsctl "https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/settings.controller.js"
click node_scanservice "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/scan.services.js"
click node_termux "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/termuxscaninfo.service.js"
click node_connection "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/connection.service.js"
click node_iperf "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/iperf.service.js"
click node_wifiutils "https://github.com/aldoesp/heatmap/blob/main/backend/src/utils/wifi.utils.js"
click node_plansservice "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/plans.service.js"
click node_surveysservice "https://github.com/aldoesp/heatmap/blob/main/backend/src/services/surveys.service.js"
click node_scansrepo "https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/scans.repository.js"
click node_scanpointsrepo "https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/scanPoints.repository.js"
click node_bssidrepo "https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/bssidRules.repository.js"
click node_plansrepo "https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/plans.repository.js"
click node_surveysrepo "https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/surveys.repository.js"
click node_db "https://github.com/aldoesp/heatmap/blob/main/backend/src/database/db.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_webapi toneBlue
class node_planui,node_surveyui,node_surveywork,node_planstore,node_surveyhook,node_plansctl,node_surveysctl,node_plansservice,node_surveysservice toneAmber
class node_scanui,node_scanstore,node_scanctl,node_scanservice,node_termux,node_connection,node_iperf,node_wifiutils,node_iperfserver toneMint
class node_heatui,node_analysisui,node_settingsui,node_analysisctl,node_settingsctl toneRose
class node_api,node_scansrepo,node_scanpointsrepo,node_bssidrepo,node_plansrepo,node_surveysrepo,node_db,node_user,node_android toneIndigo
```

## Components

### Frontend experience

- [App and routing](https://github.com/aldoesp/heatmap/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/aldoesp/heatmap/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Plans and surveys

- [Plan upload](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/upload/UploadPage.tsx): `frontend/src/components/upload/UploadPage.tsx`
- [Survey library](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/surveys/SurveysLibraryPage.tsx): `frontend/src/components/surveys/SurveysLibraryPage.tsx`
- [Survey capture](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/surveys/SurveysPage.tsx): `frontend/src/components/surveys/SurveysPage.tsx`
- [Plan state](https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/usePlanStore.ts): `frontend/src/hooks/usePlanStore.ts`
- [Survey data](https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/useSurveysLibrary.ts): `frontend/src/hooks/useSurveysLibrary.ts`
- [Plan operations](https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/plans.controller.js): `backend/src/controllers/plans.controller.js`
- [Survey operations](https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/surveys.controller.js): `backend/src/controllers/surveys.controller.js`
- [Plan file service](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/plans.service.js): `backend/src/services/plans.service.js`
- [Survey service](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/surveys.service.js): `backend/src/services/surveys.service.js`

### Wi-Fi collection

- [Scan workspace](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/scan/ScanPage.tsx): `frontend/src/components/scan/ScanPage.tsx`
- [Scan state](https://github.com/aldoesp/heatmap/blob/main/frontend/src/hooks/useScanStore.ts): `frontend/src/hooks/useScanStore.ts`
- [Scan operations](https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/scan.controller.js): `backend/src/controllers/scan.controller.js`
- [Scan normalization](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/scan.services.js): `backend/src/services/scan.services.js`
- [Device scan source](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/termuxscaninfo.service.js): `backend/src/services/termuxscaninfo.service.js`
- [Connection details](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/connection.service.js): `backend/src/services/connection.service.js`
- [Speed measurement](https://github.com/aldoesp/heatmap/blob/main/backend/src/services/iperf.service.js): `backend/src/services/iperf.service.js`
- [Wi-Fi interpretation](https://github.com/aldoesp/heatmap/blob/main/backend/src/utils/wifi.utils.js): `backend/src/utils/wifi.utils.js`

### Analysis and settings

- [Heatmap view](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/heatmap/HeatmapPage.tsx): `frontend/src/components/heatmap/HeatmapPage.tsx`
- [Analysis view](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/analyse/AnalysePage.tsx): `frontend/src/components/analyse/AnalysePage.tsx`
- [Settings view](https://github.com/aldoesp/heatmap/blob/main/frontend/src/components/settings/SettingsPage.tsx): `frontend/src/components/settings/SettingsPage.tsx`
- [Analysis operations](https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/analysis.controller.js): `backend/src/controllers/analysis.controller.js`
- [Settings operations](https://github.com/aldoesp/heatmap/blob/main/backend/src/controllers/settings.controller.js): `backend/src/controllers/settings.controller.js`

### API and persistence

- [API routing](https://github.com/aldoesp/heatmap/blob/main/backend/src/api/index.js): `backend/src/api/index.js`
- [Scan history](https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/scans.repository.js): `backend/src/repositories/scans.repository.js`
- [Scan locations](https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/scanPoints.repository.js): `backend/src/repositories/scanPoints.repository.js`
- [BSSID rules](https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/bssidRules.repository.js): `backend/src/repositories/bssidRules.repository.js`
- [Plan records](https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/plans.repository.js): `backend/src/repositories/plans.repository.js`
- [Survey records](https://github.com/aldoesp/heatmap/blob/main/backend/src/repositories/surveys.repository.js): `backend/src/repositories/surveys.repository.js`
- [SQLite database](https://github.com/aldoesp/heatmap/blob/main/backend/src/database/db.js): `backend/src/database/db.js`

### Other components

- **Operator**
- **Android scan provider**
- **iperf3 server**

## Connections

- Operator → App and routing: uses
- App and routing → Plan upload: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Scan workspace: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Survey library: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Survey capture: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Heatmap view: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Analysis view: routes to (evidence: `frontend/src/App.tsx`)
- App and routing → Settings view: routes to (evidence: `frontend/src/App.tsx`)
- Plan upload → Plan state: manages
- Scan workspace → Scan state: manages
- Survey library → Survey data: loads
- Survey capture → Survey data: loads
- Plan state → API client: calls (evidence: `frontend/src/hooks/usePlanStore.ts`)
- Scan state → API client: calls (evidence: `frontend/src/hooks/useScanStore.ts`)
- Survey data → API client: calls (evidence: `frontend/src/hooks/useSurveysLibrary.ts`)
- Heatmap view → API client: requests data (evidence: `frontend/src/components/heatmap/HeatmapPage.tsx`)
- Settings view → API client: requests data (evidence: `frontend/src/components/settings/SettingsPage.tsx`)
- Analysis view → API client: requests data
- API client → API routing: sends HTTP
- API routing → Plan operations: dispatches
- API routing → Scan operations: dispatches
- API routing → Survey operations: dispatches
- API routing → Analysis operations: dispatches
- API routing → Settings operations: dispatches
- Plan operations → Plan file service: validates files (evidence: `backend/src/controllers/plans.controller.js`)
- Plan operations → Plan records: reads and writes (evidence: `backend/src/controllers/plans.controller.js`)
- Plan operations → Scan locations: deletes points (evidence: `backend/src/controllers/plans.controller.js`)
- Survey operations → Survey service: delegates (evidence: `backend/src/controllers/surveys.controller.js`)
- Scan operations → Scan normalization: normalizes scan (evidence: `backend/src/controllers/scan.controller.js`)
- Scan operations → Scan locations: finds location (evidence: `backend/src/controllers/scan.controller.js`)
- Scan operations → Scan history: saves and reads (evidence: `backend/src/controllers/scan.controller.js`)
- Scan operations → Speed measurement: measures speed (evidence: `backend/src/controllers/scan.controller.js`)
- Scan normalization → Device scan source: collects scan (evidence: `backend/src/services/scan.services.js`)
- Scan normalization → Connection details: collects connection (evidence: `backend/src/services/scan.services.js`)
- Scan normalization → BSSID rules: filters and names (evidence: `backend/src/services/scan.services.js`)
- Scan normalization → Wi-Fi interpretation: normalizes fields (evidence: `backend/src/services/scan.services.js`)
- Device scan source → Android scan provider: reads device scan
- Speed measurement → iperf3 server: tests throughput
- Survey service → Plan records: reads plans (evidence: `backend/src/services/surveys.service.js`)
- Survey service → Survey records: reads and writes (evidence: `backend/src/services/surveys.service.js`)
- Survey service → Scan locations: uses locations (evidence: `backend/src/services/surveys.service.js`)
- Survey service → Scan history: reads scans (evidence: `backend/src/services/surveys.service.js`)
- Scan history → SQLite database: queries (evidence: `backend/src/repositories/scans.repository.js`)
- Scan locations → SQLite database: queries (evidence: `backend/src/repositories/scanPoints.repository.js`)
- BSSID rules → SQLite database: queries (evidence: `backend/src/repositories/bssidRules.repository.js`)
- Plan records → SQLite database: queries (evidence: `backend/src/repositories/plans.repository.js`)
