# hissyam90/webgis-kaltim architecture

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

- Interactive diagram: https://gitdiagram.com/hissyam90/webgis-kaltim
- Repository: https://github.com/hissyam90/webgis-kaltim

## Overview

This is a React/FastAPI WebGIS for exploring power plants and energy potential across Kalimantan, with district-level analysis for East Kalimantan. The main workflow is selecting a map mode and filters, loading facility data and regional boundaries, deriving filtered or area-level results, and presenting them on the map and in the sidebar; users can inspect details, view statistics, and export results. The README documents the wider capabilities. Backend source excerpts were not provided, so backend links rely on README statements; unsampled frontend wiring is omitted where its caller is not evidenced.

Main entry points: [`frontend/src/App.jsx`](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/App.jsx) (App Workflow), [`frontend/src/components/map/MapControls.jsx`](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapControls.jsx) (Map Controls), [`frontend/src/components/map/MapView.jsx`](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapView.jsx) (Interactive Map), [`frontend/src/components/ui/Sidebar.jsx`](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/ui/Sidebar.jsx) (Search and Filters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_explore["Map Exploration"]
  node_app["App Workflow<br/>[App.jsx]"]
  node_map["Interactive Map<br/>[MapView.jsx]"]
  node_mapcontrols["Map Controls<br/>[MapControls.jsx]"]
  node_layercontrol["Layer Control<br/>[LayerControl.jsx]"]
  node_legend["Dynamic Legend<br/>[Legend.jsx]"]
  node_flyto["Map Navigation<br/>[FlyToLocation.jsx]"]
  node_sidebar["Search and Filters<br/>[Sidebar.jsx]"]
  node_yearfilter["Year Filter"]
end

subgraph group_analysis["Regional Analysis"]
  node_boundaries["District Boundaries"]
  node_metriccontrol["Metric Selection"]
  node_analysislogic["Area Metrics<br/>[analysisHelpers.js]"]
end

subgraph group_data["Data Services"]
  node_facilityhook["Facility Fetch<br/>[usePembangkit.js]"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_postgres[("PostgreSQL")]
  node_ingest["Dataset Import<br/>[import_data.py]"]
  node_processing["Dataset Processing"]
end

subgraph group_details["Details and Export"]
  node_detail["Facility Details<br/>[DetailModal.jsx]"]
  node_weatherhook["Weather Fetch<br/>[useWeather.js]"]
  node_weather["Open-Meteo"]
  node_stats["Statistics Modal<br/>[StatsModal.jsx]"]
  node_csv["CSV Export<br/>[exportCsv.js]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"loads facilities"| node_facilityhook
node_facilityhook -->|"requests data"| node_api
node_api -->|"reads records"| node_postgres
node_app -->|"renders map"| node_map
node_app -->|"renders controls"| node_mapcontrols
node_mapcontrols -->|"renders layer control"| node_layercontrol
node_mapcontrols -->|"renders metric control"| node_metriccontrol
node_app -->|"renders sidebar"| node_sidebar
node_sidebar -->|"renders year filter"| node_yearfilter
node_app -->|"loads boundaries"| node_boundaries
node_boundaries -->|"fetches GeoJSON"| node_user
node_app -->|"builds analysis"| node_analysislogic
node_analysislogic -->|"styles area metrics"| node_map
node_map -->|"uses navigation"| node_flyto
node_app -->|"renders legend"| node_legend
node_app -->|"renders details"| node_detail
node_app -->|"renders statistics"| node_stats
node_app -->|"exports results"| node_csv
node_detail -.->|"shows weather"| node_weatherhook
node_weatherhook -->|"requests forecast"| node_weather
node_ingest -->|"imports CSV"| node_postgres

click node_app "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/App.jsx"
click node_map "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapView.jsx"
click node_mapcontrols "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapControls.jsx"
click node_layercontrol "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/LayerControl.jsx"
click node_legend "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/Legend.jsx"
click node_flyto "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/FlyToLocation.jsx"
click node_sidebar "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/ui/Sidebar.jsx"
click node_yearfilter "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/ui/YearRangeFilter.jsx"
click node_facilityhook "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/usePembangkit.js"
click node_api "https://github.com/hissyam90/webgis-kaltim/blob/main/backend/main.py"
click node_boundaries "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/useKaltimBoundaries.js"
click node_metriccontrol "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/AnalysisMetricControl.jsx"
click node_analysislogic "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/utils/analysisHelpers.js"
click node_detail "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/modals/DetailModal.jsx"
click node_weatherhook "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/useWeather.js"
click node_stats "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/modals/StatsModal.jsx"
click node_csv "https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/utils/exportCsv.js"
click node_ingest "https://github.com/hissyam90/webgis-kaltim/blob/main/backend/import_data.py"
click node_processing "https://github.com/hissyam90/webgis-kaltim/blob/main/backend/process_datasets.py"

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_mapcontrols,node_layercontrol,node_legend,node_flyto,node_sidebar,node_yearfilter,node_user toneBlue
class node_boundaries,node_metriccontrol,node_analysislogic toneAmber
class node_facilityhook,node_api,node_postgres,node_ingest,node_processing toneMint
class node_detail,node_weatherhook,node_weather,node_stats,node_csv toneRose
```

## Components

### Map Exploration

- [App Workflow](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Interactive Map](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapView.jsx): `frontend/src/components/map/MapView.jsx`
- [Map Controls](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/MapControls.jsx): `frontend/src/components/map/MapControls.jsx`
- [Layer Control](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/LayerControl.jsx): `frontend/src/components/map/LayerControl.jsx`
- [Dynamic Legend](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/Legend.jsx): `frontend/src/components/map/Legend.jsx`
- [Map Navigation](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/FlyToLocation.jsx): `frontend/src/components/map/FlyToLocation.jsx`
- [Search and Filters](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/ui/Sidebar.jsx): `frontend/src/components/ui/Sidebar.jsx`
- [Year Filter](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/ui/YearRangeFilter.jsx): `frontend/src/components/ui/YearRangeFilter.jsx`

### Regional Analysis

- [District Boundaries](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/useKaltimBoundaries.js): `frontend/src/hooks/useKaltimBoundaries.js`
- [Metric Selection](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/map/AnalysisMetricControl.jsx): `frontend/src/components/map/AnalysisMetricControl.jsx`
- [Area Metrics](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/utils/analysisHelpers.js): `frontend/src/utils/analysisHelpers.js`

### Data Services

- [Facility Fetch](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/usePembangkit.js): `frontend/src/hooks/usePembangkit.js`
- [FastAPI Service](https://github.com/hissyam90/webgis-kaltim/blob/main/backend/main.py): `backend/main.py`
- **PostgreSQL**
- [Dataset Import](https://github.com/hissyam90/webgis-kaltim/blob/main/backend/import_data.py): `backend/import_data.py`
- [Dataset Processing](https://github.com/hissyam90/webgis-kaltim/blob/main/backend/process_datasets.py): `backend/process_datasets.py`

### Details and Export

- [Facility Details](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/modals/DetailModal.jsx): `frontend/src/components/modals/DetailModal.jsx`
- [Weather Fetch](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/hooks/useWeather.js): `frontend/src/hooks/useWeather.js`
- **Open-Meteo**
- [Statistics Modal](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/components/modals/StatsModal.jsx): `frontend/src/components/modals/StatsModal.jsx`
- [CSV Export](https://github.com/hissyam90/webgis-kaltim/blob/main/frontend/src/utils/exportCsv.js): `frontend/src/utils/exportCsv.js`

### Other components

- **User**

## Connections

- User → App Workflow: uses
- App Workflow → Facility Fetch: loads facilities (evidence: `frontend/src/App.jsx`)
- Facility Fetch → FastAPI Service: requests data (evidence: `frontend/src/hooks/usePembangkit.js`)
- FastAPI Service → PostgreSQL: reads records (evidence: `README.md`)
- App Workflow → Interactive Map: renders map (evidence: `frontend/src/App.jsx`)
- App Workflow → Map Controls: renders controls (evidence: `frontend/src/App.jsx`)
- Map Controls → Layer Control: renders layer control (evidence: `frontend/src/components/map/MapControls.jsx`)
- Map Controls → Metric Selection: renders metric control (evidence: `frontend/src/components/map/MapControls.jsx`)
- App Workflow → Search and Filters: renders sidebar (evidence: `frontend/src/App.jsx`)
- Search and Filters → Year Filter: renders year filter (evidence: `frontend/src/components/ui/Sidebar.jsx`)
- App Workflow → District Boundaries: loads boundaries (evidence: `frontend/src/App.jsx`)
- District Boundaries → User: fetches GeoJSON (evidence: `frontend/src/hooks/useKaltimBoundaries.js`)
- App Workflow → Area Metrics: builds analysis (evidence: `frontend/src/App.jsx`)
- Area Metrics → Interactive Map: styles area metrics (evidence: `frontend/src/components/map/MapView.jsx`)
- Interactive Map → Map Navigation: uses navigation (evidence: `frontend/src/components/map/MapView.jsx`)
- App Workflow → Dynamic Legend: renders legend (evidence: `frontend/src/App.jsx`)
- App Workflow → Facility Details: renders details (evidence: `frontend/src/App.jsx`)
- App Workflow → Statistics Modal: renders statistics (evidence: `frontend/src/App.jsx`)
- App Workflow → CSV Export: exports results (evidence: `frontend/src/App.jsx`)
- Facility Details → Weather Fetch: shows weather
- Weather Fetch → Open-Meteo: requests forecast (evidence: `frontend/src/hooks/useWeather.js`)
- Dataset Import → PostgreSQL: imports CSV (evidence: `README.md`)
