# ardkyer/seoul-startup-planner architecture

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

- Interactive diagram: https://gitdiagram.com/ardkyer/seoul-startup-planner
- Repository: https://github.com/ardkyer/seoul-startup-planner

## Overview

#### Purpose and Runtime
Seoul Startup Navigator is a client-side React application for exploring Seoul commercial-area indicators and startup-support policies. It boots from `src/index.js`, composes the experience in `src/App.js`, and serves static assets/data from `public/`, notably `public/updated_commercial_areas.json`. The documented deployment target is Vercel.

#### Application Composition
`src/App.js` is the top-level orchestration boundary: it presents the introductory experience, main map, and chatbot. `src/components/Intro/IntroSequence.js` gates or enhances initial entry, while `src/components/Map/Map.js` and `src/components/Chat/ChatWindow.js` provide the two substantive user workflows.

#### Commercial-Area Data Pipeline
Map data is loaded and normalized through `src/data/api/dataFetcher.js` and `src/data/api/dataProcessor.js`, with map-oriented state encapsulated by `src/hooks/useMapData.js`. The primary source is the bundled commercial-area dataset at `public/updated_commercial_areas.json`; development/debug GeoJSON alternatives exist under `src/data/geojson/`. This creates a browser-side boundary between raw public-data-derived records and display-ready geographic features/metrics.

#### Map Visualization System
`src/components/Map/Map.js` hosts Mapbox GL and user interaction with Seoul’s map. Map defaults, token-related settings, view configuration, and metric definitions are centralized in `src/data/constants/mapSettings.js`. Specialized layer modules render distinct geometries and visual encodings:
- district/administrative context: `src/components/Map/layers/DistrictLayer.js`
- commercial-area fills: `src/components/Map/layers/FillLayer.js`
- density/intensity rendering: `src/components/Map/layers/HeatmapLayer.js`

The user selects among population, sales, rent, and closure-rate perspectives; selection drives the active metric and corresponding Mapbox layer styling/popup content.

#### Filtering and Derived Metrics
`src/hooks/useDataFilters.js` owns filtering behavior over map data, separating user-selected constraints from fetching and rendering. Shared metric calculations and presentation formatting reside in `src/utils/calculators.js` and `src/utils/formatters.js`. This is the main transformation boundary for converting raw area attributes into comparable values, labels, and visual weights.

#### Policy Advisor / Chat Flow
The chatbot UI is split into launch control, conversation window, and message rendering at `src/components/Chat/ChatButton.js`, `src/components/Chat/ChatWindow.js`, and `src/components/Chat/ChatMessage.js`. `src/components/Chat/ChatService.js` is the external-service boundary for policy-oriented responses. Curated startup-policy context is bundled in `src/data/constants/startupPolicies.json`; OpenAI GPT-3.5 is the documented optional LLM provider, configured through `REACT_APP_OPENAI_API_KEY`. Since this is a React client app, that integration places API-key handling and model calls at the browser boundary unless deployment adds a proxy not represented in this tree.

#### External Dependencies and Infrastructure
The material runtime is Node.js 18+ for build/development and React 19 in the browser. Map rendering depends on Mapbox GL and `REACT_APP_MAPBOX_ACCESS_TOKEN`. Axios is the documented HTTP client. Data originates from Seoul public-data sources and Korean real-estate statistics but is consumed here primarily as prepared static JSON. `updateClosureRateData.js` is a root-level data-maintenance script for updating closure-rate content outside the interactive runtime.

