# namra7-x/webdiscovery architecture

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

- Interactive diagram: https://gitdiagram.com/namra7-x/webdiscovery
- Repository: https://github.com/namra7-x/webdiscovery

## Overview

DeepScope is a RAM-first Chromium DevTools extension for discovering a site’s browser-visible resources and APIs, searching findings, and analyzing exposures. The main workflow is: capture page and network evidence, extract compact units with provenance, index and analyze them, then browse, search, and open results in their original sources. The panel owns session state; the background relays metadata, and temporary IndexedDB is only an overflow path. README capabilities supplement the partial source excerpts; uncertain internal wiring is omitted.

Main entry points: [`src/panel.ts`](https://github.com/namra7-x/webdiscovery/blob/master/src/panel.ts) (DevTools panel), [`src/background.ts`](https://github.com/namra7-x/webdiscovery/blob/master/src/background.ts) (Metadata relay), [`src/worker-indexer.ts`](https://github.com/namra7-x/webdiscovery/blob/master/src/worker-indexer.ts) (Worker indexing), [`src/search.ts`](https://github.com/namra7-x/webdiscovery/blob/master/src/search.ts) (Fuzzy search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture"]
  node_content["Page observer<br/>[content.ts]"]
  node_background["Metadata relay<br/>[background.ts]"]
  node_cdp["Deep capture<br/>[cdp.ts]"]
end

subgraph group_discovery["Discovery"]
  node_extractors["Resource extraction<br/>[extractors.ts]"]
  node_worker["Worker indexing<br/>[worker-indexer.ts]"]
  node_index["RAM index<br/>[indexer.ts]"]
  node_graph["Discovery graph<br/>[graph.ts]"]
end

subgraph group_analysis["Analysis"]
  node_search["Fuzzy search<br/>[search.ts]"]
  node_normalize["Normalization<br/>[normalize.ts]"]
  node_fuzzy["Fuzzy matcher<br/>[fuzzy.ts]"]
  node_rules["Secret scanning<br/>[rules.ts]"]
  node_exposure["Exposure analysis<br/>[exposure.ts]"]
end

subgraph group_session["Session"]
  node_ledger["Memory budgets<br/>[memory.ts]"]
  node_idb[("Session overflow<br/>[idb.ts]")]
end

subgraph group_interface["Interface"]
  node_panel["DevTools panel<br/>[panel.ts]"]
  node_popup["Extension popup<br/>[popup.ts]"]
end

node_user(("Engineer"))
node_site(("Inspected site"))
node_chrome["Chromium APIs"]

node_user -->|"opens"| node_panel
node_user -->|"inspects"| node_site
node_panel -->|"uses capture APIs"| node_chrome
node_panel -->|"snapshots page"| node_site
node_site -->|"DOM changes"| node_content
node_content -->|"sends batches"| node_background
node_background -->|"relays metadata"| node_panel
node_background -->|"observes requests"| node_chrome
node_panel -->|"controls capture"| node_background
node_chrome -.->|"dispatches CDP events"| node_background
node_background -.->|"forwards CDP data"| node_panel
node_panel -->|"submits resources"| node_worker
node_worker -->|"extracts units"| node_extractors
node_worker -->|"scans units"| node_rules
node_worker -->|"returns units"| node_panel
node_panel -->|"indexes findings"| node_index
node_panel -->|"records relationships"| node_graph
node_panel -->|"accounts session"| node_ledger
node_panel -.->|"stores overflow bodies"| node_idb
node_panel -->|"queries index"| node_search
node_search -->|"retrieves candidates"| node_index
node_search -->|"normalizes text"| node_normalize
node_search -->|"ranks candidates"| node_fuzzy
node_panel -->|"classifies findings"| node_exposure
node_panel -->|"renders results"| node_user
node_panel -->|"opens source location"| node_chrome
node_user -->|"opens"| node_popup
node_popup -->|"requests extension actions"| node_chrome

click node_panel "https://github.com/namra7-x/webdiscovery/blob/master/src/panel.ts"
click node_content "https://github.com/namra7-x/webdiscovery/blob/master/src/content.ts"
click node_background "https://github.com/namra7-x/webdiscovery/blob/master/src/background.ts"
click node_cdp "https://github.com/namra7-x/webdiscovery/blob/master/src/cdp.ts"
click node_extractors "https://github.com/namra7-x/webdiscovery/blob/master/src/extractors.ts"
click node_worker "https://github.com/namra7-x/webdiscovery/blob/master/src/worker-indexer.ts"
click node_index "https://github.com/namra7-x/webdiscovery/blob/master/src/indexer.ts"
click node_graph "https://github.com/namra7-x/webdiscovery/blob/master/src/graph.ts"
click node_search "https://github.com/namra7-x/webdiscovery/blob/master/src/search.ts"
click node_normalize "https://github.com/namra7-x/webdiscovery/blob/master/src/normalize.ts"
click node_fuzzy "https://github.com/namra7-x/webdiscovery/blob/master/src/fuzzy.ts"
click node_rules "https://github.com/namra7-x/webdiscovery/blob/master/src/rules.ts"
click node_exposure "https://github.com/namra7-x/webdiscovery/blob/master/src/exposure.ts"
click node_ledger "https://github.com/namra7-x/webdiscovery/blob/master/src/memory.ts"
click node_idb "https://github.com/namra7-x/webdiscovery/blob/master/src/idb.ts"
click node_popup "https://github.com/namra7-x/webdiscovery/blob/master/src/popup.ts"

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_content,node_background,node_cdp toneBlue
class node_extractors,node_worker,node_index,node_graph toneAmber
class node_search,node_normalize,node_fuzzy,node_rules,node_exposure,node_chrome toneMint
class node_ledger,node_idb toneRose
class node_panel,node_popup,node_user,node_site toneIndigo
```

## Components

### Capture

- [Page observer](https://github.com/namra7-x/webdiscovery/blob/master/src/content.ts): `src/content.ts`
- [Metadata relay](https://github.com/namra7-x/webdiscovery/blob/master/src/background.ts): `src/background.ts`
- [Deep capture](https://github.com/namra7-x/webdiscovery/blob/master/src/cdp.ts): `src/cdp.ts`

### Discovery

- [Resource extraction](https://github.com/namra7-x/webdiscovery/blob/master/src/extractors.ts): `src/extractors.ts`
- [Worker indexing](https://github.com/namra7-x/webdiscovery/blob/master/src/worker-indexer.ts): `src/worker-indexer.ts`
- [RAM index](https://github.com/namra7-x/webdiscovery/blob/master/src/indexer.ts): `src/indexer.ts`
- [Discovery graph](https://github.com/namra7-x/webdiscovery/blob/master/src/graph.ts): `src/graph.ts`

### Analysis

- [Fuzzy search](https://github.com/namra7-x/webdiscovery/blob/master/src/search.ts): `src/search.ts`
- [Normalization](https://github.com/namra7-x/webdiscovery/blob/master/src/normalize.ts): `src/normalize.ts`
- [Fuzzy matcher](https://github.com/namra7-x/webdiscovery/blob/master/src/fuzzy.ts): `src/fuzzy.ts`
- [Secret scanning](https://github.com/namra7-x/webdiscovery/blob/master/src/rules.ts): `src/rules.ts`
- [Exposure analysis](https://github.com/namra7-x/webdiscovery/blob/master/src/exposure.ts): `src/exposure.ts`

### Session

- [Memory budgets](https://github.com/namra7-x/webdiscovery/blob/master/src/memory.ts): `src/memory.ts`
- [Session overflow](https://github.com/namra7-x/webdiscovery/blob/master/src/idb.ts): `src/idb.ts`

### Interface

- [DevTools panel](https://github.com/namra7-x/webdiscovery/blob/master/src/panel.ts): `src/panel.ts`
- [Extension popup](https://github.com/namra7-x/webdiscovery/blob/master/src/popup.ts): `src/popup.ts`

### Other components

- **Engineer**
- **Inspected site**
- **Chromium APIs**

## Connections

- Engineer → DevTools panel: opens
- Engineer → Inspected site: inspects
- DevTools panel → Chromium APIs: uses capture APIs
- DevTools panel → Inspected site: snapshots page
- Inspected site → Page observer: DOM changes
- Page observer → Metadata relay: sends batches
- Metadata relay → DevTools panel: relays metadata
- Metadata relay → Chromium APIs: observes requests
- DevTools panel → Metadata relay: controls capture
- Chromium APIs → Metadata relay: dispatches CDP events
- Metadata relay → DevTools panel: forwards CDP data
- DevTools panel → Worker indexing: submits resources
- Worker indexing → Resource extraction: extracts units
- Worker indexing → Secret scanning: scans units
- Worker indexing → DevTools panel: returns units
- DevTools panel → RAM index: indexes findings
- DevTools panel → Discovery graph: records relationships
- DevTools panel → Memory budgets: accounts session
- DevTools panel → Session overflow: stores overflow bodies
- DevTools panel → Fuzzy search: queries index
- Fuzzy search → RAM index: retrieves candidates
- Fuzzy search → Normalization: normalizes text
- Fuzzy search → Fuzzy matcher: ranks candidates
- DevTools panel → Exposure analysis: classifies findings
- DevTools panel → Engineer: renders results
- DevTools panel → Chromium APIs: opens source location
- Engineer → Extension popup: opens
- Extension popup → Chromium APIs: requests extension actions
