# yetone/rewind-for-x architecture

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

- Interactive diagram: https://gitdiagram.com/yetone/rewind-for-x
- Repository: https://github.com/yetone/rewind-for-x

## Overview

Rewind for X is a Chrome extension for saving posts a user has actually seen on X’s home timeline and finding them later. The main workflow observes and extracts eligible posts, retains them locally, then presents them in a searchable, filterable drawer. Optional local OCR adds recognized image text to search. The graph also includes the documented toolbar entry point and website hosting. Some content-script internals are unsampled, so those connections rely on README descriptions rather than inferred call chains.

Main entry points: [`ocr/offscreen.js`](https://github.com/yetone/rewind-for-x/blob/main/ocr/offscreen.js) (Recognition page), [`content.js`](https://github.com/yetone/rewind-for-x/blob/main/content.js) (Recall drawer), [`background.js`](https://github.com/yetone/rewind-for-x/blob/main/background.js) (OCR orchestration), [`site-worker/index.js`](https://github.com/yetone/rewind-for-x/blob/main/site-worker/index.js) (Site request handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Timeline capture"]
  node_capture["Post observation<br/>[content.js]"]
  node_extract["Post extraction<br/>[content.js]"]
  node_localdata[("Local extension data")]
  node_entry["Toolbar shortcut<br/>[background.js]"]
end

subgraph group_recall["Recall interface"]
  node_drawer["Recall drawer<br/>[content.js]"]
  node_search["Search and filters<br/>[content.js]"]
  node_ocrtoggle["OCR controls<br/>[content.js]"]
end

subgraph group_ocr["Image text OCR"]
  node_ocrworker["OCR orchestration<br/>[background.js]"]
  node_offscreen["Recognition page<br/>[offscreen.js]"]
  node_tesseract["Tesseract core"]
  node_idb[("Language cache<br/>[offscreen.js]")]
end

subgraph group_web["Public website"]
  node_website["Static website"]
  node_worker["Site request handler<br/>[index.js]"]
end

node_user(("Extension user"))
node_xhome["X home timeline"]
node_langcdn["Language data CDN"]
node_assets["Static asset service"]

node_user -->|"views timeline"| node_xhome
node_xhome -->|"shows posts"| node_capture
node_capture -->|"extracts eligible posts"| node_extract
node_extract -->|"saves posts"| node_localdata
node_user -->|"opens drawer"| node_entry
node_entry -->|"toggles on X tab"| node_drawer
node_user -->|"opens in page"| node_drawer
node_localdata -->|"loads saved posts"| node_drawer
node_drawer -->|"offers query and filters"| node_search
node_search -->|"searches saved and OCR text"| node_localdata
node_user -->|"enables recognition"| node_ocrtoggle
node_ocrtoggle -->|"sets OCR preference"| node_ocrworker
node_ocrworker -->|"reads posts and stores text"| node_localdata
node_ocrworker -->|"sends image request"| node_offscreen
node_offscreen -->|"recognizes image"| node_tesseract
node_offscreen -->|"downloads language data"| node_langcdn
node_offscreen -->|"caches language data"| node_idb
node_user -->|"visits product site"| node_website
node_worker -->|"serves static resources"| node_assets

click node_capture "https://github.com/yetone/rewind-for-x/blob/main/content.js"
click node_extract "https://github.com/yetone/rewind-for-x/blob/main/content.js"
click node_entry "https://github.com/yetone/rewind-for-x/blob/main/background.js"
click node_drawer "https://github.com/yetone/rewind-for-x/blob/main/content.js"
click node_search "https://github.com/yetone/rewind-for-x/blob/main/content.js"
click node_ocrtoggle "https://github.com/yetone/rewind-for-x/blob/main/content.js"
click node_ocrworker "https://github.com/yetone/rewind-for-x/blob/main/background.js"
click node_offscreen "https://github.com/yetone/rewind-for-x/blob/main/ocr/offscreen.js"
click node_tesseract "https://github.com/yetone/rewind-for-x/blob/main/ocr/tesseract-core-simd-lstm.js"
click node_idb "https://github.com/yetone/rewind-for-x/blob/main/ocr/offscreen.js"
click node_website "https://github.com/yetone/rewind-for-x/tree/main/site"
click node_worker "https://github.com/yetone/rewind-for-x/blob/main/site-worker/index.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_capture,node_extract,node_localdata,node_entry,node_user toneBlue
class node_drawer,node_search,node_ocrtoggle toneAmber
class node_ocrworker,node_offscreen,node_tesseract,node_idb toneMint
class node_website,node_worker toneRose
class node_xhome,node_langcdn,node_assets toneIndigo
```

## Components

### Timeline capture

- [Post observation](https://github.com/yetone/rewind-for-x/blob/main/content.js): `content.js`
- [Post extraction](https://github.com/yetone/rewind-for-x/blob/main/content.js): `content.js`
- **Local extension data**
- [Toolbar shortcut](https://github.com/yetone/rewind-for-x/blob/main/background.js): `background.js`

### Recall interface

- [Recall drawer](https://github.com/yetone/rewind-for-x/blob/main/content.js): `content.js`
- [Search and filters](https://github.com/yetone/rewind-for-x/blob/main/content.js): `content.js`
- [OCR controls](https://github.com/yetone/rewind-for-x/blob/main/content.js): `content.js`

### Image text OCR

- [OCR orchestration](https://github.com/yetone/rewind-for-x/blob/main/background.js): `background.js`
- [Recognition page](https://github.com/yetone/rewind-for-x/blob/main/ocr/offscreen.js): `ocr/offscreen.js`
- [Tesseract core](https://github.com/yetone/rewind-for-x/blob/main/ocr/tesseract-core-simd-lstm.js): `ocr/tesseract-core-simd-lstm.js`
- [Language cache](https://github.com/yetone/rewind-for-x/blob/main/ocr/offscreen.js): `ocr/offscreen.js`

### Public website

- [Static website](https://github.com/yetone/rewind-for-x/tree/main/site): `site`
- [Site request handler](https://github.com/yetone/rewind-for-x/blob/main/site-worker/index.js): `site-worker/index.js`

### Other components

- **Extension user**
- **X home timeline**
- **Language data CDN**
- **Static asset service**

## Connections

- Extension user → X home timeline: views timeline (evidence: `README.md`)
- X home timeline → Post observation: shows posts (evidence: `README.md`)
- Post observation → Post extraction: extracts eligible posts (evidence: `README.md`)
- Post extraction → Local extension data: saves posts (evidence: `README.md`)
- Extension user → Toolbar shortcut: opens drawer (evidence: `README.md`)
- Toolbar shortcut → Recall drawer: toggles on X tab (evidence: `background.js`)
- Extension user → Recall drawer: opens in page (evidence: `README.md`)
- Local extension data → Recall drawer: loads saved posts (evidence: `content.js`)
- Recall drawer → Search and filters: offers query and filters (evidence: `README.md`)
- Search and filters → Local extension data: searches saved and OCR text (evidence: `README.md`)
- Extension user → OCR controls: enables recognition (evidence: `README.md`)
- OCR controls → OCR orchestration: sets OCR preference (evidence: `README.md`)
- OCR orchestration → Local extension data: reads posts and stores text (evidence: `background.js`)
- OCR orchestration → Recognition page: sends image request (evidence: `background.js`)
- Recognition page → Tesseract core: recognizes image (evidence: `ocr/offscreen.js`)
- Recognition page → Language data CDN: downloads language data (evidence: `ocr/offscreen.js`)
- Recognition page → Language cache: caches language data (evidence: `ocr/offscreen.js`)
- Extension user → Static website: visits product site (evidence: `README.md`)
- Site request handler → Static asset service: serves static resources (evidence: `site-worker/index.js`)
