# anvaka/map-of-github architecture

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

- Interactive diagram: https://gitdiagram.com/anvaka/map-of-github
- Repository: https://github.com/anvaka/map-of-github

## Overview

#### Purpose and entry points
Map of GitHub is a client-side explorer for a precomputed map of 690K+ GitHub repositories. Geographic proximity represents shared stargazers; map tiles and repository/search data are produced offline and consumed by the browser. Application startup flows through `src/main.js`, `src/startVue.js`, and root UI `src/App.vue`; Vite serves/builds the SPA via `vite.config.js`.

#### Application shell and interaction state
`src/App.vue` composes the map, search, repository details, and chat/label-editing surfaces. Vue components isolate major user workflows: repository lookup and selection in `src/components/Typeahead.vue` and `src/components/GithubRepository.vue`; focused-repository presentation in `src/components/FocusRepository.vue`; hierarchy/navigation in `src/components/TreeView.vue`. Cross-component events use `src/lib/bus.js`, while focus and group state are modeled by `src/lib/FocusViewModel.js` and `src/lib/GroupViewModel.js`.

#### Map rendering boundary
The central rendering boundary is between application state and map implementations. `src/lib/createMap.js` creates the primary map experience; `src/lib/createMaplibreSubgraphViewer.js` integrates MapLibre-backed visualization, and `src/lib/createSubgraphViewer.js` supports focused/local graph views. The browser loads pre-generated GeoJSON/vector-tile map data rather than calculating similarity, clustering, or layouts at runtime. MapLibre is the material mapping runtime; custom WebGL primitives under `src/lib/gl/` provide specialized points, lines, labels, and gradients.

#### Repository discovery and graph retrieval
Search uses a client-side, prefix-oriented repository dump with fuzzy matching, represented by `src/lib/createFuzzySearcher.js` and `src/components/Typeahead.vue`. On selection, `src/lib/fetchAndProcessGraph.js` retrieves and normalizes graph/subgraph data for the map and details views. `src/lib/dedupingFetch.js` coordinates repeated network requests. Repository metadata and GitHub-facing links/API operations are encapsulated in `src/lib/githubClient.js`, separating external GitHub access from Vue presentation.

#### Focus, groups, and export flow
A selected repository drives a focused graph/view-model state through `src/lib/focus.js` and `src/lib/FocusViewModel.js`, then feeds `src/components/FocusRepository.vue` and map subgraph viewers. Group-level navigation uses `src/lib/GroupViewModel.js` and `src/components/LargestRepositories.vue`. Users can export a group graph through `src/lib/downloadGroupGraph.js`, keeping download serialization outside rendering components.

#### Community labels and AI-assisted editing
Country/community labels are editable in the browser. `src/lib/label-editor/createLabelEditor.js` and `src/lib/label-editor/createDOMMarkerEditor.js` attach editing UI to map markers; `src/lib/label-editor/labelsStorage.js` persists edits for later contribution. `src/lib/openAIClient.js` forms the boundary to OpenAI for generating or assisting label content. `public/oauth.html` is a dedicated OAuth callback surface, likely supporting authenticated contribution workflows.

#### Runtime, deployment, and assets
This is a Vue SPA built with Vite and deployed as static content; `deploy.sh` is the repository deployment entry point. Static browser assets, including manifest, fonts, and OAuth callback page, live under `public/`. No server-side graph-computation pipeline is present here: BigQuery star-event extraction, AWS-scale Jaccard computation, Leiden clustering, force layouts, and Tippecanoe tile generation are upstream/offline infrastructure described by the project, with their outputs consumed by this frontend.