Main entry points: [`src/components/Map/Map.js`](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/Map.js) (Interactive map), [`src/App.js`](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/App.js) (App orchestration), [`src/components/Chat/ChatWindow.js`](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatWindow.js) (Chat window), [`src/hooks/useDataFilters.js`](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/hooks/useDataFilters.js) (Data filters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_entry["Application entry<br/>React bootstrap<br/>[index.js]"]
  node_app["App orchestration<br/>React root<br/>[App.js]"]
  node_intro["Intro sequence<br/>entry UI<br/>[IntroSequence.js]"]
end

subgraph group_data["Commercial data pipeline"]
  node_dataset[("Commercial-area dataset<br/>static JSON")]
  node_fetcher["Data fetcher<br/>data access<br/>[dataFetcher.js]"]
  node_processor["Data processor<br/>normalizer<br/>[dataProcessor.js]"]
  node_mapdata["Map data state<br/>React hook<br/>[useMapData.js]"]
  node_filters["Data filters<br/>React hook<br/>[useDataFilters.js]"]
  node_calculators["Metric calculations<br/>[calculators.js]"]
  node_formatters["Metric formatting<br/>[formatters.js]"]
end

subgraph group_map["Map visualization"]
  node_mapsettings["Map settings<br/>constants<br/>[mapSettings.js]"]
  node_map["Interactive map<br/>Mapbox host<br/>[Map.js]"]
  node_district["District context<br/>Mapbox layer<br/>[DistrictLayer.js]"]
  node_fills["Commercial-area fills<br/>Mapbox layer<br/>[FillLayer.js]"]
  node_heatmap["Density heatmap<br/>Mapbox layer<br/>[HeatmapLayer.js]"]
end

subgraph group_advisor["Policy advisor"]
  node_chatwindow["Chat window<br/>conversation UI<br/>[ChatWindow.js]"]
  node_chatbutton["Chat launcher<br/>chat UI<br/>[ChatButton.js]"]
  node_chatmessage["Message renderer<br/>chat UI<br/>[ChatMessage.js]"]
  node_chatservice{{"Policy chat service<br/>external-service boundary<br/>[ChatService.js]"}}
  node_policies[("Startup policy context<br/>curated JSON")]
end

node_openai{{"OpenAI GPT-3.5<br/>optional LLM"}}
node_maintenance["Closure-rate updater<br/>maintenance script"]

node_entry -->|"boots"| node_app
node_app -->|"presents"| node_intro
node_app -->|"hosts"| node_map
node_app -->|"hosts"| node_chatwindow
node_dataset -->|"loads"| node_fetcher
node_fetcher -->|"raw records"| node_processor
node_processor -->|"normalized features"| node_mapdata
node_mapdata -->|"map data"| node_filters
node_calculators -->|"derived metrics"| node_filters
node_formatters -->|"labels and popups"| node_map
node_filters -->|"filtered features"| node_map
node_mapsettings -->|"view and metric config"| node_map
node_map -->|"renders"| node_district
node_map -->|"renders"| node_fills
node_map -->|"renders"| node_heatmap
node_chatbutton -->|"opens"| node_chatwindow
node_chatwindow -->|"renders"| node_chatmessage
node_chatwindow -->|"sends prompts"| node_chatservice
node_policies -->|"policy context"| node_chatservice
node_chatservice -->|"optional model call"| node_openai
node_maintenance -.->|"updates closure-rate data"| node_dataset

click node_entry "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/index.js"
click node_app "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/App.js"
click node_intro "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Intro/IntroSequence.js"
click node_dataset "https://github.com/ardkyer/seoul-startup-planner/blob/main/public/updated_commercial_areas.json"
click node_fetcher "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/api/dataFetcher.js"
click node_processor "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/api/dataProcessor.js"
click node_mapdata "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/hooks/useMapData.js"
click node_filters "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/hooks/useDataFilters.js"
click node_calculators "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/utils/calculators.js"
click node_formatters "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/utils/formatters.js"
click node_mapsettings "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/constants/mapSettings.js"
click node_map "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/Map.js"
click node_district "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/DistrictLayer.js"
click node_fills "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/FillLayer.js"
click node_heatmap "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/HeatmapLayer.js"
click node_chatwindow "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatWindow.js"
click node_chatbutton "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatButton.js"
click node_chatmessage "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatMessage.js"
click node_chatservice "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatService.js"
click node_policies "https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/constants/startupPolicies.json"
click node_maintenance "https://github.com/ardkyer/seoul-startup-planner/blob/main/updateClosureRateData.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_entry,node_app,node_intro toneBlue
class node_dataset,node_fetcher,node_processor,node_mapdata,node_filters,node_calculators,node_formatters toneAmber
class node_mapsettings,node_map,node_district,node_fills,node_heatmap toneMint
class node_chatwindow,node_chatbutton,node_chatmessage,node_chatservice,node_policies toneRose
class node_openai,node_maintenance toneNeutral
```

## Components

### React client

Browser application runtime.

- [Application entry](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/index.js): React bootstrap · `src/index.js`
- [App orchestration](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/App.js): React root · Composes intro, map, and chat. · `src/App.js`
- [Intro sequence](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Intro/IntroSequence.js): entry UI · `src/components/Intro/IntroSequence.js`

### Commercial data pipeline

Static records become map-ready metrics.

- [Commercial-area dataset](https://github.com/ardkyer/seoul-startup-planner/blob/main/public/updated_commercial_areas.json): static JSON · Prepared public-data-derived area records. · `public/updated_commercial_areas.json`
- [Data fetcher](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/api/dataFetcher.js): data access · `src/data/api/dataFetcher.js`
- [Data processor](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/api/dataProcessor.js): normalizer · Produces display-ready geographic records and metrics. · `src/data/api/dataProcessor.js`
- [Map data state](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/hooks/useMapData.js): React hook · `src/hooks/useMapData.js`
- [Data filters](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/hooks/useDataFilters.js): React hook · Applies user-selected constraints to map data. · `src/hooks/useDataFilters.js`
- [Metric calculations](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/utils/calculators.js): utility · `src/utils/calculators.js`
- [Metric formatting](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/utils/formatters.js): utility · `src/utils/formatters.js`

### Map visualization

Mapbox-based geographic views.

- [Map settings](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/constants/mapSettings.js): constants · Map defaults, metric definitions, and Mapbox settings. · `src/data/constants/mapSettings.js`
- [Interactive map](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/Map.js): Mapbox host · Handles map interaction and selected metric view. · `src/components/Map/Map.js`
- [District context](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/DistrictLayer.js): Mapbox layer · `src/components/Map/layers/DistrictLayer.js`
- [Commercial-area fills](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/FillLayer.js): Mapbox layer · `src/components/Map/layers/FillLayer.js`
- [Density heatmap](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Map/layers/HeatmapLayer.js): Mapbox layer · `src/components/Map/layers/HeatmapLayer.js`

### Policy advisor

Policy-focused chat workflow.

- [Chat window](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatWindow.js): conversation UI · `src/components/Chat/ChatWindow.js`
- [Chat launcher](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatButton.js): chat UI · `src/components/Chat/ChatButton.js`
- [Message renderer](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatMessage.js): chat UI · `src/components/Chat/ChatMessage.js`
- [Policy chat service](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/components/Chat/ChatService.js): external-service boundary · Calls the optional OpenAI GPT-3.5 provider from the browser. · `src/components/Chat/ChatService.js`
- [Startup policy context](https://github.com/ardkyer/seoul-startup-planner/blob/main/src/data/constants/startupPolicies.json): curated JSON · `src/data/constants/startupPolicies.json`

### Other components

- **OpenAI GPT-3.5**: optional LLM · Configured with REACT_APP_OPENAI_API_KEY.
- [Closure-rate updater](https://github.com/ardkyer/seoul-startup-planner/blob/main/updateClosureRateData.js): maintenance script · Updates closure-rate content outside the interactive runtime. · `updateClosureRateData.js`

## Connections

- Application entry → App orchestration: boots
- App orchestration → Intro sequence: presents
- App orchestration → Interactive map: hosts
- App orchestration → Chat window: hosts
- Commercial-area dataset → Data fetcher: loads
- Data fetcher → Data processor: raw records
- Data processor → Map data state: normalized features
- Map data state → Data filters: map data
- Metric calculations → Data filters: derived metrics
- Metric formatting → Interactive map: labels and popups
- Data filters → Interactive map: filtered features
- Map settings → Interactive map: view and metric config
- Interactive map → District context: renders
- Interactive map → Commercial-area fills: renders
- Interactive map → Density heatmap: renders
- Chat launcher → Chat window: opens
- Chat window → Message renderer: renders
- Chat window → Policy chat service: sends prompts
- Startup policy context → Policy chat service: policy context
- Policy chat service → OpenAI GPT-3.5: optional model call
- Closure-rate updater → Commercial-area dataset: updates closure-rate data
