# defiaudit0x/wildfire-observatory architecture

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

- Interactive diagram: https://gitdiagram.com/defiaudit0x/wildfire-observatory
- Repository: https://github.com/defiaudit0x/wildfire-observatory

## Overview

This repository is a community-driven wildfire and disaster early-warning platform, with a React web client, Express API, and a native Android application. The main workflow is citizens viewing reports and satellite hotspots, submitting geolocated reports or SOS alerts, then operators reviewing reports and coordinating teams. The graph preserves documented AI, satellite, consensus, mapping, risk, history/export, proximity, and mesh capabilities. Edge evidence is limited to README statements and shown source/index references; unsampled implementation links are omitted or marked unverified.

Main entry points: [`server/routes/reports.ts`](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/reports.ts) (Report and SOS API), [`src/hooks/observatory/useObservatoryPoll.ts`](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/hooks/observatory/useObservatoryPoll.ts) (Data Polling), [`server/server.ts`](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/server.ts) (HTTP Server), [`server/routes/satellite.ts`](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/satellite.ts) (Satellite Feed)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_citizen["Citizen Web"]
  node_app["Web App<br/>[App.tsx]"]
  node_map["Live Map<br/>[InteractiveMap.tsx]"]
  node_report["Report Form<br/>[ReportForm.tsx]"]
  node_sos["SOS Alerts"]
  node_datahooks["Data Polling"]
  node_submission["Report Submission"]
  node_threats["Threat Proximity<br/>[threats.ts]"]
end

subgraph group_backend["API and Data"]
  node_firedata["Report and SOS API<br/>[reports.ts]"]
  node_satellite["Satellite Feed<br/>[satellite.ts]"]
  node_ai["AI Verification<br/>[ai.ts]"]
  node_risk["Fire Risk<br/>[wilayas.ts]"]
  node_store[("Persistence<br/>[fs.ts]")]
  node_server["HTTP Server<br/>[server.ts]"]
end

subgraph group_operations["Response Operations"]
  node_admin["Admin Moderation<br/>[AdminPanel.tsx]"]
  node_staff["Staff Management<br/>[StaffManager.tsx]"]
  node_command["Command Center<br/>[CentralCommand.tsx]"]
  node_teams["Teams and Roster<br/>[teams.ts]"]
  node_history["History and Export<br/>[history.ts]"]
end

subgraph group_mobile["Android Mesh"]
  node_android["Android Client"]
  node_mesh["Peer Mesh<br/>[MeshService.kt]"]
  node_crypto["Mesh Cryptography<br/>[CryptoEngine.kt]"]
end

node_public(("Citizen"))

node_public -->|"uses"| node_app
node_app -->|"polls data"| node_datahooks
node_app -->|"finds threats"| node_threats
node_datahooks -->|"fetches reports"| node_firedata
node_datahooks -->|"fetches hotspots"| node_satellite
node_datahooks -->|"fetches regions"| node_risk
node_report -.->|"submits reports"| node_submission
node_submission -->|"posts reports"| node_firedata
node_sos -.->|"sends SOS"| node_firedata
node_server -->|"routes requests"| node_firedata
node_server -->|"routes requests"| node_satellite
node_server -->|"routes requests"| node_ai
node_firedata -.->|"persists data"| node_store
node_satellite -.->|"reads data"| node_store
node_ai -.->|"verifies images"| node_public
node_map -.->|"shows hotspots"| node_satellite
node_map -.->|"shows reports"| node_firedata
node_threats -.->|"alerts nearby"| node_public
node_admin -.->|"moderates reports"| node_firedata
node_staff -->|"requests units"| node_server
node_command -.->|"coordinates response"| node_teams
node_firedata -.->|"provides records"| node_history
node_public -.->|"uses"| node_android
node_android -.->|"broadcasts offline"| node_mesh
node_mesh -->|"uses keys"| node_crypto

