# erikshelley/complete-family-tree-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/erikshelley/complete-family-tree-viewer
- Repository: https://github.com/erikshelley/complete-family-tree-viewer

## Overview

Complete Family Tree Viewer is a browser-based, serverless GEDCOM viewer. Users load a local or sample GEDCOM file, choose a root person and display options, then explore and export the resulting complete family tree. The graph preserves the documented import, tree-building, layout, styling, interaction, and export capabilities. Several internal handoffs are dashed because the sampled excerpts do not show their callers; the README documents capabilities, not those module-level calls.

Main entry points: [`src/js/ui.js`](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui.js) (Application UI), [`src/js/position_tree.js`](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/position_tree.js) (Tree Positioning), [`src/js/draw_tree.js`](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/draw_tree.js) (SVG Tree Rendering), [`src/js/build_tree.js`](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/build_tree.js) (Family Tree Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["GEDCOM Input"]
  node_gedcom["GEDCOM Parsing<br/>[gedcom.js]"]
end

subgraph group_tree["Tree Construction"]
  node_build["Family Tree Builder<br/>[build_tree.js]"]
end

subgraph group_view["Viewing and Layout"]
  node_layout["Tree Positioning<br/>[position_tree.js]"]
  node_layout_helpers["Layout Helpers"]
  node_draw["SVG Tree Rendering<br/>[draw_tree.js]"]
  node_styling["Visual Styling<br/>[style.css]"]
  node_responsive["Responsive Styling<br/>[style_media.css]"]
  node_ranges["Range Styling<br/>[style_ranges.css]"]
end

subgraph group_controls["Controls and Export"]
  node_ui["Application UI<br/>[ui.js]"]
  node_events["UI Events<br/>[ui_events.js]"]
  node_state["UI State<br/>[ui_declarations.js]"]
  node_presets["Style Presets<br/>[presets.js]"]
  node_export["PNG and SVG Export<br/>[ui.js]"]
end

node_user(("Viewer"))
node_local["Local GEDCOM"]
node_samples(("Online Samples"))

node_user -->|"chooses options"| node_ui
node_user -->|"selects file"| node_local
node_user -->|"chooses sample"| node_samples
node_local -.->|"provides file"| node_ui
node_samples -.->|"provides file"| node_ui
node_ui -->|"decodes and validates"| node_gedcom
node_ui -->|"parses data"| node_gedcom
node_ui -->|"requests tree"| node_build
node_events -->|"requests updates"| node_ui
node_ui -.->|"uses presets"| node_presets
node_build -.->|"supplies tree for positioning"| node_layout
node_layout -.->|"uses helpers"| node_layout_helpers
node_layout -.->|"supplies positioned tree"| node_draw
node_draw -.->|"renders with styles"| node_styling
node_ui -.->|"supports tree interaction"| node_draw
node_ui -->|"exports tree"| node_export
node_user -->|"saves image"| node_export

click node_gedcom "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/gedcom.js"
click node_ui "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui.js"
click node_events "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui_events.js"
click node_state "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui_declarations.js"
click node_presets "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/presets.js"
click node_build "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/build_tree.js"
click node_layout "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/position_tree.js"
click node_layout_helpers "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/position_tree_helpers.js"
click node_draw "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/draw_tree.js"
click node_styling "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style.css"
click node_responsive "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style_media.css"
click node_ranges "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style_ranges.css"
click node_export "https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui.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_gedcom,node_user toneBlue
class node_build toneAmber
class node_layout,node_layout_helpers,node_draw,node_styling,node_responsive,node_ranges toneMint
class node_ui,node_events,node_state,node_presets,node_export toneRose
class node_local,node_samples toneIndigo
```

## Components

### GEDCOM Input

- [GEDCOM Parsing](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/gedcom.js): `src/js/gedcom.js`

### Tree Construction

- [Family Tree Builder](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/build_tree.js): `src/js/build_tree.js`

### Viewing and Layout

- [Tree Positioning](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/position_tree.js): `src/js/position_tree.js`
- [Layout Helpers](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/position_tree_helpers.js): `src/js/position_tree_helpers.js`
- [SVG Tree Rendering](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/draw_tree.js): `src/js/draw_tree.js`
- [Visual Styling](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style.css): `src/css/style.css`
- [Responsive Styling](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style_media.css): `src/css/style_media.css`
- [Range Styling](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/css/style_ranges.css): `src/css/style_ranges.css`

### Controls and Export

- [Application UI](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui.js): `src/js/ui.js`
- [UI Events](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui_events.js): `src/js/ui_events.js`
- [UI State](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui_declarations.js): `src/js/ui_declarations.js`
- [Style Presets](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/presets.js): `src/js/presets.js`
- [PNG and SVG Export](https://github.com/erikshelley/complete-family-tree-viewer/blob/main/src/js/ui.js): `src/js/ui.js`

### Other components

- **Viewer**
- **Local GEDCOM**
- **Online Samples**

## Connections

- Viewer → Application UI: chooses options (evidence: `README.md`)
- Viewer → Local GEDCOM: selects file (evidence: `README.md`)
- Viewer → Online Samples: chooses sample (evidence: `README.md`)
- Local GEDCOM → Application UI: provides file
- Online Samples → Application UI: provides file
- Application UI → GEDCOM Parsing: decodes and validates (evidence: `src/js/ui.js`)
- Application UI → GEDCOM Parsing: parses data (evidence: `src/js/ui.js`)
- Application UI → Family Tree Builder: requests tree (evidence: `src/js/ui.js`)
- UI Events → Application UI: requests updates (evidence: `src/js/ui_events.js`)
- Application UI → Style Presets: uses presets
- Family Tree Builder → Tree Positioning: supplies tree for positioning
- Tree Positioning → Layout Helpers: uses helpers
- Tree Positioning → SVG Tree Rendering: supplies positioned tree
- SVG Tree Rendering → Visual Styling: renders with styles
- Application UI → SVG Tree Rendering: supports tree interaction
- Application UI → PNG and SVG Export: exports tree (evidence: `src/js/ui.js`)
- Viewer → PNG and SVG Export: saves image (evidence: `README.md`)
