# saintpepsi/openjam architecture

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

- Interactive diagram: https://gitdiagram.com/saintpepsi/openjam
- Repository: https://github.com/saintpepsi/openjam

## Overview

OpenJam is a local-first Chrome extension for recording a bug reproduction and exporting it as an offline HTML report. The user starts and stops a recording from the popup; the background worker selects CDP or reduced page-probe capture, gathers timeline events and session replay, then opens the report viewer or exports a self-contained file. The viewer supports replay, filtering/search, screenshots, device details, and opt-in narration. The README documents these capabilities; unsampled source limits the precise wiring shown for popup, audio, and report handoff.

Main entry points: [`background.js`](https://github.com/saintpepsi/openjam/blob/main/background.js) (Capture coordinator), [`src/lanes/cdp.js`](https://github.com/saintpepsi/openjam/blob/main/src/lanes/cdp.js) (CDP capture lane), [`src/lanes/inject.js`](https://github.com/saintpepsi/openjam/blob/main/src/lanes/inject.js) (Inject capture lane), [`src/page-probe.js`](https://github.com/saintpepsi/openjam/blob/main/src/page-probe.js) (Page probe)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture"]
  node_popup["Extension popup<br/>[popup.js]"]
  node_popup_ui["Popup UI<br/>[openjam-popup.js]"]
  node_worker["Capture coordinator<br/>[background.js]"]
  node_cdp["CDP capture lane<br/>[cdp.js]"]
  node_inject["Inject capture lane<br/>[inject.js]"]
  node_probe["Page probe<br/>[page-probe.js]"]
  node_network["Fetch/XHR capture<br/>[network.js]"]
  node_serialize["Console serialization<br/>[serialize.js]"]
  node_device["Device snapshot<br/>[device-info.js]"]
  node_limits["Capture limits<br/>[capture-limits.js]"]
end

subgraph group_recording["Recording"]
  node_kinds["Event schema<br/>[event-kinds.js]"]
  node_recorder["Session recorder<br/>[rrweb-recorder.js]"]
  node_relay["Page relay<br/>[rrweb-relay.js]"]
  node_wire["World messaging<br/>[wire.js]"]
end

subgraph group_report["Report generation"]
  node_report_builder["HTML report builder<br/>[report-builder.js]"]
  node_manifest["AI report manifest<br/>[manifest.js]"]
end

subgraph group_viewing["Report viewing"]
  node_viewer["Report viewer<br/>[viewer.js]"]
  node_renderer["Timeline and replay UI<br/>[renderer.js]"]
end

subgraph group_audio["Audio narration"]
  node_audio_capture["Mic capture<br/>[offscreen.js]"]
  node_audio_view["Narration playback<br/>[audio-sync.js]"]
end

node_user(("User"))
node_browser["Chromium browser"]
node_chrome_api["Chrome extension APIs"]

node_user -->|"starts recording"| node_popup
node_popup -.->|"renders controls"| node_popup_ui
node_popup -->|"requests capture"| node_worker
node_worker -->|"selects lane"| node_cdp
node_worker -->|"selects lane"| node_inject
node_inject -->|"injects probe"| node_probe
node_probe -->|"captures requests"| node_network
node_probe -->|"formats console"| node_serialize
node_cdp -->|"checks bodies"| node_limits
node_network -->|"checks bodies"| node_limits
node_cdp -->|"collects snapshot"| node_device
node_worker -->|"emits event kinds"| node_kinds
node_cdp -->|"normalizes events"| node_kinds
node_inject -->|"normalizes events"| node_kinds
node_recorder -->|"posts batches"| node_wire
node_relay -->|"shares message tags"| node_wire
node_probe -->|"uses message tags"| node_wire
node_worker -->|"builds report"| node_report_builder
node_report_builder -->|"builds manifest"| node_manifest
node_report_builder -->|"embeds renderer"| node_renderer
node_user -.->|"opts into narration"| node_audio_capture
node_worker -.->|"coordinates narration"| node_audio_capture
node_viewer -->|"renders report"| node_renderer
node_viewer -->|"exports HTML"| node_report_builder
node_renderer -.->|"plays narration"| node_audio_view
node_worker -.->|"uses extension APIs"| node_chrome_api
node_cdp -->|"uses debugger"| node_chrome_api
node_inject -->|"captures screenshots"| node_chrome_api

click node_popup "https://github.com/saintpepsi/openjam/blob/main/popup.js"
click node_popup_ui "https://github.com/saintpepsi/openjam/blob/main/openjam-popup.js"
click node_worker "https://github.com/saintpepsi/openjam/blob/main/background.js"
click node_cdp "https://github.com/saintpepsi/openjam/blob/main/src/lanes/cdp.js"
click node_inject "https://github.com/saintpepsi/openjam/blob/main/src/lanes/inject.js"
click node_probe "https://github.com/saintpepsi/openjam/blob/main/src/page-probe.js"
click node_network "https://github.com/saintpepsi/openjam/blob/main/src/page-probe/network.js"
click node_serialize "https://github.com/saintpepsi/openjam/blob/main/src/page-probe/serialize.js"
click node_device "https://github.com/saintpepsi/openjam/blob/main/src/device-info.js"
click node_limits "https://github.com/saintpepsi/openjam/blob/main/src/capture-limits.js"
click node_kinds "https://github.com/saintpepsi/openjam/blob/main/event-kinds.js"
click node_recorder "https://github.com/saintpepsi/openjam/blob/main/src/rrweb-recorder.js"
click node_relay "https://github.com/saintpepsi/openjam/blob/main/src/rrweb-relay.js"
click node_wire "https://github.com/saintpepsi/openjam/blob/main/src/wire.js"
click node_audio_capture "https://github.com/saintpepsi/openjam/blob/main/offscreen.js"
click node_report_builder "https://github.com/saintpepsi/openjam/blob/main/report-builder.js"
click node_manifest "https://github.com/saintpepsi/openjam/blob/main/manifest.js"
click node_viewer "https://github.com/saintpepsi/openjam/blob/main/viewer.js"
click node_renderer "https://github.com/saintpepsi/openjam/blob/main/renderer.js"
click node_audio_view "https://github.com/saintpepsi/openjam/blob/main/audio-sync.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_popup,node_popup_ui,node_worker,node_cdp,node_inject,node_probe,node_network,node_serialize,node_device,node_limits,node_user,node_browser toneBlue
class node_kinds,node_recorder,node_relay,node_wire toneAmber
class node_report_builder,node_manifest,node_chrome_api toneMint
class node_viewer,node_renderer toneRose
class node_audio_capture,node_audio_view toneIndigo
```

## Components

### Capture

- [Extension popup](https://github.com/saintpepsi/openjam/blob/main/popup.js): `popup.js`
- [Popup UI](https://github.com/saintpepsi/openjam/blob/main/openjam-popup.js): `openjam-popup.js`
- [Capture coordinator](https://github.com/saintpepsi/openjam/blob/main/background.js): `background.js`
- [CDP capture lane](https://github.com/saintpepsi/openjam/blob/main/src/lanes/cdp.js): `src/lanes/cdp.js`
- [Inject capture lane](https://github.com/saintpepsi/openjam/blob/main/src/lanes/inject.js): `src/lanes/inject.js`
- [Page probe](https://github.com/saintpepsi/openjam/blob/main/src/page-probe.js): `src/page-probe.js`
- [Fetch/XHR capture](https://github.com/saintpepsi/openjam/blob/main/src/page-probe/network.js): `src/page-probe/network.js`
- [Console serialization](https://github.com/saintpepsi/openjam/blob/main/src/page-probe/serialize.js): `src/page-probe/serialize.js`
- [Device snapshot](https://github.com/saintpepsi/openjam/blob/main/src/device-info.js): `src/device-info.js`
- [Capture limits](https://github.com/saintpepsi/openjam/blob/main/src/capture-limits.js): `src/capture-limits.js`

### Recording

- [Event schema](https://github.com/saintpepsi/openjam/blob/main/event-kinds.js): `event-kinds.js`
- [Session recorder](https://github.com/saintpepsi/openjam/blob/main/src/rrweb-recorder.js): `src/rrweb-recorder.js`
- [Page relay](https://github.com/saintpepsi/openjam/blob/main/src/rrweb-relay.js): `src/rrweb-relay.js`
- [World messaging](https://github.com/saintpepsi/openjam/blob/main/src/wire.js): `src/wire.js`

### Report generation

- [HTML report builder](https://github.com/saintpepsi/openjam/blob/main/report-builder.js): `report-builder.js`
- [AI report manifest](https://github.com/saintpepsi/openjam/blob/main/manifest.js): `manifest.js`

### Report viewing

- [Report viewer](https://github.com/saintpepsi/openjam/blob/main/viewer.js): `viewer.js`
- [Timeline and replay UI](https://github.com/saintpepsi/openjam/blob/main/renderer.js): `renderer.js`

### Audio narration

- [Mic capture](https://github.com/saintpepsi/openjam/blob/main/offscreen.js): `offscreen.js`
- [Narration playback](https://github.com/saintpepsi/openjam/blob/main/audio-sync.js): `audio-sync.js`

### Other components

- **User**
- **Chromium browser**
- **Chrome extension APIs**

## Connections

- User → Extension popup: starts recording (evidence: `README.md`)
- Extension popup → Popup UI: renders controls
- Extension popup → Capture coordinator: requests capture (evidence: `README.md`)
- Capture coordinator → CDP capture lane: selects lane (evidence: `background.js`)
- Capture coordinator → Inject capture lane: selects lane (evidence: `background.js`)
- Inject capture lane → Page probe: injects probe (evidence: `src/lanes/inject.js`)
- Page probe → Fetch/XHR capture: captures requests (evidence: `src/page-probe.js`)
- Page probe → Console serialization: formats console (evidence: `src/page-probe.js`)
- CDP capture lane → Capture limits: checks bodies (evidence: `src/lanes/cdp.js`)
- Fetch/XHR capture → Capture limits: checks bodies (evidence: `src/page-probe/network.js`)
- CDP capture lane → Device snapshot: collects snapshot (evidence: `src/lanes/cdp.js`)
- Capture coordinator → Event schema: emits event kinds (evidence: `background.js`)
- CDP capture lane → Event schema: normalizes events (evidence: `src/lanes/cdp.js`)
- Inject capture lane → Event schema: normalizes events (evidence: `src/lanes/inject.js`)
- Session recorder → World messaging: posts batches (evidence: `src/rrweb-recorder.js`)
- Page relay → World messaging: shares message tags (evidence: `src/rrweb-relay.js`)
- Page probe → World messaging: uses message tags (evidence: `src/page-probe.js`)
- Capture coordinator → HTML report builder: builds report (evidence: `README.md`)
- HTML report builder → AI report manifest: builds manifest (evidence: `report-builder.js`)
- HTML report builder → Timeline and replay UI: embeds renderer (evidence: `report-builder.js`)
- User → Mic capture: opts into narration
- Capture coordinator → Mic capture: coordinates narration
- Report viewer → Timeline and replay UI: renders report (evidence: `viewer.js`)
- Report viewer → HTML report builder: exports HTML (evidence: `viewer.js`)
- Timeline and replay UI → Narration playback: plays narration
- Capture coordinator → Chrome extension APIs: uses extension APIs
- CDP capture lane → Chrome extension APIs: uses debugger (evidence: `README.md`)
- Inject capture lane → Chrome extension APIs: captures screenshots (evidence: `src/lanes/inject.js`)