Main entry points: [`src/App.vue`](https://github.com/anvaka/map-of-github/blob/main/src/App.vue) (Application shell), [`src/lib/label-editor/createLabelEditor.js`](https://github.com/anvaka/map-of-github/blob/main/src/lib/label-editor/createLabelEditor.js) (Label editor), [`src/components/Typeahead.vue`](https://github.com/anvaka/map-of-github/blob/main/src/components/Typeahead.vue) (Repository search), [`src/lib/FocusViewModel.js`](https://github.com/anvaka/map-of-github/blob/main/src/lib/FocusViewModel.js) (Focus state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_spa["Vue SPA"]
  node_main["Browser entry<br/>startup<br/>[main.js]"]
  node_start_vue["Vue bootstrap<br/>startup<br/>[startVue.js]"]
  node_app["Application shell<br/>root component<br/>[App.vue]"]
  node_typeahead["Repository search<br/>Vue component<br/>[Typeahead.vue]"]
  node_repository["Repository details<br/>Vue component"]
  node_focus_ui["Focused repository<br/>Vue component"]
  node_groups_ui["Group navigation<br/>Vue component"]
  node_focus_state["Focus state<br/>view model<br/>[FocusViewModel.js]"]
  node_group_state["Group state &amp; export<br/>view model/export<br/>[GroupViewModel.js]"]
end

subgraph group_map["Map rendering"]
  node_map_factory["Primary map<br/>map factory<br/>[createMap.js]"]
  node_maplibre_viewer["MapLibre viewer<br/>map adapter"]
  node_subgraph_viewer["Local graph viewer<br/>map adapter"]
  node_webgl["Custom WebGL primitives<br/>rendering layer"]
end

subgraph group_data["Data &amp; external services"]
  node_searcher["Fuzzy repository index<br/>search service"]
  node_graph_fetch["Graph retrieval<br/>data service"]
  node_dedupe_fetch["Request deduplication<br/>network utility<br/>[dedupingFetch.js]"]
  node_map_data[("Precomputed map data<br/>static GeoJSON/vector tiles")]
end

subgraph group_labels["Community labels"]
  node_label_editor["Label editor<br/>browser editing service"]
  node_label_storage[("Label storage<br/>browser persistence<br/>[labelsStorage.js]")]
  node_openai["OpenAI assistance<br/>external AI client<br/>[openAIClient.js]"]
  node_oauth["OAuth callback<br/>static callback page<br/>[oauth.html]"]
end

node_vite["Vite build<br/>build tool<br/>[vite.config.js]"]

node_vite -->|"builds/serves"| node_main
node_main -->|"starts"| node_start_vue
node_start_vue -->|"mounts"| node_app
node_app -->|"search UI"| node_typeahead
node_app -->|"details UI"| node_repository
node_app -->|"focus UI"| node_focus_ui
node_app -->|"creates map"| node_map_factory
node_typeahead -->|"queries"| node_searcher
node_typeahead -->|"selection"| node_graph_fetch
node_graph_fetch -->|"coordinates requests"| node_dedupe_fetch
node_dedupe_fetch -->|"loads graph data"| node_map_data
node_map_factory -->|"uses"| node_maplibre_viewer
node_map_factory -->|"uses"| node_subgraph_viewer
node_maplibre_viewer -->|"renders with"| node_webgl
node_maplibre_viewer -->|"loads tiles"| node_map_data
node_graph_fetch -->|"updates"| node_focus_state
node_focus_state -->|"drives"| node_focus_ui
node_focus_state -->|"drives local graph"| node_subgraph_viewer
node_group_state -->|"drives"| node_groups_ui
node_app -->|"hosts editing"| node_label_editor
node_label_editor -->|"persists edits"| node_label_storage
node_label_editor -->|"requests assistance"| node_openai
node_oauth -.->|"supports contribution auth"| node_label_editor

click node_vite "https://github.com/anvaka/map-of-github/blob/main/vite.config.js"
click node_main "https://github.com/anvaka/map-of-github/blob/main/src/main.js"
click node_start_vue "https://github.com/anvaka/map-of-github/blob/main/src/startVue.js"
click node_app "https://github.com/anvaka/map-of-github/blob/main/src/App.vue"
click node_typeahead "https://github.com/anvaka/map-of-github/blob/main/src/components/Typeahead.vue"
click node_repository "https://github.com/anvaka/map-of-github/blob/main/src/components/GithubRepository.vue"
click node_focus_ui "https://github.com/anvaka/map-of-github/blob/main/src/components/FocusRepository.vue"
click node_groups_ui "https://github.com/anvaka/map-of-github/blob/main/src/components/LargestRepositories.vue"
click node_map_factory "https://github.com/anvaka/map-of-github/blob/main/src/lib/createMap.js"
click node_maplibre_viewer "https://github.com/anvaka/map-of-github/blob/main/src/lib/createMaplibreSubgraphViewer.js"
click node_subgraph_viewer "https://github.com/anvaka/map-of-github/blob/main/src/lib/createSubgraphViewer.js"
click node_searcher "https://github.com/anvaka/map-of-github/blob/main/src/lib/createFuzzySearcher.js"
click node_graph_fetch "https://github.com/anvaka/map-of-github/blob/main/src/lib/fetchAndProcessGraph.js"
click node_dedupe_fetch "https://github.com/anvaka/map-of-github/blob/main/src/lib/dedupingFetch.js"
click node_focus_state "https://github.com/anvaka/map-of-github/blob/main/src/lib/FocusViewModel.js"
click node_group_state "https://github.com/anvaka/map-of-github/blob/main/src/lib/GroupViewModel.js"
click node_label_editor "https://github.com/anvaka/map-of-github/blob/main/src/lib/label-editor/createLabelEditor.js"
click node_label_storage "https://github.com/anvaka/map-of-github/blob/main/src/lib/label-editor/labelsStorage.js"
click node_openai "https://github.com/anvaka/map-of-github/blob/main/src/lib/openAIClient.js"
click node_oauth "https://github.com/anvaka/map-of-github/blob/main/public/oauth.html"

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_main,node_start_vue,node_app,node_typeahead,node_repository,node_focus_ui,node_groups_ui,node_focus_state,node_group_state toneBlue
class node_map_factory,node_maplibre_viewer,node_subgraph_viewer,node_webgl toneAmber
class node_searcher,node_graph_fetch,node_dedupe_fetch,node_map_data toneMint
class node_label_editor,node_label_storage,node_openai,node_oauth toneRose
class node_vite toneNeutral
```

## Components

### Vue SPA

- [Browser entry](https://github.com/anvaka/map-of-github/blob/main/src/main.js): startup · `src/main.js`
- [Vue bootstrap](https://github.com/anvaka/map-of-github/blob/main/src/startVue.js): startup · `src/startVue.js`
- [Application shell](https://github.com/anvaka/map-of-github/blob/main/src/App.vue): root component · Composes map, search, details, and editing surfaces. · `src/App.vue`
- [Repository search](https://github.com/anvaka/map-of-github/blob/main/src/components/Typeahead.vue): Vue component · `src/components/Typeahead.vue`
- [Repository details](https://github.com/anvaka/map-of-github/blob/main/src/components/GithubRepository.vue): Vue component · `src/components/GithubRepository.vue`
- [Focused repository](https://github.com/anvaka/map-of-github/blob/main/src/components/FocusRepository.vue): Vue component · `src/components/FocusRepository.vue`
- [Group navigation](https://github.com/anvaka/map-of-github/blob/main/src/components/LargestRepositories.vue): Vue component · `src/components/LargestRepositories.vue`
- [Focus state](https://github.com/anvaka/map-of-github/blob/main/src/lib/FocusViewModel.js): view model · `src/lib/FocusViewModel.js`
- [Group state & export](https://github.com/anvaka/map-of-github/blob/main/src/lib/GroupViewModel.js): view model/export · Supports group navigation and graph download. · `src/lib/GroupViewModel.js`

### Map rendering

- [Primary map](https://github.com/anvaka/map-of-github/blob/main/src/lib/createMap.js): map factory · `src/lib/createMap.js`
- [MapLibre viewer](https://github.com/anvaka/map-of-github/blob/main/src/lib/createMaplibreSubgraphViewer.js): map adapter · `src/lib/createMaplibreSubgraphViewer.js`
- [Local graph viewer](https://github.com/anvaka/map-of-github/blob/main/src/lib/createSubgraphViewer.js): map adapter · `src/lib/createSubgraphViewer.js`
- **Custom WebGL primitives**: rendering layer · Renders specialized points, lines, labels, and gradients.

### Data & external services

- [Fuzzy repository index](https://github.com/anvaka/map-of-github/blob/main/src/lib/createFuzzySearcher.js): search service · Client-side prefix-oriented repository lookup. · `src/lib/createFuzzySearcher.js`
- [Graph retrieval](https://github.com/anvaka/map-of-github/blob/main/src/lib/fetchAndProcessGraph.js): data service · Fetches and normalizes selected repository graphs. · `src/lib/fetchAndProcessGraph.js`
- [Request deduplication](https://github.com/anvaka/map-of-github/blob/main/src/lib/dedupingFetch.js): network utility · `src/lib/dedupingFetch.js`
- **Precomputed map data**: static GeoJSON/vector tiles · Offline similarity, clustering, and layout outputs consumed in the browser.

### Community labels

- [Label editor](https://github.com/anvaka/map-of-github/blob/main/src/lib/label-editor/createLabelEditor.js): browser editing service · Edits map marker labels and persists contributions. · `src/lib/label-editor/createLabelEditor.js`
- [Label storage](https://github.com/anvaka/map-of-github/blob/main/src/lib/label-editor/labelsStorage.js): browser persistence · `src/lib/label-editor/labelsStorage.js`
- [OpenAI assistance](https://github.com/anvaka/map-of-github/blob/main/src/lib/openAIClient.js): external AI client · `src/lib/openAIClient.js`
- [OAuth callback](https://github.com/anvaka/map-of-github/blob/main/public/oauth.html): static callback page · `public/oauth.html`

### Other components

- [Vite build](https://github.com/anvaka/map-of-github/blob/main/vite.config.js): build tool · Serves and builds the static SPA. · `vite.config.js`

## Connections

- Vite build → Browser entry: builds/serves
- Browser entry → Vue bootstrap: starts
- Vue bootstrap → Application shell: mounts
- Application shell → Repository search: search UI
- Application shell → Repository details: details UI
- Application shell → Focused repository: focus UI
- Application shell → Primary map: creates map
- Repository search → Fuzzy repository index: queries
- Repository search → Graph retrieval: selection
- Graph retrieval → Request deduplication: coordinates requests
- Request deduplication → Precomputed map data: loads graph data
- Primary map → MapLibre viewer: uses
- Primary map → Local graph viewer: uses
- MapLibre viewer → Custom WebGL primitives: renders with
- MapLibre viewer → Precomputed map data: loads tiles
- Graph retrieval → Focus state: updates
- Focus state → Focused repository: drives
- Focus state → Local graph viewer: drives local graph
- Group state & export → Group navigation: drives
- Application shell → Label editor: hosts editing
- Label editor → Label storage: persists edits
- Label editor → OpenAI assistance: requests assistance
- OAuth callback → Label editor: supports contribution auth
