# qexorium/tubecraft architecture

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

- Interactive diagram: https://gitdiagram.com/qexorium/tubecraft
- Repository: https://github.com/qexorium/tubecraft

## Overview

TubeCraft is a YouTube browser extension for customizing the player and hiding distractions. The main workflow is that a viewer changes preferences in the popup, those preferences are saved in Chrome sync storage, and the YouTube content script applies them to the page. First-run setup opens a welcome page for language selection; the popup and welcome page share the translation module. The README documents broader visual and focus features, though their styling implementation was not sampled. The content-to-styles relationship is therefore shown as unverified.

Main entry points: [`welcome.js`](https://github.com/qexorium/tubecraft/blob/main/welcome.js) (Welcome page), [`popup.js`](https://github.com/qexorium/tubecraft/blob/main/popup.js) (Settings popup), [`i18n.js`](https://github.com/qexorium/tubecraft/blob/main/i18n.js) (Translations), [`content.js`](https://github.com/qexorium/tubecraft/blob/main/content.js) (Page settings controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and language"]
  node_background["Install handler<br/>[background.js]"]
  node_welcome["Welcome page<br/>[welcome.js]"]
  node_welcomeui["Welcome interface<br/>[welcome.html]"]
end

subgraph group_settings["Preferences"]
  node_popup["Settings popup<br/>[popup.js]"]
  node_i18n["Translations<br/>[i18n.js]"]
  node_popupui["Popup interface<br/>[popup.html]"]
end

subgraph group_youtube["YouTube experience"]
  node_content["Page settings controller<br/>[content.js]"]
  node_player["Player styling and effects<br/>[styles.css]"]
end

subgraph group_platform["Browser platform"]
  node_sync[("Sync settings")]
end

node_viewer(("Viewer"))
node_install(("Extension installation"))
node_youtube(("YouTube"))

node_install -->|"installs extension"| node_background
node_background -->|"opens on install"| node_welcome
node_viewer -->|"opens settings"| node_popup
node_viewer -->|"chooses language"| node_welcome
node_popup -.->|"uses interface"| node_popupui
node_welcome -.->|"uses interface"| node_welcomeui
node_popup -->|"initializes language"| node_i18n
node_welcome -->|"initializes language"| node_i18n
node_popup -->|"reads and writes"| node_sync
node_i18n -->|"reads and writes language"| node_sync
node_sync -->|"provides preferences"| node_content
node_youtube -.->|"hosts page controller"| node_content
node_content -.->|"applies visual classes"| node_player
node_welcome -->|"launches site"| node_youtube

click node_background "https://github.com/qexorium/tubecraft/blob/main/background.js"
click node_welcome "https://github.com/qexorium/tubecraft/blob/main/welcome.js"
click node_popup "https://github.com/qexorium/tubecraft/blob/main/popup.js"
click node_i18n "https://github.com/qexorium/tubecraft/blob/main/i18n.js"
click node_content "https://github.com/qexorium/tubecraft/blob/main/content.js"
click node_player "https://github.com/qexorium/tubecraft/blob/main/styles.css"
click node_popupui "https://github.com/qexorium/tubecraft/blob/main/popup.html"
click node_welcomeui "https://github.com/qexorium/tubecraft/blob/main/welcome.html"

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_background,node_welcome,node_welcomeui,node_viewer toneBlue
class node_popup,node_i18n,node_popupui toneAmber
class node_content,node_player toneMint
class node_sync toneRose
class node_install,node_youtube toneIndigo
```

## Components

### Setup and language

- [Install handler](https://github.com/qexorium/tubecraft/blob/main/background.js): `background.js`
- [Welcome page](https://github.com/qexorium/tubecraft/blob/main/welcome.js): `welcome.js`
- [Welcome interface](https://github.com/qexorium/tubecraft/blob/main/welcome.html): `welcome.html`

### Preferences

- [Settings popup](https://github.com/qexorium/tubecraft/blob/main/popup.js): `popup.js`
- [Translations](https://github.com/qexorium/tubecraft/blob/main/i18n.js): `i18n.js`
- [Popup interface](https://github.com/qexorium/tubecraft/blob/main/popup.html): `popup.html`

### YouTube experience

- [Page settings controller](https://github.com/qexorium/tubecraft/blob/main/content.js): `content.js`
- [Player styling and effects](https://github.com/qexorium/tubecraft/blob/main/styles.css): `styles.css`

### Browser platform

- **Sync settings**

### Other components

- **Viewer**
- **Extension installation**
- **YouTube**

## Connections

- Extension installation → Install handler: installs extension (evidence: `background.js`)
- Install handler → Welcome page: opens on install (evidence: `background.js`)
- Viewer → Settings popup: opens settings (evidence: `README.md`)
- Viewer → Welcome page: chooses language (evidence: `welcome.js`)
- Settings popup → Popup interface: uses interface
- Welcome page → Welcome interface: uses interface
- Settings popup → Translations: initializes language (evidence: `popup.js`)
- Welcome page → Translations: initializes language (evidence: `welcome.js`)
- Settings popup → Sync settings: reads and writes (evidence: `popup.js`)
- Translations → Sync settings: reads and writes language (evidence: `i18n.js`)
- Sync settings → Page settings controller: provides preferences (evidence: `content.js`)
- YouTube → Page settings controller: hosts page controller
- Page settings controller → Player styling and effects: applies visual classes
- Welcome page → YouTube: launches site (evidence: `welcome.js`)
