# scorpio-meow/threads-embedded-code architecture

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

- Interactive diagram: https://gitdiagram.com/scorpio-meow/threads-embedded-code
- Repository: https://github.com/scorpio-meow/threads-embedded-code

## Overview

Threads Code Saver is a Chromium extension for capturing embedded Threads posts, keeping structured records locally, and managing or exporting them through popup and dashboard interfaces. The main workflow begins on a Threads post, where the content script detects an embed dialog, extracts and cleans post data, and saves it. The README also documents dashboard preview and background refresh, plus search, filtering, batch management, import, and export. Source excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`dashboard.js`](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js) (Dashboard), [`content.js`](https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js) (Embed detection), [`popup.js`](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js) (Quick panel), [`popup.html`](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.html) (Popup interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and extraction"]
  node_content["Embed detection<br/>[content.js]"]
  node_extract["Post extraction<br/>[content.js]"]
  node_clean["Text cleaning<br/>[content.js]"]
end

subgraph group_storage["Local persistence"]
  node_records[("Saved articles")]
end

subgraph group_interfaces["User interfaces"]
  node_popup["Quick panel<br/>[popup.js]"]
  node_popupui["Popup interface<br/>[popup.html]"]
  node_dashboard["Dashboard<br/>[dashboard.js]"]
  node_dashboardui["Dashboard interface<br/>[dashboard.html]"]
end

subgraph group_operations["Management and outputs"]
  node_search["Search and filters<br/>[popup.js]"]
  node_batch["Batch management<br/>[dashboard.js]"]
  node_sync["Post refresh<br/>[dashboard.js]"]
  node_preview["Embed preview<br/>[dashboard.js]"]
  node_transfer["Import and export<br/>[dashboard.js]"]
  node_popuptransfer["Popup transfer<br/>[popup.js]"]
end

node_user(("Reader"))
node_threads["Threads page"]
node_browser["Browser APIs"]

node_user -->|"views posts"| node_threads
node_threads -->|"opens embed dialog"| node_content
node_content -->|"detects dialog"| node_extract
node_extract -->|"cleans extracted text"| node_clean
node_content -->|"saves article"| node_records
node_content -->|"uses storage API"| node_browser
node_user -->|"opens panel"| node_popupui
node_popupui -->|"hosts"| node_popup
node_popup -->|"reads and writes"| node_records
node_popup -->|"filters and sorts"| node_search
node_user -->|"opens dashboard"| node_dashboardui
node_dashboardui -->|"hosts"| node_dashboard
node_dashboard -->|"reads and writes"| node_records
node_dashboard -->|"manages selection"| node_batch
node_dashboard -->|"starts refresh"| node_sync
node_sync -->|"creates worker tab"| node_browser
node_sync -.->|"loads post pages"| node_threads
node_dashboard -->|"opens preview"| node_preview
node_preview -.->|"loads official embed"| node_threads
node_dashboard -->|"imports and exports"| node_transfer
node_popup -->|"imports and exports"| node_popuptransfer

click node_content "https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js"
click node_extract "https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js"
click node_clean "https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js"
click node_popup "https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js"
click node_popupui "https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.html"
click node_dashboard "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js"
click node_dashboardui "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.html"
click node_search "https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js"
click node_batch "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js"
click node_sync "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js"
click node_preview "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js"
click node_transfer "https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js"
click node_popuptransfer "https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.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_content,node_extract,node_clean,node_browser toneBlue
class node_records toneAmber
class node_popup,node_popupui,node_dashboard,node_dashboardui toneMint
class node_search,node_batch,node_sync,node_preview,node_transfer,node_popuptransfer toneRose
class node_user,node_threads toneIndigo
```

## Components

### Capture and extraction

- [Embed detection](https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js): `content.js`
- [Post extraction](https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js): `content.js`
- [Text cleaning](https://github.com/scorpio-meow/threads-embedded-code/blob/main/content.js): `content.js`

### Local persistence

- **Saved articles**

### User interfaces

- [Quick panel](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js): `popup.js`
- [Popup interface](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.html): `popup.html`
- [Dashboard](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js): `dashboard.js`
- [Dashboard interface](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.html): `dashboard.html`

### Management and outputs

- [Search and filters](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js): `popup.js`
- [Batch management](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js): `dashboard.js`
- [Post refresh](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js): `dashboard.js`
- [Embed preview](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js): `dashboard.js`
- [Import and export](https://github.com/scorpio-meow/threads-embedded-code/blob/main/dashboard.js): `dashboard.js`
- [Popup transfer](https://github.com/scorpio-meow/threads-embedded-code/blob/main/popup.js): `popup.js`

### Other components

- **Reader**
- **Threads page**
- **Browser APIs**

## Connections

- Reader → Threads page: views posts
- Threads page → Embed detection: opens embed dialog
- Embed detection → Post extraction: detects dialog
- Post extraction → Text cleaning: cleans extracted text
- Embed detection → Saved articles: saves article
- Embed detection → Browser APIs: uses storage API
- Reader → Popup interface: opens panel
- Popup interface → Quick panel: hosts
- Quick panel → Saved articles: reads and writes
- Quick panel → Search and filters: filters and sorts
- Reader → Dashboard interface: opens dashboard
- Dashboard interface → Dashboard: hosts
- Dashboard → Saved articles: reads and writes
- Dashboard → Batch management: manages selection
- Dashboard → Post refresh: starts refresh
- Post refresh → Browser APIs: creates worker tab
- Post refresh → Threads page: loads post pages
- Dashboard → Embed preview: opens preview
- Embed preview → Threads page: loads official embed
- Dashboard → Import and export: imports and exports
- Quick panel → Popup transfer: imports and exports
