# biolend83/tubehaus architecture

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

- Interactive diagram: https://gitdiagram.com/biolend83/tubehaus
- Repository: https://github.com/biolend83/tubehaus

## Overview

TubeHaus is a self-hosted YouTube client for browsers, with a TV-friendly interface and a shared household library. A viewer enters through the web app, searches or browses content, opens a watch page, and plays video through the browser player; the app requests content from the server, which runs its own YouTube engine. The client also provides music playback, localization, casting and synchronized viewing. The README documents server capabilities beyond the sampled excerpts; edges to those features are shown only where documented. The large Python server was read, but its internal call relationships are not represented here.

Main entry points: [`web/y/main.js`](https://github.com/biolend83/tubehaus/blob/main/web/y/main.js) (App entry and navigation), [`web/y/util.js`](https://github.com/biolend83/tubehaus/blob/main/web/y/util.js) (API and local helpers), [`server/tubehaus_server.py`](https://github.com/biolend83/tubehaus/blob/main/server/tubehaus_server.py) (HTTP server and API), [`web/y/watch.js`](https://github.com/biolend83/tubehaus/blob/main/web/y/watch.js) (Watch page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_app["App entry and navigation<br/>[main.js]"]
  node_pages["Browse and search pages<br/>[pages.js]"]
  node_shared["Library and interactions<br/>[core.js]"]
  node_webutil["API and local helpers<br/>[util.js]"]
  node_localdata["Local library access<br/>[locallib.js]"]
  node_translations["Interface translations<br/>[i18n.js]"]
end

subgraph group_playback["Playback features"]
  node_watch["Watch page<br/>[watch.js]"]
  node_player["Video player<br/>[player.js]"]
  node_sound["Audio effects<br/>[sound.js]"]
  node_music["Music player<br/>[music.js]"]
  node_party["Synchronized viewing<br/>[party.js]"]
  node_cast["Cast to TV<br/>[cast.js]"]
  node_tv["TV interface<br/>[tv.js]"]
end

subgraph group_server["Server services"]
  node_serverapp["HTTP server and API<br/>[tubehaus_server.py]"]
end

subgraph group_youtube["YouTube engine"]
  node_sabr["SABR and stream solving<br/>[sabr.mjs]"]
  node_vendor["SABR protocol library<br/>[vendor.mjs]"]
end

node_viewer(("Viewer"))
node_youtube_service(("YouTube"))
node_warp(("Cloudflare WARP"))

node_viewer -->|"uses"| node_app
node_app -->|"routes to"| node_pages
node_app -->|"opens"| node_watch
node_app -->|"requests data"| node_webutil
node_pages -->|"fetches content"| node_webutil
node_pages -->|"uses"| node_shared
node_shared -->|"accesses library"| node_webutil
node_webutil -->|"delegates local reads"| node_localdata
node_watch -->|"loads video"| node_player
node_watch -->|"loads playlist"| node_pages
node_watch -->|"opens controls"| node_party
node_player -->|"uses effects"| node_sound
node_music -->|"loads Shaka"| node_player
node_app -->|"routes to"| node_music
node_app -->|"initializes"| node_tv
node_app -->|"initializes"| node_cast
node_webutil -->|"uses translations"| node_translations
node_translations -->|"loads language data"| node_serverapp
node_webutil -->|"calls API"| node_serverapp
node_serverapp -.->|"uses stream engine"| node_sabr
node_sabr -->|"imports protocol tools"| node_vendor
node_serverapp -->|"fetches YouTube data"| node_youtube_service
node_serverapp -->|"routes through"| node_warp
node_sabr -->|"solves stream challenges"| node_youtube_service

click node_app "https://github.com/biolend83/tubehaus/blob/main/web/y/main.js"
click node_pages "https://github.com/biolend83/tubehaus/blob/main/web/y/pages.js"
click node_shared "https://github.com/biolend83/tubehaus/blob/main/web/y/core.js"
click node_webutil "https://github.com/biolend83/tubehaus/blob/main/web/y/util.js"
click node_localdata "https://github.com/biolend83/tubehaus/blob/main/web/y/locallib.js"
click node_translations "https://github.com/biolend83/tubehaus/blob/main/web/y/i18n.js"
click node_watch "https://github.com/biolend83/tubehaus/blob/main/web/y/watch.js"
click node_player "https://github.com/biolend83/tubehaus/blob/main/web/y/player.js"
click node_sound "https://github.com/biolend83/tubehaus/blob/main/web/y/sound.js"
click node_music "https://github.com/biolend83/tubehaus/blob/main/web/y/music.js"
click node_party "https://github.com/biolend83/tubehaus/blob/main/web/y/party.js"
click node_cast "https://github.com/biolend83/tubehaus/blob/main/web/y/cast.js"
click node_tv "https://github.com/biolend83/tubehaus/blob/main/web/y/tv.js"
click node_serverapp "https://github.com/biolend83/tubehaus/blob/main/server/tubehaus_server.py"
click node_sabr "https://github.com/biolend83/tubehaus/blob/main/server/sabr/sabr.mjs"
click node_vendor "https://github.com/biolend83/tubehaus/blob/main/server/sabr/vendor.mjs"

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_app,node_pages,node_shared,node_webutil,node_localdata,node_translations,node_viewer toneBlue
class node_watch,node_player,node_sound,node_music,node_party,node_cast,node_tv toneAmber
class node_serverapp toneMint
class node_sabr,node_vendor toneRose
class node_youtube_service,node_warp toneIndigo
```

## Components

### Browser client

- [App entry and navigation](https://github.com/biolend83/tubehaus/blob/main/web/y/main.js): `web/y/main.js`
- [Browse and search pages](https://github.com/biolend83/tubehaus/blob/main/web/y/pages.js): `web/y/pages.js`
- [Library and interactions](https://github.com/biolend83/tubehaus/blob/main/web/y/core.js): `web/y/core.js`
- [API and local helpers](https://github.com/biolend83/tubehaus/blob/main/web/y/util.js): `web/y/util.js`
- [Local library access](https://github.com/biolend83/tubehaus/blob/main/web/y/locallib.js): `web/y/locallib.js`
- [Interface translations](https://github.com/biolend83/tubehaus/blob/main/web/y/i18n.js): `web/y/i18n.js`

### Playback features

- [Watch page](https://github.com/biolend83/tubehaus/blob/main/web/y/watch.js): `web/y/watch.js`
- [Video player](https://github.com/biolend83/tubehaus/blob/main/web/y/player.js): `web/y/player.js`
- [Audio effects](https://github.com/biolend83/tubehaus/blob/main/web/y/sound.js): `web/y/sound.js`
- [Music player](https://github.com/biolend83/tubehaus/blob/main/web/y/music.js): `web/y/music.js`
- [Synchronized viewing](https://github.com/biolend83/tubehaus/blob/main/web/y/party.js): `web/y/party.js`
- [Cast to TV](https://github.com/biolend83/tubehaus/blob/main/web/y/cast.js): `web/y/cast.js`
- [TV interface](https://github.com/biolend83/tubehaus/blob/main/web/y/tv.js): `web/y/tv.js`

### Server services

- [HTTP server and API](https://github.com/biolend83/tubehaus/blob/main/server/tubehaus_server.py): `server/tubehaus_server.py`

### YouTube engine

- [SABR and stream solving](https://github.com/biolend83/tubehaus/blob/main/server/sabr/sabr.mjs): `server/sabr/sabr.mjs`
- [SABR protocol library](https://github.com/biolend83/tubehaus/blob/main/server/sabr/vendor.mjs): `server/sabr/vendor.mjs`

### Other components

- **Viewer**
- **YouTube**
- **Cloudflare WARP**

## Connections

- Viewer → App entry and navigation: uses (evidence: `README.md`)
- App entry and navigation → Browse and search pages: routes to (evidence: `web/y/main.js`)
- App entry and navigation → Watch page: opens (evidence: `web/y/main.js`)
- App entry and navigation → API and local helpers: requests data (evidence: `web/y/main.js`)
- Browse and search pages → API and local helpers: fetches content (evidence: `web/y/pages.js`)
- Browse and search pages → Library and interactions: uses (evidence: `web/y/pages.js`)
- Library and interactions → API and local helpers: accesses library (evidence: `web/y/core.js`)
- API and local helpers → Local library access: delegates local reads (evidence: `web/y/util.js`)
- Watch page → Video player: loads video (evidence: `web/y/watch.js`)
- Watch page → Browse and search pages: loads playlist (evidence: `web/y/watch.js`)
- Watch page → Synchronized viewing: opens controls (evidence: `web/y/watch.js`)
- Video player → Audio effects: uses effects (evidence: `web/y/player.js`)
- Music player → Video player: loads Shaka (evidence: `web/y/music.js`)
- App entry and navigation → Music player: routes to (evidence: `web/y/main.js`)
- App entry and navigation → TV interface: initializes (evidence: `web/y/main.js`)
- App entry and navigation → Cast to TV: initializes (evidence: `web/y/main.js`)
- API and local helpers → Interface translations: uses translations (evidence: `web/y/util.js`)
- Interface translations → HTTP server and API: loads language data (evidence: `web/y/i18n.js`)
- API and local helpers → HTTP server and API: calls API (evidence: `web/y/util.js`)
- HTTP server and API → SABR and stream solving: uses stream engine
- SABR and stream solving → SABR protocol library: imports protocol tools (evidence: `server/sabr/sabr.mjs`)
- HTTP server and API → YouTube: fetches YouTube data (evidence: `README.md`)
- HTTP server and API → Cloudflare WARP: routes through (evidence: `README.md`)
- SABR and stream solving → YouTube: solves stream challenges (evidence: `server/sabr/sabr.mjs`)
