# kchayta32/d-mind-web architecture

> Architecture diagram of the GitHub repository kchayta32/d-mind-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kchayta32/d-mind-web
- Repository: https://github.com/kchayta32/d-mind-web
- Video tour (about a minute): https://gitdiagram.com/kchayta32/d-mind-web/video

## Overview

D-MIND is a Thai disaster-information and response platform: people consult alerts, maps, forecasts, and guidance, then use reporting and assessment tools to request or contribute response information. Its main portal combines countrywide hazard mapping with dedicated Bangkok flood and cafe maps, AI assistance, news, and emergency resources. The tree also contains a separate SeismoGuard earthquake-warning app and a scraper-backed news service. The README describes capabilities beyond the sampled source, so those branches are shown at subsystem level; arrows are limited to documented routes and sampled integrations.

Main entry points: [`src/App.tsx`](https://github.com/kchayta32/d-mind-web/blob/main/src/App.tsx) (Portal router), [`ai-earthquake-guard/src/App.tsx`](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/App.tsx) (SeismoGuard app), [`src/pages/BangkokFloodMapPage.tsx`](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokFloodMapPage.tsx) (Bangkok flood map), [`src/pages/BangkokCafeFloodMapPage.tsx`](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokCafeFloodMapPage.tsx) (Cafe flood radar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["D-MIND portal"]
  node_portal_app["Portal router<br/>[App.tsx]"]
  node_home["Home dashboard<br/>[Index.tsx]"]
  node_alerts["Disaster alerts<br/>[Alerts.tsx]"]
end

subgraph group_hazards["Hazard maps"]
  node_map_page["Integrated map<br/>[DisasterMap.tsx]"]
  node_map_runtime["Map data and layers"]
  node_bangkok_flood["Bangkok flood map"]
  node_bangkok_flood_service["Flood telemetry and reports"]
  node_cafe_map["Cafe flood radar"]
  node_cafe_service["Cafe and concierge data"]
  node_hazard_sources{{"Hazard data providers"}}
end

subgraph group_response["Response tools"]
  node_damage["Damage assessment"]
  node_damage_function["Image analysis function<br/>[index.ts]"]
  node_reports["Incident and victim reports"]
  node_supabase[("Supabase services<br/>[client.ts]")]
  node_emergency_resources["Emergency manual and contacts"]
end

subgraph group_intelligence["AI and news"]
  node_assistant["AI assistant<br/>[AIAssistant.tsx]"]
  node_chat_function["AI chat function<br/>[index.ts]"]
  node_news["Disaster news<br/>[DisasterNews.tsx]"]
  node_scraper_api["Scraper API<br/>[app.py]"]
  node_scrapers["Source scrapers<br/>[runner.py]"]
  node_news_store[("News data store<br/>[supabase_client.py]")]
end

subgraph group_seismo["SeismoGuard"]
  node_seismo_app["SeismoGuard app<br/>[App.tsx]"]
  node_seismic_feed["Live seismic feed<br/>[liveSeismicFeed.ts]"]
  node_wave_engine["Wave prediction engine"]
  node_magnitude["Magnitude prediction"]
  node_seismo_ui["Map and warning display<br/>[SeismicMap.tsx]"]
end

node_public(("Public users"))

node_public -->|"opens"| node_portal_app
node_portal_app -->|"routes to"| node_home
node_portal_app -->|"routes to"| node_alerts
node_portal_app -->|"routes to"| node_map_page
node_portal_app -->|"routes to"| node_bangkok_flood
node_portal_app -->|"routes to"| node_cafe_map
node_portal_app -->|"routes to"| node_assistant
node_portal_app -->|"routes to"| node_damage
node_portal_app -->|"routes to"| node_reports
node_portal_app -->|"routes to"| node_news
node_portal_app -->|"routes to"| node_emergency_resources
node_map_page -->|"renders"| node_map_runtime
node_map_runtime -->|"loads map data"| node_hazard_sources
node_bangkok_flood -->|"uses"| node_bangkok_flood_service
node_bangkok_flood -->|"shows flood layers"| node_hazard_sources
node_cafe_map -->|"uses"| node_cafe_service
node_cafe_map -->|"overlays flood data"| node_bangkok_flood_service
node_assistant -->|"sends prompts"| node_chat_function
node_damage -->|"submits images"| node_damage_function
node_reports -->|"stores reports"| node_supabase
node_chat_function -->|"uses backend"| node_supabase
node_damage_function -->|"uses backend"| node_supabase
node_scraper_api -->|"runs scrapes"| node_scrapers
node_scrapers -->|"syncs results"| node_news_store
node_news -.->|"fetches news"| node_scraper_api
node_public -->|"opens"| node_seismo_app
node_seismo_app -->|"loads events"| node_seismic_feed
node_seismo_app -->|"calculates warning"| node_wave_engine
node_wave_engine -->|"calculates intensity"| node_magnitude
node_seismo_app -->|"displays events"| node_seismo_ui

click node_portal_app "https://github.com/kchayta32/d-mind-web/blob/main/src/App.tsx"
click node_home "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/Index.tsx"
click node_alerts "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/Alerts.tsx"
click node_map_page "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DisasterMap.tsx"
click node_map_runtime "https://github.com/kchayta32/d-mind-web/tree/main/src/components/disaster-map"
click node_bangkok_flood "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokFloodMapPage.tsx"
click node_bangkok_flood_service "https://github.com/kchayta32/d-mind-web/blob/main/src/services/bangkokFloodService.ts"
click node_cafe_map "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokCafeFloodMapPage.tsx"
click node_cafe_service "https://github.com/kchayta32/d-mind-web/blob/main/src/services/typhoonCafeService.ts"
click node_assistant "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/AIAssistant.tsx"
click node_chat_function "https://github.com/kchayta32/d-mind-web/blob/main/supabase/functions/ai-chat/index.ts"
click node_damage "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DamageAssessment.tsx"
click node_damage_function "https://github.com/kchayta32/d-mind-web/blob/main/supabase/functions/analyze-damage/index.ts"
click node_reports "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/IncidentReports.tsx"
click node_supabase "https://github.com/kchayta32/d-mind-web/blob/main/src/integrations/supabase/client.ts"
click node_news "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DisasterNews.tsx"
click node_scraper_api "https://github.com/kchayta32/d-mind-web/blob/main/scraper/app.py"
click node_scrapers "https://github.com/kchayta32/d-mind-web/blob/main/scraper/scrapers/runner.py"
click node_news_store "https://github.com/kchayta32/d-mind-web/blob/main/scraper/supabase_client.py"
click node_seismo_app "https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/App.tsx"
click node_seismic_feed "https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/liveSeismicFeed.ts"
click node_wave_engine "https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/wavePhysicsEngine.ts"
click node_magnitude "https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/aiMagnitudePredictor.ts"
click node_seismo_ui "https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/components/Map/SeismicMap.tsx"
click node_emergency_resources "https://github.com/kchayta32/d-mind-web/blob/main/src/pages/EmergencyManual.tsx"

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_portal_app,node_home,node_alerts,node_public toneBlue
class node_map_page,node_map_runtime,node_bangkok_flood,node_bangkok_flood_service,node_cafe_map,node_cafe_service,node_hazard_sources toneAmber
class node_damage,node_damage_function,node_reports,node_supabase,node_emergency_resources toneMint
class node_assistant,node_chat_function,node_news,node_scraper_api,node_scrapers,node_news_store toneRose
class node_seismo_app,node_seismic_feed,node_wave_engine,node_magnitude,node_seismo_ui toneIndigo
```

## Components

### D-MIND portal

- [Portal router](https://github.com/kchayta32/d-mind-web/blob/main/src/App.tsx): `src/App.tsx`
- [Home dashboard](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Disaster alerts](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/Alerts.tsx): `src/pages/Alerts.tsx`

### Hazard maps

- [Integrated map](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DisasterMap.tsx): `src/pages/DisasterMap.tsx`
- [Map data and layers](https://github.com/kchayta32/d-mind-web/tree/main/src/components/disaster-map): `src/components/disaster-map`
- [Bangkok flood map](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokFloodMapPage.tsx): `src/pages/BangkokFloodMapPage.tsx`
- [Flood telemetry and reports](https://github.com/kchayta32/d-mind-web/blob/main/src/services/bangkokFloodService.ts): `src/services/bangkokFloodService.ts`
- [Cafe flood radar](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/BangkokCafeFloodMapPage.tsx): `src/pages/BangkokCafeFloodMapPage.tsx`
- [Cafe and concierge data](https://github.com/kchayta32/d-mind-web/blob/main/src/services/typhoonCafeService.ts): `src/services/typhoonCafeService.ts`
- **Hazard data providers**

### Response tools

- [Damage assessment](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DamageAssessment.tsx): `src/pages/DamageAssessment.tsx`
- [Image analysis function](https://github.com/kchayta32/d-mind-web/blob/main/supabase/functions/analyze-damage/index.ts): `supabase/functions/analyze-damage/index.ts`
- [Incident and victim reports](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/IncidentReports.tsx): `src/pages/IncidentReports.tsx`
- [Supabase services](https://github.com/kchayta32/d-mind-web/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Emergency manual and contacts](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/EmergencyManual.tsx): `src/pages/EmergencyManual.tsx`

### AI and news

- [AI assistant](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/AIAssistant.tsx): `src/pages/AIAssistant.tsx`
- [AI chat function](https://github.com/kchayta32/d-mind-web/blob/main/supabase/functions/ai-chat/index.ts): `supabase/functions/ai-chat/index.ts`
- [Disaster news](https://github.com/kchayta32/d-mind-web/blob/main/src/pages/DisasterNews.tsx): `src/pages/DisasterNews.tsx`
- [Scraper API](https://github.com/kchayta32/d-mind-web/blob/main/scraper/app.py): `scraper/app.py`
- [Source scrapers](https://github.com/kchayta32/d-mind-web/blob/main/scraper/scrapers/runner.py): `scraper/scrapers/runner.py`
- [News data store](https://github.com/kchayta32/d-mind-web/blob/main/scraper/supabase_client.py): `scraper/supabase_client.py`

### SeismoGuard

- [SeismoGuard app](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/App.tsx): `ai-earthquake-guard/src/App.tsx`
- [Live seismic feed](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/liveSeismicFeed.ts): `ai-earthquake-guard/src/services/liveSeismicFeed.ts`
- [Wave prediction engine](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/wavePhysicsEngine.ts): `ai-earthquake-guard/src/services/wavePhysicsEngine.ts`
- [Magnitude prediction](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/services/aiMagnitudePredictor.ts): `ai-earthquake-guard/src/services/aiMagnitudePredictor.ts`
- [Map and warning display](https://github.com/kchayta32/d-mind-web/blob/main/ai-earthquake-guard/src/components/Map/SeismicMap.tsx): `ai-earthquake-guard/src/components/Map/SeismicMap.tsx`

### Other components

- **Public users**

## Connections

- Public users → Portal router: opens
- Portal router → Home dashboard: routes to
- Portal router → Disaster alerts: routes to
- Portal router → Integrated map: routes to
- Portal router → Bangkok flood map: routes to
- Portal router → Cafe flood radar: routes to
- Portal router → AI assistant: routes to
- Portal router → Damage assessment: routes to
- Portal router → Incident and victim reports: routes to
- Portal router → Disaster news: routes to
- Portal router → Emergency manual and contacts: routes to
- Integrated map → Map data and layers: renders
- Map data and layers → Hazard data providers: loads map data
- Bangkok flood map → Flood telemetry and reports: uses
- Bangkok flood map → Hazard data providers: shows flood layers
- Cafe flood radar → Cafe and concierge data: uses
- Cafe flood radar → Flood telemetry and reports: overlays flood data
- AI assistant → AI chat function: sends prompts
- Damage assessment → Image analysis function: submits images
- Incident and victim reports → Supabase services: stores reports
- AI chat function → Supabase services: uses backend
- Image analysis function → Supabase services: uses backend
- Scraper API → Source scrapers: runs scrapes
- Source scrapers → News data store: syncs results
- Disaster news → Scraper API: fetches news
- Public users → SeismoGuard app: opens
- SeismoGuard app → Live seismic feed: loads events
- SeismoGuard app → Wave prediction engine: calculates warning
- Wave prediction engine → Magnitude prediction: calculates intensity
- SeismoGuard app → Map and warning display: displays events
