# fos2936/etymograph architecture

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

- Interactive diagram: https://gitdiagram.com/fos2936/etymograph
- Repository: https://github.com/fos2936/etymograph

## Overview

This is a browser-based etymological graph explorer: the client requests graph data, builds a view, and lets users browse reconstructed roots or trace a selected word’s ancestry. The graph utilities derive collapsed root-to-language views and individual word paths; the visualization, legend, and root desk present them. Both TypeScript sources and corresponding browser JavaScript are represented because both are substantial indexed modules. The API implementation and SQL schema are present in the tree, but their relationship and database behavior are not shown in the excerpts.

Main entry points: [`src/main.ts`](https://github.com/fos2936/etymograph/blob/main/src/main.ts) (Client entry), [`public/js/main.js`](https://github.com/fos2936/etymograph/blob/main/public/js/main.js) (Browser entry), [`src/ui/legend.ts`](https://github.com/fos2936/etymograph/blob/main/src/ui/legend.ts) (Legend UI), [`public/js/ui/legend.js`](https://github.com/fos2936/etymograph/blob/main/public/js/ui/legend.js) (Browser legend UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_ts_entry["Client entry<br/>[main.ts]"]
  node_js_entry["Browser entry<br/>[main.js]"]
  node_ts_visual["Graph renderer<br/>[constellation.ts]"]
  node_js_visual["Browser graph renderer<br/>[constellation.js]"]
  node_ts_legend["Legend UI<br/>[legend.ts]"]
  node_js_legend["Browser legend UI<br/>[legend.js]"]
  node_ts_roots["Root explorer UI<br/>[roots-desk.ts]"]
  node_js_roots["Browser root explorer<br/>[roots-desk.js]"]
end

subgraph group_domain["Graph and language domain"]
  node_ts_utils["Graph transforms<br/>[tree-utils.ts]"]
  node_js_utils["Browser graph transforms<br/>[tree-utils.js]"]
  node_ts_branches["Branch palette<br/>[branches.ts]"]
  node_js_branches["Browser branch palette<br/>[branches.js]"]
  node_ts_languages["Language flags<br/>[languages.ts]"]
  node_js_languages["Browser language flags<br/>[languages.js]"]
  node_graph_types["Graph data types<br/>[types.ts]"]
end

subgraph group_service["Data service"]
  node_api_server["HTTP server<br/>[server.js]"]
  node_graph_store[("Graph database schema<br/>[script.sql]")]
end

node_visitor(("Explorer"))
node_browser(("Web browser"))

node_visitor -->|"uses"| node_browser
node_browser -.->|"loads app"| node_ts_entry
node_browser -.->|"loads app"| node_js_entry
node_ts_entry -->|"fetches graph"| node_api_server
node_js_entry -->|"fetches graph"| node_api_server
node_ts_entry -->|"renders legend"| node_ts_legend
node_ts_entry -->|"builds views"| node_ts_utils
node_ts_entry -->|"initializes graph"| node_ts_visual
node_ts_entry -->|"renders root desk"| node_ts_roots
node_js_entry -->|"renders legend"| node_js_legend
node_js_entry -->|"builds views"| node_js_utils
node_js_entry -->|"initializes graph"| node_js_visual
node_js_entry -->|"renders root desk"| node_js_roots
node_ts_visual -->|"colors nodes"| node_ts_branches
node_js_visual -->|"colors nodes"| node_js_branches
node_ts_legend -->|"uses colors"| node_ts_branches
node_ts_legend -->|"uses flags"| node_ts_languages
node_js_legend -->|"uses colors"| node_js_branches
node_js_legend -->|"uses flags"| node_js_languages
node_ts_roots -->|"gets descendants"| node_ts_utils
node_ts_roots -->|"uses flags"| node_ts_languages
node_js_roots -->|"gets descendants"| node_js_utils
node_js_roots -->|"uses flags"| node_js_languages
node_ts_utils -->|"identifies roots"| node_ts_branches
node_js_utils -->|"identifies roots"| node_js_branches
node_api_server -.->|"may access"| node_graph_store

click node_ts_entry "https://github.com/fos2936/etymograph/blob/main/src/main.ts"
click node_js_entry "https://github.com/fos2936/etymograph/blob/main/public/js/main.js"
click node_ts_visual "https://github.com/fos2936/etymograph/blob/main/src/graph/constellation.ts"
click node_js_visual "https://github.com/fos2936/etymograph/blob/main/public/js/graph/constellation.js"
click node_ts_legend "https://github.com/fos2936/etymograph/blob/main/src/ui/legend.ts"
click node_js_legend "https://github.com/fos2936/etymograph/blob/main/public/js/ui/legend.js"
click node_ts_roots "https://github.com/fos2936/etymograph/blob/main/src/ui/roots-desk.ts"
click node_js_roots "https://github.com/fos2936/etymograph/blob/main/public/js/ui/roots-desk.js"
click node_ts_utils "https://github.com/fos2936/etymograph/blob/main/src/graph/tree-utils.ts"
click node_js_utils "https://github.com/fos2936/etymograph/blob/main/public/js/graph/tree-utils.js"
click node_ts_branches "https://github.com/fos2936/etymograph/blob/main/src/config/branches.ts"
click node_js_branches "https://github.com/fos2936/etymograph/blob/main/public/js/config/branches.js"
click node_ts_languages "https://github.com/fos2936/etymograph/blob/main/src/config/languages.ts"
click node_js_languages "https://github.com/fos2936/etymograph/blob/main/public/js/config/languages.js"
click node_graph_types "https://github.com/fos2936/etymograph/blob/main/src/types.ts"
click node_api_server "https://github.com/fos2936/etymograph/blob/main/server.js"
click node_graph_store "https://github.com/fos2936/etymograph/blob/main/database/script.sql"

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_ts_entry,node_js_entry,node_ts_visual,node_js_visual,node_ts_legend,node_js_legend,node_ts_roots,node_js_roots,node_browser toneBlue
class node_ts_utils,node_js_utils,node_ts_branches,node_js_branches,node_ts_languages,node_js_languages,node_graph_types toneAmber
class node_api_server,node_graph_store toneMint
class node_visitor toneIndigo
```

## Components

### Browser experience

- [Client entry](https://github.com/fos2936/etymograph/blob/main/src/main.ts): `src/main.ts`
- [Browser entry](https://github.com/fos2936/etymograph/blob/main/public/js/main.js): `public/js/main.js`
- [Graph renderer](https://github.com/fos2936/etymograph/blob/main/src/graph/constellation.ts): `src/graph/constellation.ts`
- [Browser graph renderer](https://github.com/fos2936/etymograph/blob/main/public/js/graph/constellation.js): `public/js/graph/constellation.js`
- [Legend UI](https://github.com/fos2936/etymograph/blob/main/src/ui/legend.ts): `src/ui/legend.ts`
- [Browser legend UI](https://github.com/fos2936/etymograph/blob/main/public/js/ui/legend.js): `public/js/ui/legend.js`
- [Root explorer UI](https://github.com/fos2936/etymograph/blob/main/src/ui/roots-desk.ts): `src/ui/roots-desk.ts`
- [Browser root explorer](https://github.com/fos2936/etymograph/blob/main/public/js/ui/roots-desk.js): `public/js/ui/roots-desk.js`

### Graph and language domain

- [Graph transforms](https://github.com/fos2936/etymograph/blob/main/src/graph/tree-utils.ts): `src/graph/tree-utils.ts`
- [Browser graph transforms](https://github.com/fos2936/etymograph/blob/main/public/js/graph/tree-utils.js): `public/js/graph/tree-utils.js`
- [Branch palette](https://github.com/fos2936/etymograph/blob/main/src/config/branches.ts): `src/config/branches.ts`
- [Browser branch palette](https://github.com/fos2936/etymograph/blob/main/public/js/config/branches.js): `public/js/config/branches.js`
- [Language flags](https://github.com/fos2936/etymograph/blob/main/src/config/languages.ts): `src/config/languages.ts`
- [Browser language flags](https://github.com/fos2936/etymograph/blob/main/public/js/config/languages.js): `public/js/config/languages.js`
- [Graph data types](https://github.com/fos2936/etymograph/blob/main/src/types.ts): `src/types.ts`

### Data service

- [HTTP server](https://github.com/fos2936/etymograph/blob/main/server.js): `server.js`
- [Graph database schema](https://github.com/fos2936/etymograph/blob/main/database/script.sql): `database/script.sql`

### Other components

- **Explorer**
- **Web browser**

## Connections

- Explorer → Web browser: uses
- Web browser → Client entry: loads app
- Web browser → Browser entry: loads app
- Client entry → HTTP server: fetches graph (evidence: `src/main.ts`)
- Browser entry → HTTP server: fetches graph (evidence: `public/js/main.js`)
- Client entry → Legend UI: renders legend (evidence: `src/main.ts`)
- Client entry → Graph transforms: builds views (evidence: `src/main.ts`)
- Client entry → Graph renderer: initializes graph (evidence: `src/main.ts`)
- Client entry → Root explorer UI: renders root desk (evidence: `src/main.ts`)
- Browser entry → Browser legend UI: renders legend (evidence: `public/js/main.js`)
- Browser entry → Browser graph transforms: builds views (evidence: `public/js/main.js`)
- Browser entry → Browser graph renderer: initializes graph (evidence: `public/js/main.js`)
- Browser entry → Browser root explorer: renders root desk (evidence: `public/js/main.js`)
- Graph renderer → Branch palette: colors nodes (evidence: `src/graph/constellation.ts`)
- Browser graph renderer → Browser branch palette: colors nodes (evidence: `public/js/graph/constellation.js`)
- Legend UI → Branch palette: uses colors (evidence: `src/ui/legend.ts`)
- Legend UI → Language flags: uses flags (evidence: `src/ui/legend.ts`)
- Browser legend UI → Browser branch palette: uses colors (evidence: `public/js/ui/legend.js`)
- Browser legend UI → Browser language flags: uses flags (evidence: `public/js/ui/legend.js`)
- Root explorer UI → Graph transforms: gets descendants (evidence: `src/ui/roots-desk.ts`)
- Root explorer UI → Language flags: uses flags (evidence: `src/ui/roots-desk.ts`)
- Browser root explorer → Browser graph transforms: gets descendants (evidence: `public/js/ui/roots-desk.js`)
- Browser root explorer → Browser language flags: uses flags (evidence: `public/js/ui/roots-desk.js`)
- Graph transforms → Branch palette: identifies roots (evidence: `src/graph/tree-utils.ts`)
- Browser graph transforms → Browser branch palette: identifies roots (evidence: `public/js/graph/tree-utils.js`)
- HTTP server → Graph database schema: may access
