# vmatheus3/bug-frame architecture

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

- Interactive diagram: https://gitdiagram.com/vmatheus3/bug-frame
- Repository: https://github.com/vmatheus3/bug-frame

## Overview

Bugframe is a browser-based issue-reporting widget with a server API and CLI for managing reports. A tester enables the widget, captures and describes a page region, and sends screenshots plus browser context; the server authorizes and stores the report. Owners or agents can review reports, export a page-grouped worklist, close or reopen reports, or import ZIPs created in download mode. Edges reflect excerpts, SOURCE INDEX references, or README-documented behavior; unsampled implementation details are not inferred.

Main entry points: [`src/server/handler.mjs`](https://github.com/vmatheus3/bug-frame/blob/main/src/server/handler.mjs) (Report API), [`src/widget/index.ts`](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/index.ts) (Widget workflow), [`src/cli/bin.mjs`](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/bin.mjs) (CLI commands), [`src/cli/commands.mjs`](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/commands.mjs) (Report operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Browser reporting"]
  node_widget["Widget workflow<br/>[index.ts]"]
  node_capture["Screenshot capture<br/>[capture.ts]"]
  node_context["Page context<br/>[context.ts]"]
  node_widget_api["Widget API<br/>[api.ts]"]
  node_download_zip["ZIP download<br/>[zip.ts]"]
end

subgraph group_server["Report server"]
  node_server_handler["Report API<br/>[handler.mjs]"]
  node_auth["Session authorization<br/>[handler.mjs]"]
  node_server_util["Validation and context<br/>[util.mjs]"]
  node_storage[("Report storage<br/>[storage-fs.mjs]")]
  node_adapters["HTTP adapters<br/>[node.mjs]"]
end

subgraph group_management["Report management"]
  node_cli["CLI commands<br/>[bin.mjs]"]
  node_report_commands["Report operations<br/>[commands.mjs]"]
  node_worklist["Worklist export<br/>[worklist.mjs]"]
  node_zip_import["ZIP import<br/>[zip-read.mjs]"]
end

node_tester(("Tester"))
node_owner(("Owner or agent"))

node_tester -->|"uses"| node_widget
node_widget -->|"captures"| node_capture
node_widget -->|"builds context"| node_context
node_widget -->|"sends reports"| node_widget_api
node_widget -->|"creates ZIP"| node_download_zip
node_widget_api -->|"requests API"| node_server_handler
node_widget -->|"shows report status"| node_server_handler
node_server_handler -->|"checks access"| node_auth
node_server_handler -->|"validates data"| node_server_util
node_server_handler -->|"stores reports"| node_storage
node_adapters -->|"dispatches requests"| node_server_handler
node_owner -->|"manages reports"| node_cli
node_cli -->|"dispatches commands"| node_report_commands
node_cli -->|"starts server"| node_server_handler
node_cli -->|"serves HTTP"| node_adapters
node_report_commands -->|"reads and updates"| node_storage
node_report_commands -->|"builds export"| node_worklist
node_report_commands -->|"reads ZIP entries"| node_zip_import
node_owner -->|"uses exported worklist"| node_worklist
node_tester -->|"receives report ZIP"| node_download_zip
node_cli -->|"imports ZIP"| node_report_commands

click node_widget "https://github.com/vmatheus3/bug-frame/blob/main/src/widget/index.ts"
click node_capture "https://github.com/vmatheus3/bug-frame/blob/main/src/widget/capture.ts"
click node_context "https://github.com/vmatheus3/bug-frame/blob/main/src/widget/context.ts"
click node_widget_api "https://github.com/vmatheus3/bug-frame/blob/main/src/widget/api.ts"
click node_download_zip "https://github.com/vmatheus3/bug-frame/blob/main/src/widget/zip.ts"
click node_server_handler "https://github.com/vmatheus3/bug-frame/blob/main/src/server/handler.mjs"
click node_auth "https://github.com/vmatheus3/bug-frame/blob/main/src/server/handler.mjs"
click node_server_util "https://github.com/vmatheus3/bug-frame/blob/main/src/server/util.mjs"
click node_storage "https://github.com/vmatheus3/bug-frame/blob/main/src/server/storage-fs.mjs"
click node_adapters "https://github.com/vmatheus3/bug-frame/blob/main/src/server/node.mjs"
click node_cli "https://github.com/vmatheus3/bug-frame/blob/main/src/cli/bin.mjs"
click node_report_commands "https://github.com/vmatheus3/bug-frame/blob/main/src/cli/commands.mjs"
click node_worklist "https://github.com/vmatheus3/bug-frame/blob/main/src/cli/worklist.mjs"
click node_zip_import "https://github.com/vmatheus3/bug-frame/blob/main/src/cli/zip-read.mjs"

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_widget,node_capture,node_context,node_widget_api,node_download_zip toneBlue
class node_server_handler,node_auth,node_server_util,node_storage,node_adapters toneAmber
class node_cli,node_report_commands,node_worklist,node_zip_import toneMint
class node_tester,node_owner toneIndigo
```

## Components

### Browser reporting

- [Widget workflow](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/index.ts): `src/widget/index.ts`
- [Screenshot capture](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/capture.ts): `src/widget/capture.ts`
- [Page context](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/context.ts): `src/widget/context.ts`
- [Widget API](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/api.ts): `src/widget/api.ts`
- [ZIP download](https://github.com/vmatheus3/bug-frame/blob/main/src/widget/zip.ts): `src/widget/zip.ts`

### Report server

- [Report API](https://github.com/vmatheus3/bug-frame/blob/main/src/server/handler.mjs): `src/server/handler.mjs`
- [Session authorization](https://github.com/vmatheus3/bug-frame/blob/main/src/server/handler.mjs): `src/server/handler.mjs`
- [Validation and context](https://github.com/vmatheus3/bug-frame/blob/main/src/server/util.mjs): `src/server/util.mjs`
- [Report storage](https://github.com/vmatheus3/bug-frame/blob/main/src/server/storage-fs.mjs): `src/server/storage-fs.mjs`
- [HTTP adapters](https://github.com/vmatheus3/bug-frame/blob/main/src/server/node.mjs): `src/server/node.mjs`

### Report management

- [CLI commands](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/bin.mjs): `src/cli/bin.mjs`
- [Report operations](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/commands.mjs): `src/cli/commands.mjs`
- [Worklist export](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/worklist.mjs): `src/cli/worklist.mjs`
- [ZIP import](https://github.com/vmatheus3/bug-frame/blob/main/src/cli/zip-read.mjs): `src/cli/zip-read.mjs`

### Other components

- **Tester**
- **Owner or agent**

## Connections

- Tester → Widget workflow: uses (evidence: `README.md`)
- Widget workflow → Screenshot capture: captures (evidence: `src/widget/index.ts`)
- Widget workflow → Page context: builds context (evidence: `src/widget/index.ts`)
- Widget workflow → Widget API: sends reports (evidence: `src/widget/index.ts`)
- Widget workflow → ZIP download: creates ZIP (evidence: `src/widget/index.ts`)
- Widget API → Report API: requests API (evidence: `README.md`)
- Widget workflow → Report API: shows report status (evidence: `README.md`)
- Report API → Session authorization: checks access (evidence: `README.md`)
- Report API → Validation and context: validates data (evidence: `src/server/handler.mjs`)
- Report API → Report storage: stores reports (evidence: `src/server/handler.mjs`)
- HTTP adapters → Report API: dispatches requests (evidence: `src/server/node.mjs`)
- Owner or agent → CLI commands: manages reports (evidence: `README.md`)
- CLI commands → Report operations: dispatches commands (evidence: `src/cli/bin.mjs`)
- CLI commands → Report API: starts server (evidence: `src/cli/bin.mjs`)
- CLI commands → HTTP adapters: serves HTTP (evidence: `src/cli/bin.mjs`)
- Report operations → Report storage: reads and updates (evidence: `src/cli/commands.mjs`)
- Report operations → Worklist export: builds export (evidence: `src/cli/commands.mjs`)
- Report operations → ZIP import: reads ZIP entries (evidence: `src/cli/commands.mjs`)
- Owner or agent → Worklist export: uses exported worklist (evidence: `README.md`)
- Tester → ZIP download: receives report ZIP (evidence: `README.md`)
- CLI commands → Report operations: imports ZIP (evidence: `src/cli/bin.mjs`)
