# anzouk/surroundflix architecture

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

- Interactive diagram: https://gitdiagram.com/anzouk/surroundflix
- Repository: https://github.com/anzouk/surroundflix

## Overview

Surroundflix is a browser extension/userscript that changes Netflix’s advertised playback profiles and stream choices, then surfaces the resulting audio/video details through a toolbar popup and badges. Its companion macOS app guides Safari setup and checks for updates. The principal path is user preferences → Netflix request-profile modification → selected playback streams → reported status and title badges. The README documents several runtime capabilities not fully represented in the sampled source; links for those rely on that documentation rather than unsampled implementation details.

Main entry points: [`src/surroundflix/templates/page.js`](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/page.js) (Request hook), [`src/surroundflix/templates/popup.js`](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js) (Toolbar popup), [`src/surroundflix/templates/app/Script.js`](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/app/Script.js) (App window), [`src/surroundflix/templates/content.js`](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/content.js) (Content bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_player["Netflix playback"]
  node_netflix["Netflix player"]
  node_pagehook["Request hook<br/>[page.js]"]
  node_profiles["Playback profiles<br/>[profiles.py]"]
  node_badgeui["Title badges<br/>[page.js]"]
end

subgraph group_extension["Browser extension"]
  node_content["Content bridge<br/>[content.js]"]
  node_background["Toolbar state<br/>[background.js]"]
  node_extensionstore[("Extension settings<br/>[popup.js]")]
end

subgraph group_interface["User interface"]
  node_popup["Toolbar popup<br/>[popup.js]"]
  node_shared["Shared interface logic<br/>[shared.js]"]
  node_history[("Watch history<br/>[popup.js]")]
end

subgraph group_companion["macOS companion"]
  node_app["App window<br/>[Script.js]"]
  node_appview["App view<br/>[Main.html]"]
  node_translations["Translations<br/>[i18n.json]"]
end

node_user(("Viewer"))
node_github["GitHub releases"]
node_browser["Safari or Chrome"]

node_user -->|"chooses settings"| node_popup
node_popup -->|"stores preferences"| node_extensionstore
node_popup -->|"uses shared logic"| node_shared
node_content -->|"bridges page state"| node_pagehook
node_pagehook -.->|"uses profile choices"| node_profiles
node_pagehook -->|"alters playback request"| node_netflix
node_netflix -->|"provides playback status"| node_pagehook
node_pagehook -->|"adds title badges"| node_badgeui
node_content -->|"relays tab status"| node_popup
node_background -.->|"sets toolbar badge"| node_browser
node_popup -->|"records recent titles"| node_history
node_user -->|"opens companion"| node_app
node_app -->|"drives app view"| node_appview
node_app -->|"selects language"| node_translations
node_app -->|"checks releases"| node_github
node_browser -->|"plays titles"| node_netflix

click node_pagehook "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/page.js"
click node_profiles "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/profiles.py"
click node_badgeui "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/page.js"
click node_content "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/content.js"
click node_background "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/background.js"
click node_popup "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js"
click node_shared "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/shared.js"
click node_extensionstore "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js"
click node_history "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js"
click node_app "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/app/Script.js"
click node_appview "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/app/Main.html"
click node_translations "https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/i18n.json"

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_netflix,node_pagehook,node_profiles,node_badgeui,node_user toneBlue
class node_content,node_background,node_extensionstore toneAmber
class node_popup,node_shared,node_history toneMint
class node_app,node_appview,node_translations toneRose
class node_github,node_browser toneIndigo
```

## Components

### Netflix playback

- **Netflix player**
- [Request hook](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/page.js): `src/surroundflix/templates/page.js`
- [Playback profiles](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/profiles.py): `src/surroundflix/profiles.py`
- [Title badges](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/page.js): `src/surroundflix/templates/page.js`

### Browser extension

- [Content bridge](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/content.js): `src/surroundflix/templates/content.js`
- [Toolbar state](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/background.js): `src/surroundflix/templates/background.js`
- [Extension settings](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js): `src/surroundflix/templates/popup.js`

### User interface

- [Toolbar popup](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js): `src/surroundflix/templates/popup.js`
- [Shared interface logic](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/shared.js): `src/surroundflix/templates/shared.js`
- [Watch history](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/popup.js): `src/surroundflix/templates/popup.js`

### macOS companion

- [App window](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/app/Script.js): `src/surroundflix/templates/app/Script.js`
- [App view](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/app/Main.html): `src/surroundflix/templates/app/Main.html`
- [Translations](https://github.com/anzouk/surroundflix/blob/main/src/surroundflix/templates/i18n.json): `src/surroundflix/templates/i18n.json`

### Other components

- **Viewer**
- **GitHub releases**
- **Safari or Chrome**

## Connections

- Viewer → Toolbar popup: chooses settings (evidence: `README.md`)
- Toolbar popup → Extension settings: stores preferences (evidence: `README.md`)
- Toolbar popup → Shared interface logic: uses shared logic (evidence: `src/surroundflix/templates/popup.js`)
- Content bridge → Request hook: bridges page state (evidence: `src/surroundflix/templates/content.js`)
- Request hook → Playback profiles: uses profile choices
- Request hook → Netflix player: alters playback request (evidence: `README.md`)
- Netflix player → Request hook: provides playback status (evidence: `README.md`)
- Request hook → Title badges: adds title badges (evidence: `src/surroundflix/templates/page.js`)
- Content bridge → Toolbar popup: relays tab status (evidence: `README.md`)
- Toolbar state → Safari or Chrome: sets toolbar badge
- Toolbar popup → Watch history: records recent titles (evidence: `README.md`)
- Viewer → App window: opens companion (evidence: `README.md`)
- App window → App view: drives app view (evidence: `README.md`)
- App window → Translations: selects language (evidence: `README.md`)
- App window → GitHub releases: checks releases (evidence: `README.md`)
- Safari or Chrome → Netflix player: plays titles (evidence: `README.md`)
