# modelearth/localsite architecture

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

- Interactive diagram: https://gitdiagram.com/modelearth/localsite
- Repository: https://github.com/modelearth/localsite

## Overview

Localsite is a static framework for navigation, maps, and data-driven pages. A user can open a datascape, select a map layer, and optionally use search and filters; the framework displays maps and data sourced from JSON APIs, Google Sheets, or CSV files. Other substantial capabilities include industry and trade views, impact visualizations, events, and reusable embeds. The excerpts show template loading and Leaflet map creation; several other modules are indexed but their runtime wiring is not shown, so those links are omitted.

Main entry points: [`js/localsite.js`](https://github.com/modelearth/localsite/blob/main/js/localsite.js) (Site Framework), [`js/map.js`](https://github.com/modelearth/localsite/blob/main/js/map.js) (Map Views), [`info/template-main.html`](https://github.com/modelearth/localsite/blob/main/info/template-main.html) (Page Template), [`js/leaflet.js`](https://github.com/modelearth/localsite/blob/main/js/leaflet.js) (Leaflet Maps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_framework["Site Framework"]
  node_localsite["Site Framework<br/>[localsite.js]"]
  node_template["Page Template<br/>[template-main.html]"]
  node_navigation["Navigation<br/>[navigation.js]"]
  node_menu["Menu<br/>[menu.js]"]
end

subgraph group_maps["Maps and Filters"]
  node_mapview["Map Views<br/>[map.js]"]
  node_leaflet["Leaflet Maps<br/>[leaflet.js]"]
  node_mapfilters["Map Filters<br/>[map-filters.js]"]
  node_earthfilters["Earth Filters<br/>[earth-filters.js]"]
  node_neighborhood["Neighborhood Data<br/>[tabletop.js]"]
end

subgraph group_data["Data Experiences"]
  node_industry["Industry Explorer<br/>[naics.js]"]
  node_industrydetail["Industry Detail<br/>[industry-detail.js]"]
  node_impacts["Impact Views<br/>[impact-sets.js]"]
  node_earthscape["Earthscape Charts<br/>[earthscape.js]"]
  node_trade["Trade Controls<br/>[trade.js]"]
  node_events["Event Views<br/>[event.js]"]
end

subgraph group_support["Reusable Components"]
  node_content["Content Repository<br/>[content-repo.js]"]
  node_yaml["YAML Support<br/>[yaml.js]"]
  node_slides["Slide Views<br/>[slides.js]"]
  node_statesdata["State Data Prep<br/>[us-states.py]"]
end

node_visitor(("Site Visitor"))
node_datasources[("Data Sources")]

node_visitor -->|"opens pages"| node_localsite
node_localsite -->|"loads template"| node_template
node_localsite -.->|"displays maps"| node_mapview
node_datasources -->|"supplies data"| node_localsite
node_mapview -->|"creates maps"| node_leaflet
node_visitor -.->|"sets map filters"| node_earthfilters

click node_localsite "https://github.com/modelearth/localsite/blob/main/js/localsite.js"
click node_template "https://github.com/modelearth/localsite/blob/main/info/template-main.html"
click node_navigation "https://github.com/modelearth/localsite/blob/main/js/navigation.js"
click node_menu "https://github.com/modelearth/localsite/blob/main/js/menu.js"
click node_mapview "https://github.com/modelearth/localsite/blob/main/js/map.js"
click node_leaflet "https://github.com/modelearth/localsite/blob/main/js/leaflet.js"
click node_mapfilters "https://github.com/modelearth/localsite/blob/main/js/map-filters.js"
click node_earthfilters "https://github.com/modelearth/localsite/blob/main/js/earth-filters.js"
click node_neighborhood "https://github.com/modelearth/localsite/blob/main/map/neighborhood/js/tabletop.js"
click node_industry "https://github.com/modelearth/localsite/blob/main/js/naics.js"
click node_industrydetail "https://github.com/modelearth/localsite/blob/main/js/industry-detail.js"
click node_impacts "https://github.com/modelearth/localsite/blob/main/js/impact-sets.js"
click node_earthscape "https://github.com/modelearth/localsite/blob/main/js/earthscape.js"
click node_trade "https://github.com/modelearth/localsite/blob/main/js/trade.js"
click node_events "https://github.com/modelearth/localsite/blob/main/js/event.js"
click node_content "https://github.com/modelearth/localsite/blob/main/js/content-repo.js"
click node_yaml "https://github.com/modelearth/localsite/blob/main/js/yaml.js"
click node_slides "https://github.com/modelearth/localsite/blob/main/start/slide/js/slides.js"
click node_statesdata "https://github.com/modelearth/localsite/blob/main/info/data/map-filters/us-states.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_localsite,node_template,node_navigation,node_menu toneBlue
class node_mapview,node_leaflet,node_mapfilters,node_earthfilters,node_neighborhood,node_datasources toneAmber
class node_industry,node_industrydetail,node_impacts,node_earthscape,node_trade,node_events toneMint
class node_content,node_yaml,node_slides,node_statesdata toneRose
class node_visitor toneIndigo
```

## Components

### Site Framework

- [Site Framework](https://github.com/modelearth/localsite/blob/main/js/localsite.js): `js/localsite.js`
- [Page Template](https://github.com/modelearth/localsite/blob/main/info/template-main.html): `info/template-main.html`
- [Navigation](https://github.com/modelearth/localsite/blob/main/js/navigation.js): `js/navigation.js`
- [Menu](https://github.com/modelearth/localsite/blob/main/js/menu.js): `js/menu.js`

### Maps and Filters

- [Map Views](https://github.com/modelearth/localsite/blob/main/js/map.js): `js/map.js`
- [Leaflet Maps](https://github.com/modelearth/localsite/blob/main/js/leaflet.js): `js/leaflet.js`
- [Map Filters](https://github.com/modelearth/localsite/blob/main/js/map-filters.js): `js/map-filters.js`
- [Earth Filters](https://github.com/modelearth/localsite/blob/main/js/earth-filters.js): `js/earth-filters.js`
- [Neighborhood Data](https://github.com/modelearth/localsite/blob/main/map/neighborhood/js/tabletop.js): `map/neighborhood/js/tabletop.js`

### Data Experiences

- [Industry Explorer](https://github.com/modelearth/localsite/blob/main/js/naics.js): `js/naics.js`
- [Industry Detail](https://github.com/modelearth/localsite/blob/main/js/industry-detail.js): `js/industry-detail.js`
- [Impact Views](https://github.com/modelearth/localsite/blob/main/js/impact-sets.js): `js/impact-sets.js`
- [Earthscape Charts](https://github.com/modelearth/localsite/blob/main/js/earthscape.js): `js/earthscape.js`
- [Trade Controls](https://github.com/modelearth/localsite/blob/main/js/trade.js): `js/trade.js`
- [Event Views](https://github.com/modelearth/localsite/blob/main/js/event.js): `js/event.js`

### Reusable Components

- [Content Repository](https://github.com/modelearth/localsite/blob/main/js/content-repo.js): `js/content-repo.js`
- [YAML Support](https://github.com/modelearth/localsite/blob/main/js/yaml.js): `js/yaml.js`
- [Slide Views](https://github.com/modelearth/localsite/blob/main/start/slide/js/slides.js): `start/slide/js/slides.js`
- [State Data Prep](https://github.com/modelearth/localsite/blob/main/info/data/map-filters/us-states.py): `info/data/map-filters/us-states.py`

### Other components

- **Site Visitor**
- **Data Sources**

## Connections

- Site Visitor → Site Framework: opens pages (evidence: `README.md`)
- Site Framework → Page Template: loads template (evidence: `js/localsite.js`)
- Site Framework → Map Views: displays maps (evidence: `README.md`)
- Data Sources → Site Framework: supplies data (evidence: `README.md`)
- Map Views → Leaflet Maps: creates maps (evidence: `js/map.js`)
- Site Visitor → Earth Filters: sets map filters (evidence: `README.md`)
