# raman-at-pieces/youtube-bookmarker-finished-code architecture

> Architecture diagram of the GitHub repository raman-at-pieces/youtube-bookmarker-finished-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raman-at-pieces/youtube-bookmarker-finished-code
- Repository: https://github.com/raman-at-pieces/youtube-bookmarker-finished-code

## Overview

This is a Chrome extension for bookmarking timestamps in YouTube videos. The workflow is: detect a YouTube watch page, initialize the content script for its video, save timestamped bookmarks, then view, play, or delete them from the popup. The graph also shows the popup’s active-tab lookup and shared synchronized storage. The README is empty; relationships are limited to those supported by the sampled source files.

Main entry points: [`contentScript.js`](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/contentScript.js) (Bookmark controls), [`popup.js`](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/popup.js) (Bookmark popup), [`background.js`](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/background.js) (Watch-page detection), [`utils.js`](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/utils.js) (Active-tab lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_page["Page integration"]
  node_youtube["YouTube page"]
  node_background["Watch-page detection<br/>[background.js]"]
  node_content["Bookmark controls<br/>[contentScript.js]"]
end

subgraph group_popup["Popup experience"]
  node_popup["Bookmark popup<br/>[popup.js]"]
  node_tablookup["Active-tab lookup<br/>[utils.js]"]
end

subgraph group_platform["Browser services"]
  node_tabs["Chrome tabs API"]
  node_storage[("Chrome sync storage")]
end

node_user(("User"))

node_youtube -->|"updates tab"| node_background
node_background -->|"sends NEW"| node_tabs
node_tabs -->|"delivers message"| node_content
node_content -->|"adds controls"| node_youtube
node_user -->|"sets bookmark"| node_content
node_content -->|"reads and writes"| node_storage
node_user -->|"uses controls"| node_popup
node_popup -->|"gets active tab"| node_tablookup
node_tablookup -->|"queries tab"| node_tabs
node_popup -->|"loads bookmarks"| node_storage
node_popup -->|"sends PLAY or DELETE"| node_tabs
node_content -->|"seeks player"| node_youtube
node_content -->|"deletes bookmark"| node_storage

click node_background "https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/background.js"
click node_content "https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/contentScript.js"
click node_popup "https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/popup.js"
click node_tablookup "https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/utils.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_youtube,node_background,node_content,node_user toneBlue
class node_popup,node_tablookup toneAmber
class node_tabs,node_storage toneMint
```

## Components

### Page integration

- **YouTube page**
- [Watch-page detection](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/background.js): `background.js`
- [Bookmark controls](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/contentScript.js): `contentScript.js`

### Popup experience

- [Bookmark popup](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/popup.js): `popup.js`
- [Active-tab lookup](https://github.com/raman-at-pieces/youtube-bookmarker-finished-code/blob/master/utils.js): `utils.js`

### Browser services

- **Chrome tabs API**
- **Chrome sync storage**

### Other components

- **User**

## Connections

- YouTube page → Watch-page detection: updates tab (evidence: `background.js`)
- Watch-page detection → Chrome tabs API: sends NEW (evidence: `background.js`)
- Chrome tabs API → Bookmark controls: delivers message (evidence: `contentScript.js`)
- Bookmark controls → YouTube page: adds controls (evidence: `contentScript.js`)
- User → Bookmark controls: sets bookmark (evidence: `contentScript.js`)
- Bookmark controls → Chrome sync storage: reads and writes (evidence: `contentScript.js`)
- User → Bookmark popup: uses controls (evidence: `popup.js`)
- Bookmark popup → Active-tab lookup: gets active tab (evidence: `popup.js`)
- Active-tab lookup → Chrome tabs API: queries tab (evidence: `utils.js`)
- Bookmark popup → Chrome sync storage: loads bookmarks (evidence: `popup.js`)
- Bookmark popup → Chrome tabs API: sends PLAY or DELETE (evidence: `popup.js`)
- Bookmark controls → YouTube page: seeks player (evidence: `contentScript.js`)
- Bookmark controls → Chrome sync storage: deletes bookmark (evidence: `contentScript.js`)
