# brgjr10/pit-tv architecture

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

- Interactive diagram: https://gitdiagram.com/brgjr10/pit-tv
- Repository: https://github.com/brgjr10/pit-tv

## Overview

PIT TV is a browser-based concert-video archive. A viewer loads the catalog, browses or searches shows, opens a show or setlist, and plays a selected video; album art can retheme the interface. The map also includes documented view/filter capabilities, preference and playback persistence, offline caching, and the show-metadata API. The README and tree support these product branches, but most frontend implementation was not sampled, so uncertain module-to-module wiring is omitted.

Main entry points: [`assets/js/app.js`](https://github.com/brgjr10/pit-tv/blob/master/assets/js/app.js) (Application Entry), [`assets/js/player.js`](https://github.com/brgjr10/pit-tv/blob/master/assets/js/player.js) (Video Player), [`tools/serve.js`](https://github.com/brgjr10/pit-tv/blob/master/tools/serve.js) (HTTP Server), [`assets/js/ui.js`](https://github.com/brgjr10/pit-tv/blob/master/assets/js/ui.js) (Browse Views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Browse and Search"]
  node_app["Application Entry<br/>[app.js]"]
  node_interface["Browse Views<br/>[ui.js]"]
  node_search["Search and Filters<br/>[search.js]"]
end

subgraph group_catalog["Catalog Data"]
  node_catalog_logic["Catalog Processing<br/>[catalog.js]"]
  node_catalog_file["Catalog JSON<br/>[catalog.demo.json]"]
end

subgraph group_playback["Playback and Theme"]
  node_player["Video Player<br/>[player.js]"]
  node_theme["Artwork Themes<br/>[theme.js]"]
end

subgraph group_state["State and Offline"]
  node_preferences["Preferences and Resume<br/>[store.js]"]
  node_browser_storage[("Browser Storage")]
  node_service_worker["Offline Cache<br/>[sw.js]"]
  node_pwa["PWA Setup<br/>[pwa.js]"]
end

subgraph group_admin["Serving and Metadata"]
  node_web_server["HTTP Server<br/>[serve.js]"]
  node_show_sync["Show Metadata Sync<br/>[set-locations.mjs]"]
  node_show_data["Show Metadata"]
end

node_viewer(("Viewer"))
node_media["Video Sources"]

node_viewer -->|"opens"| node_app
node_app -->|"loads catalog"| node_catalog_logic
node_catalog_logic -->|"fetches"| node_catalog_file
node_viewer -->|"browses"| node_interface
node_interface -->|"filters and searches"| node_search
node_search -->|"queries entries"| node_catalog_logic
node_viewer -->|"selects video"| node_player
node_player -->|"plays source"| node_media
node_player -->|"provides current artwork"| node_theme
node_theme -->|"updates appearance"| node_interface
node_app -->|"restores preferences"| node_preferences
node_preferences -->|"reads and writes"| node_browser_storage
node_player -->|"stores resume position"| node_preferences
node_app -->|"registers offline support"| node_pwa
node_pwa -->|"registers"| node_service_worker
node_service_worker -->|"caches catalog"| node_catalog_file
node_viewer -->|"requests app and media"| node_web_server
node_web_server -->|"dispatches metadata sync"| node_show_sync
node_show_sync -->|"updates"| node_show_data
node_web_server -->|"serves metadata status"| node_show_data

click node_app "https://github.com/brgjr10/pit-tv/blob/master/assets/js/app.js"
click node_interface "https://github.com/brgjr10/pit-tv/blob/master/assets/js/ui.js"
click node_search "https://github.com/brgjr10/pit-tv/blob/master/assets/js/search.js"
click node_catalog_logic "https://github.com/brgjr10/pit-tv/blob/master/assets/js/catalog.js"
click node_catalog_file "https://github.com/brgjr10/pit-tv/blob/master/data/catalog.demo.json"
click node_player "https://github.com/brgjr10/pit-tv/blob/master/assets/js/player.js"
click node_theme "https://github.com/brgjr10/pit-tv/blob/master/assets/js/theme.js"
click node_preferences "https://github.com/brgjr10/pit-tv/blob/master/assets/js/store.js"
click node_service_worker "https://github.com/brgjr10/pit-tv/blob/master/sw.js"
click node_pwa "https://github.com/brgjr10/pit-tv/blob/master/assets/js/pwa.js"
click node_web_server "https://github.com/brgjr10/pit-tv/blob/master/tools/serve.js"
click node_show_sync "https://github.com/brgjr10/pit-tv/blob/master/tools/set-locations.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_interface,node_search,node_viewer toneBlue
class node_catalog_logic,node_catalog_file toneAmber
class node_player,node_theme toneMint
class node_preferences,node_browser_storage,node_service_worker,node_pwa toneRose
class node_web_server,node_show_sync,node_show_data,node_media toneIndigo
```

## Components

### Browse and Search

- [Application Entry](https://github.com/brgjr10/pit-tv/blob/master/assets/js/app.js): `assets/js/app.js`
- [Browse Views](https://github.com/brgjr10/pit-tv/blob/master/assets/js/ui.js): `assets/js/ui.js`
- [Search and Filters](https://github.com/brgjr10/pit-tv/blob/master/assets/js/search.js): `assets/js/search.js`

### Catalog Data

- [Catalog Processing](https://github.com/brgjr10/pit-tv/blob/master/assets/js/catalog.js): `assets/js/catalog.js`
- [Catalog JSON](https://github.com/brgjr10/pit-tv/blob/master/data/catalog.demo.json): `data/catalog.demo.json`

### Playback and Theme

- [Video Player](https://github.com/brgjr10/pit-tv/blob/master/assets/js/player.js): `assets/js/player.js`
- [Artwork Themes](https://github.com/brgjr10/pit-tv/blob/master/assets/js/theme.js): `assets/js/theme.js`

### State and Offline

- [Preferences and Resume](https://github.com/brgjr10/pit-tv/blob/master/assets/js/store.js): `assets/js/store.js`
- **Browser Storage**
- [Offline Cache](https://github.com/brgjr10/pit-tv/blob/master/sw.js): `sw.js`
- [PWA Setup](https://github.com/brgjr10/pit-tv/blob/master/assets/js/pwa.js): `assets/js/pwa.js`

### Serving and Metadata

- [HTTP Server](https://github.com/brgjr10/pit-tv/blob/master/tools/serve.js): `tools/serve.js`
- [Show Metadata Sync](https://github.com/brgjr10/pit-tv/blob/master/tools/set-locations.mjs): `tools/set-locations.mjs`
- **Show Metadata**

### Other components

- **Viewer**
- **Video Sources**

## Connections

- Viewer → Application Entry: opens
- Application Entry → Catalog Processing: loads catalog
- Catalog Processing → Catalog JSON: fetches
- Viewer → Browse Views: browses
- Browse Views → Search and Filters: filters and searches
- Search and Filters → Catalog Processing: queries entries
- Viewer → Video Player: selects video
- Video Player → Video Sources: plays source
- Video Player → Artwork Themes: provides current artwork
- Artwork Themes → Browse Views: updates appearance
- Application Entry → Preferences and Resume: restores preferences
- Preferences and Resume → Browser Storage: reads and writes
- Video Player → Preferences and Resume: stores resume position
- Application Entry → PWA Setup: registers offline support
- PWA Setup → Offline Cache: registers
- Offline Cache → Catalog JSON: caches catalog
- Viewer → HTTP Server: requests app and media
- HTTP Server → Show Metadata Sync: dispatches metadata sync
- Show Metadata Sync → Show Metadata: updates
- HTTP Server → Show Metadata: serves metadata status
