# hyldem0er/urd architecture

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

- Interactive diagram: https://gitdiagram.com/hyldem0er/urd
- Repository: https://github.com/hyldem0er/urd

## Overview

Urd is a local-first Firefox extension for recording investigation trails as an editable visual tree. The main workflow captures browser navigation and copied or selected text, associates those events into navigation, pivot, and translation relationships, and stores the resulting graph in IndexedDB. Users inspect and organize it in the tree viewer, add notes from the popup, or export investigation logs. The source excerpts show the capture, persistence, popup, and viewer responsibilities; the report and other documented capabilities are included, but their full internal wiring was not sampled.

Main entry points: [`background.js`](https://github.com/hyldem0er/urd/blob/main/background.js) (Trail tracking), [`popup.js`](https://github.com/hyldem0er/urd/blob/main/popup.js) (Quick controls), [`viewer.js`](https://github.com/hyldem0er/urd/blob/main/viewer.js) (Tree viewer), [`report.js`](https://github.com/hyldem0er/urd/blob/main/report.js) (Investigation report)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and detection"]
  node_selection["Text capture<br/>[content.js]"]
  node_tracker["Trail tracking<br/>[background.js]"]
  node_searches["Search detection"]
  node_translators["Translator detection<br/>[translators.json]"]
end

subgraph group_data["Local investigation data"]
  node_store[("Investigation store<br/>[db.js]")]
end

subgraph group_interface["Investigation interfaces"]
  node_popup["Quick controls<br/>[popup.js]"]
  node_tree["Tree viewer<br/>[viewer.js]"]
end

subgraph group_output["Reports and export"]
  node_report["Investigation report<br/>[report.js]"]
  node_pdf["PDF export<br/>[report.js]"]
  node_markdown["Markdown export<br/>[report.js]"]
  node_json["JSON export/import<br/>[viewer.js]"]
end

node_browser(("Browser activity"))

node_browser -->|"records navigation"| node_tracker
node_browser -->|"captures text"| node_selection
node_selection -->|"sends text"| node_tracker
node_tracker -->|"writes trail"| node_store
node_tracker -->|"uses engine rules"| node_searches
node_tracker -->|"uses site rules"| node_translators
node_popup -->|"reads and updates"| node_store
node_popup -->|"starts tracking"| node_tracker
node_popup -->|"opens viewer"| node_tree
node_tree -->|"reads and edits"| node_store
node_browser -.->|"opens controls"| node_popup
node_browser -.->|"requests report"| node_report
node_report -->|"exports PDF"| node_pdf
node_report -->|"exports Markdown"| node_markdown
node_tree -->|"imports and exports"| node_json

click node_selection "https://github.com/hyldem0er/urd/blob/main/content.js"
click node_tracker "https://github.com/hyldem0er/urd/blob/main/background.js"
click node_searches "https://github.com/hyldem0er/urd/blob/main/config/search-engines.json"
click node_translators "https://github.com/hyldem0er/urd/blob/main/config/translators.json"
click node_store "https://github.com/hyldem0er/urd/blob/main/db.js"
click node_popup "https://github.com/hyldem0er/urd/blob/main/popup.js"
click node_tree "https://github.com/hyldem0er/urd/blob/main/viewer.js"
click node_report "https://github.com/hyldem0er/urd/blob/main/report.js"
click node_pdf "https://github.com/hyldem0er/urd/blob/main/report.js"
click node_markdown "https://github.com/hyldem0er/urd/blob/main/report.js"
click node_json "https://github.com/hyldem0er/urd/blob/main/viewer.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_selection,node_tracker,node_searches,node_translators,node_browser toneBlue
class node_store toneAmber
class node_popup,node_tree toneMint
class node_report,node_pdf,node_markdown,node_json toneRose
```

## Components

### Capture and detection

- [Text capture](https://github.com/hyldem0er/urd/blob/main/content.js): `content.js`
- [Trail tracking](https://github.com/hyldem0er/urd/blob/main/background.js): `background.js`
- [Search detection](https://github.com/hyldem0er/urd/blob/main/config/search-engines.json): `config/search-engines.json`
- [Translator detection](https://github.com/hyldem0er/urd/blob/main/config/translators.json): `config/translators.json`

### Local investigation data

- [Investigation store](https://github.com/hyldem0er/urd/blob/main/db.js): `db.js`

### Investigation interfaces

- [Quick controls](https://github.com/hyldem0er/urd/blob/main/popup.js): `popup.js`
- [Tree viewer](https://github.com/hyldem0er/urd/blob/main/viewer.js): `viewer.js`

### Reports and export

- [Investigation report](https://github.com/hyldem0er/urd/blob/main/report.js): `report.js`
- [PDF export](https://github.com/hyldem0er/urd/blob/main/report.js): `report.js`
- [Markdown export](https://github.com/hyldem0er/urd/blob/main/report.js): `report.js`
- [JSON export/import](https://github.com/hyldem0er/urd/blob/main/viewer.js): `viewer.js`

### Other components

- **Browser activity**

## Connections

- Browser activity → Trail tracking: records navigation (evidence: `background.js`)
- Browser activity → Text capture: captures text (evidence: `content.js`)
- Text capture → Trail tracking: sends text (evidence: `content.js`)
- Trail tracking → Investigation store: writes trail (evidence: `background.js`)
- Trail tracking → Search detection: uses engine rules (evidence: `background.js`)
- Trail tracking → Translator detection: uses site rules (evidence: `background.js`)
- Quick controls → Investigation store: reads and updates (evidence: `popup.js`)
- Quick controls → Trail tracking: starts tracking (evidence: `popup.js`)
- Quick controls → Tree viewer: opens viewer (evidence: `popup.js`)
- Tree viewer → Investigation store: reads and edits (evidence: `viewer.js`)
- Browser activity → Quick controls: opens controls
- Browser activity → Investigation report: requests report
- Investigation report → PDF export: exports PDF (evidence: `README.md`)
- Investigation report → Markdown export: exports Markdown (evidence: `README.md`)
- Tree viewer → JSON export/import: imports and exports (evidence: `README.md`)