click node_app "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/App.tsx"
click node_map "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/InteractiveMap.tsx"
click node_report "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/ReportForm.tsx"
click node_sos "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/TrappedSOSModal.tsx"
click node_datahooks "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/hooks/observatory/useObservatoryPoll.ts"
click node_submission "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/hooks/observatory/useReportSubmission.ts"
click node_threats "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/utils/threats.ts"
click node_firedata "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/reports.ts"
click node_satellite "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/satellite.ts"
click node_ai "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/ai.ts"
click node_risk "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/wilayas.ts"
click node_store "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/fs.ts"
click node_server "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/server.ts"
click node_admin "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/AdminPanel.tsx"
click node_staff "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/admin/StaffManager.tsx"
click node_command "https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/CentralCommand.tsx"
click node_teams "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/teams.ts"
click node_history "https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/history.ts"
click node_android "https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/NativeMainActivity.kt"
click node_mesh "https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/MeshService.kt"
click node_crypto "https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/CryptoEngine.kt"

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_map,node_report,node_sos,node_datahooks,node_submission,node_threats toneBlue
class node_firedata,node_satellite,node_ai,node_risk,node_store,node_server toneAmber
class node_admin,node_staff,node_command,node_teams,node_history toneMint
class node_android,node_mesh,node_crypto toneRose
class node_public toneIndigo
```

## Components

### Citizen Web

- [Web App](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/App.tsx): `src/App.tsx`
- [Live Map](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/InteractiveMap.tsx): `src/components/InteractiveMap.tsx`
- [Report Form](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/ReportForm.tsx): `src/components/ReportForm.tsx`
- [SOS Alerts](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/TrappedSOSModal.tsx): `src/components/TrappedSOSModal.tsx`
- [Data Polling](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/hooks/observatory/useObservatoryPoll.ts): `src/hooks/observatory/useObservatoryPoll.ts`
- [Report Submission](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/hooks/observatory/useReportSubmission.ts): `src/hooks/observatory/useReportSubmission.ts`
- [Threat Proximity](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/utils/threats.ts): `src/utils/threats.ts`

### API and Data

- [Report and SOS API](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/reports.ts): `server/routes/reports.ts`
- [Satellite Feed](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/satellite.ts): `server/routes/satellite.ts`
- [AI Verification](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/ai.ts): `server/routes/ai.ts`
- [Fire Risk](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/wilayas.ts): `server/routes/wilayas.ts`
- [Persistence](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/fs.ts): `server/fs.ts`
- [HTTP Server](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/server.ts): `server/server.ts`

### Response Operations

- [Admin Moderation](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/AdminPanel.tsx): `src/components/AdminPanel.tsx`
- [Staff Management](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/admin/StaffManager.tsx): `src/components/admin/StaffManager.tsx`
- [Command Center](https://github.com/defiaudit0x/wildfire-observatory/blob/main/src/components/CentralCommand.tsx): `src/components/CentralCommand.tsx`
- [Teams and Roster](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/teams.ts): `server/routes/teams.ts`
- [History and Export](https://github.com/defiaudit0x/wildfire-observatory/blob/main/server/routes/history.ts): `server/routes/history.ts`

### Android Mesh

- [Android Client](https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/NativeMainActivity.kt): `android/app/src/main/java/com/observatory/wildfire/NativeMainActivity.kt`
- [Peer Mesh](https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/MeshService.kt): `android/app/src/main/java/com/observatory/wildfire/MeshService.kt`
- [Mesh Cryptography](https://github.com/defiaudit0x/wildfire-observatory/blob/main/android/app/src/main/java/com/observatory/wildfire/CryptoEngine.kt): `android/app/src/main/java/com/observatory/wildfire/CryptoEngine.kt`

### Other components

- **Citizen**

## Connections

- Citizen → Web App: uses (evidence: `README.md`)
- Web App → Data Polling: polls data (evidence: `src/App.tsx`)
- Web App → Threat Proximity: finds threats (evidence: `src/App.tsx`)
- Data Polling → Report and SOS API: fetches reports (evidence: `src/hooks/observatory/useObservatoryPoll.ts`)
- Data Polling → Satellite Feed: fetches hotspots (evidence: `src/hooks/observatory/useObservatoryPoll.ts`)
- Data Polling → Fire Risk: fetches regions (evidence: `src/hooks/observatory/useObservatoryPoll.ts`)
- Report Form → Report Submission: submits reports
- Report Submission → Report and SOS API: posts reports (evidence: `src/hooks/observatory/useReportSubmission.ts`)
- SOS Alerts → Report and SOS API: sends SOS
- HTTP Server → Report and SOS API: routes requests (evidence: `server/server.ts`)
- HTTP Server → Satellite Feed: routes requests (evidence: `server/server.ts`)
- HTTP Server → AI Verification: routes requests (evidence: `server/server.ts`)
- Report and SOS API → Persistence: persists data
- Satellite Feed → Persistence: reads data
- AI Verification → Citizen: verifies images (evidence: `README.md`)
- Live Map → Satellite Feed: shows hotspots (evidence: `README.md`)
- Live Map → Report and SOS API: shows reports (evidence: `README.md`)
- Threat Proximity → Citizen: alerts nearby (evidence: `README.md`)
- Admin Moderation → Report and SOS API: moderates reports (evidence: `README.md`)
- Staff Management → HTTP Server: requests units (evidence: `src/components/admin/StaffManager.tsx`)
- Command Center → Teams and Roster: coordinates response (evidence: `README.md`)
- Report and SOS API → History and Export: provides records (evidence: `README.md`)
- Citizen → Android Client: uses
- Android Client → Peer Mesh: broadcasts offline
- Peer Mesh → Mesh Cryptography: uses keys (evidence: `android/app/src/main/java/com/observatory/wildfire/MeshService.kt`)
