# tk2f/kasaneru architecture

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

- Interactive diagram: https://gitdiagram.com/tk2f/kasaneru
- Repository: https://github.com/tk2f/kasaneru

## Overview

1. **What this repo is**
   Kasaneru is a **static OBS overlay toolkit**: a folder of HTML/CSS/JS assets that OBS loads through **Browser Source** and **Custom Browser Dock**. There is no build pipeline or server runtime in the repo; the architecture is file-based and runs inside the browser engine embedded in OBS.

2. **Two primary runtime surfaces**
   The system is split into two cooperating entry points:
   - **`dock.html`**: the control surface shown in an OBS dock.
   - **`overlay.html`**: the rendering surface shown in the OBS scene as a Browser Source.
   
   These two pages must point at the **same extracted folder** so they can share state.

3. **Control plane vs display plane**
   The dock is where the user edits state, chooses apps, configures chapters/title cards/images, and toggles live/offline state. The overlay is where those selections are rendered to the stream. This separation is the core architectural boundary: **user interaction lives in the dock; visual output lives in the overlay**.

4. **In-browser synchronization**
   The README explicitly requires Browser Source to be configured as a non-local file because dock and overlay communicate through browser-side messaging, specifically **BroadcastChannel**. That means state changes are propagated directly between the two pages without a backend service or websocket server in this repo.

5. **Main feature subsystems exposed by the dock**
   The dock appears to orchestrate several content types:
   - **Chapters**: navigation cards for session sections.
   - **Title cards / telops**: lower-third style text overlays.
   - **Images**: layered visuals loaded from `images/`.
   - **Apps**: mini tools loaded from `apps/*.html`.
   
   These are separate content domains but share the same presentation pipeline into the overlay.

6. **Built-in app subsystem**
   `apps/` contains standalone mini-apps, each as its own HTML entry point:
   - `timer.html`
   - `clock.html`
   - `music-player.html`
   - `roulette.html`
   - `draw.html`
   - `banner/banner.html`
   - `dice/dice.html`
   
   Each app is effectively a self-contained module that can be added from the dock by URL. The app boundary is important: apps can have their own UI and state, but they still live inside the same static package and integrate with the shared OBS overlay model.

7. **Shared asset registries**
   The repo includes manifest files that act as registries for dynamic content:
   - `images/manifest.json` and `images/manifest.js`
   - `apps/manifest.json`
   
   These indicate that the system does not hardcode all assets in the main pages; instead it uses manifests to discover available images and apps. That makes the architecture more data-driven and easier to extend without changing the core shell.

8. **Image and overlay content pipeline**
   `images/` is a first-class asset boundary. Users drop images there, then register or select them through the dock. The overlay consumes these image references and renders them with positioning/layering rules. This is a clear file-system-to-UI pipeline: **filesystem asset → manifest/selection → dock state → overlay rendering**.

9. **CSV import/export as a configuration boundary**
   `templates/csv/` contains templates for apps, chapters, images, title cards, and UI settings. The docs state that chapters, telops, images, and settings can be managed through CSV import/export, including spreadsheet workflows. Architecturally, CSV is a bulk configuration interface layered on top of the same runtime state used by the dock and overlay.

10. **Customization and extension points**
   The repo intentionally exposes customization through:
   - **Custom CSS** (`CUSTOM-CSS-GUIDE.md`)
   - **App template** (`templates/app/hello-world.html`)
   - **Remote integration templates** (`templates/remote/`)
   
   This shows a deliberate boundary between the core package and user customization: the core is meant to stay static, while appearance and new mini-apps are extended by adding more files.

11. **Remote and automation hooks**
   `templates/remote/` includes samples for companion actions and websocket client quickstart material, suggesting optional integration with external control surfaces. This is not the core runtime, but it is a defined extension boundary for automation and remote control.

12. **Special case: Draw app and OBS integration**
   The Draw app stands out because it mentions **OBS WebSocket** support for seeing the preview while drawing. That makes it the only built-in app with a stronger integration dependency on OBS beyond the Browser Source itself. In an architecture diagram, it should be shown as an app that can optionally talk to OBS through the websocket plugin/interface.

13. **Operational tooling, not runtime**
   The `tools/` scripts are for repository hygiene and packaging support: image manifest generation, pre-commit setup, safety checks, and security scanning. They support the project but are not part of the end-user runtime graph.

14. **Overall architecture summary**
   The project is best drawn as a **static OBS add-on package** with:
   - OBS as the host runtime,
   - `dock.html` as the interactive control plane,
   - `overlay.html` as the stream-facing render plane,
   - `apps/` and `images/` as modular content sources,
   - CSV/manifest files as data/config boundaries,
   - browser messaging as the synchronization mechanism between dock and overlay.

Main entry points: [`apps/manifest.json`](https://github.com/tk2f/kasaneru/blob/main/apps/manifest.json) (App registry), [`dock.html`](https://github.com/tk2f/kasaneru/blob/main/dock.html) (Dock), [`overlay.html`](https://github.com/tk2f/kasaneru/blob/main/overlay.html) (Overlay), [`templates/csv/README.md`](https://github.com/tk2f/kasaneru/blob/main/templates/csv/README.md) (CSV templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime shell"]
  node_obs["OBS<br/>host runtime"]
  node_dock["Dock<br/>control page<br/>[dock.html]"]
  node_overlay["Overlay<br/>render page<br/>[overlay.html]"]
  node_sync(("BroadcastChannel<br/>sync bus"))
end

subgraph group_content["Content registries"]
  node_chapters["Chapters<br/>content workflow"]
  node_titles["Title cards<br/>content workflow"]
  node_images[("Images<br/>asset pipeline<br/>[manifest.json]")]
  node_imagesjs["Image manifest<br/>registry script<br/>[manifest.js]"]
  node_appsreg[("App registry<br/>registry data<br/>[manifest.json]")]
  node_appsdock["Apps<br/>app launcher"]
end

subgraph group_apps["Built-in apps"]
  node_timer["Timer<br/>mini app<br/>[timer.html]"]
  node_clock["Clock<br/>mini app<br/>[clock.html]"]
  node_music["Music player<br/>mini app<br/>[music-player.html]"]
  node_roulette["Roulette<br/>mini app<br/>[roulette.html]"]
  node_draw["Draw<br/>mini app<br/>[draw.html]"]
  node_banner["Banner<br/>mini app<br/>[banner.html]"]
  node_dice["Dice<br/>mini app<br/>[dice.html]"]
end

subgraph group_extensions["Extension points"]
  node_csv["CSV templates<br/>bulk config<br/>[README.md]"]
  node_customcss["Custom CSS<br/>style override"]
  node_apptemplate["App template<br/>starter template<br/>[hello-world.html]"]
  node_remote["Remote hooks<br/>integration template<br/>[README.md]"]
end

node_obs -->|"hosts"| node_dock
node_obs -->|"hosts"| node_overlay
node_dock -->|"publishes"| node_sync
node_overlay -->|"subscribes"| node_sync
node_dock -->|"edits"| node_chapters
node_dock -->|"edits"| node_titles
node_dock -->|"selects"| node_images
node_dock -->|"launches"| node_appsdock
node_images -->|"indexed by"| node_imagesjs
node_appsdock -->|"reads"| node_appsreg
node_appsreg -->|"includes"| node_timer
node_appsreg -->|"includes"| node_clock
node_appsreg -->|"includes"| node_music
node_appsreg -->|"includes"| node_roulette
node_appsreg -->|"includes"| node_draw
node_appsreg -->|"includes"| node_banner
node_appsreg -->|"includes"| node_dice
node_overlay -->|"renders"| node_images
node_overlay -->|"renders"| node_chapters
node_overlay -->|"renders"| node_titles
node_draw -.->|"optionally integrates"| node_obs
node_csv -->|"imports/exports"| node_chapters
node_csv -->|"imports/exports"| node_titles
node_csv -->|"imports/exports"| node_images
node_csv -->|"imports/exports"| node_appsdock
node_customcss -->|"customizes"| node_dock
node_apptemplate -->|"extends"| node_appsreg
node_remote -.->|"integrates with"| node_dock

click node_dock "https://github.com/tk2f/kasaneru/blob/main/dock.html"
click node_overlay "https://github.com/tk2f/kasaneru/blob/main/overlay.html"
click node_images "https://github.com/tk2f/kasaneru/blob/main/images/manifest.json"
click node_imagesjs "https://github.com/tk2f/kasaneru/blob/main/images/manifest.js"
click node_appsreg "https://github.com/tk2f/kasaneru/blob/main/apps/manifest.json"
click node_timer "https://github.com/tk2f/kasaneru/blob/main/apps/timer.html"
click node_clock "https://github.com/tk2f/kasaneru/blob/main/apps/clock.html"
click node_music "https://github.com/tk2f/kasaneru/blob/main/apps/music-player.html"
click node_roulette "https://github.com/tk2f/kasaneru/blob/main/apps/roulette.html"
click node_draw "https://github.com/tk2f/kasaneru/blob/main/apps/draw.html"
click node_banner "https://github.com/tk2f/kasaneru/blob/main/apps/banner/banner.html"
click node_dice "https://github.com/tk2f/kasaneru/blob/main/apps/dice/dice.html"
click node_csv "https://github.com/tk2f/kasaneru/blob/main/templates/csv/README.md"
click node_customcss "https://github.com/tk2f/kasaneru/blob/main/CUSTOM-CSS-GUIDE.md"
click node_apptemplate "https://github.com/tk2f/kasaneru/blob/main/templates/app/hello-world.html"
click node_remote "https://github.com/tk2f/kasaneru/blob/main/templates/remote/README.md"

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_obs,node_dock,node_overlay,node_sync toneBlue
class node_chapters,node_titles,node_images,node_imagesjs,node_appsreg,node_appsdock toneAmber
class node_timer,node_clock,node_music,node_roulette,node_draw,node_banner,node_dice toneMint
class node_csv,node_customcss,node_apptemplate,node_remote toneRose
```

## Components

### Runtime shell

OBS-hosted pages and in-browser sync

- **OBS**: host runtime · Hosts the Browser Source and Custom Browser Dock surfaces.
- [Dock](https://github.com/tk2f/kasaneru/blob/main/dock.html): control page · Interactive control plane for editing state and choosing content. · `dock.html`
- [Overlay](https://github.com/tk2f/kasaneru/blob/main/overlay.html): render page · Stream-facing display plane rendered inside OBS. · `overlay.html`
- **BroadcastChannel**: sync bus · Browser-side state propagation between dock and overlay.

### Content registries

Data-driven asset discovery and shared state sources

- **Chapters**: content workflow · Session section cards managed from the dock and rendered in the overlay.
- **Title cards**: content workflow · Lower-third style text overlays and telop state.
- [Images](https://github.com/tk2f/kasaneru/blob/main/images/manifest.json): asset pipeline · Layered visual assets loaded from the filesystem and selected in the dock. · `images/manifest.json`
- [Image manifest](https://github.com/tk2f/kasaneru/blob/main/images/manifest.js): registry script · Manifest helper for discovering available images. · `images/manifest.js`
- [App registry](https://github.com/tk2f/kasaneru/blob/main/apps/manifest.json): registry data · Manifest of bundled mini-app entry points. · `apps/manifest.json`
- **Apps**: app launcher · Dock-side app selection and launch surface.

### Built-in apps

Standalone mini-app entry points bundled in the package

- [Timer](https://github.com/tk2f/kasaneru/blob/main/apps/timer.html): mini app · Standalone timer entry point. · `apps/timer.html`
- [Clock](https://github.com/tk2f/kasaneru/blob/main/apps/clock.html): mini app · Standalone clock entry point. · `apps/clock.html`
- [Music player](https://github.com/tk2f/kasaneru/blob/main/apps/music-player.html): mini app · Standalone music playback tool. · `apps/music-player.html`
- [Roulette](https://github.com/tk2f/kasaneru/blob/main/apps/roulette.html): mini app · Standalone randomizer entry point. · `apps/roulette.html`
- [Draw](https://github.com/tk2f/kasaneru/blob/main/apps/draw.html): mini app · Drawing tool with optional OBS WebSocket preview integration. · `apps/draw.html`
- [Banner](https://github.com/tk2f/kasaneru/blob/main/apps/banner/banner.html): mini app · Banner entry point nested under apps/banner. · `apps/banner/banner.html`
- [Dice](https://github.com/tk2f/kasaneru/blob/main/apps/dice/dice.html): mini app · Dice entry point nested under apps/dice. · `apps/dice/dice.html`

### Extension points

User customization and external integration templates

- [CSV templates](https://github.com/tk2f/kasaneru/blob/main/templates/csv/README.md): bulk config · Spreadsheet-oriented import/export templates for core content and settings. · `templates/csv/README.md`
- [Custom CSS](https://github.com/tk2f/kasaneru/blob/main/CUSTOM-CSS-GUIDE.md): style override · Guidance for overriding appearance without changing the core package. · `CUSTOM-CSS-GUIDE.md`
- [App template](https://github.com/tk2f/kasaneru/blob/main/templates/app/hello-world.html): starter template · Hello-world HTML template for creating new bundled apps. · `templates/app/hello-world.html`
- [Remote hooks](https://github.com/tk2f/kasaneru/blob/main/templates/remote/README.md): integration template · Samples for companion actions and websocket client automation. · `templates/remote/README.md`

## Connections

- OBS → Dock: hosts · OBS opens the dock surface in its browser UI.
- OBS → Overlay: hosts · OBS loads the overlay as a Browser Source.
- Dock → BroadcastChannel: publishes · Dock state changes are propagated through browser-side messaging.
- Overlay → BroadcastChannel: subscribes · Overlay receives updates from the same browser messaging channel.
- Dock → Chapters: edits · Users manage chapter cards from the dock.
- Dock → Title cards: edits · Users configure title cards and telops from the dock.
- Dock → Images: selects · Dock chooses image assets from the shared image registry.
- Dock → Apps: launches · Dock exposes and launches bundled mini apps.
- Images → Image manifest: indexed by · Image assets are discovered through manifest helpers.
- Apps → App registry: reads · The dock uses the app manifest to discover available apps.
- App registry → Timer: includes · Manifest entry point for the timer app.
- App registry → Clock: includes · Manifest entry point for the clock app.
- App registry → Music player: includes · Manifest entry point for the music player app.
- App registry → Roulette: includes · Manifest entry point for the roulette app.
- App registry → Draw: includes · Manifest entry point for the draw app.
- App registry → Banner: includes · Manifest entry point for the banner app.
- App registry → Dice: includes · Manifest entry point for the dice app.
- Overlay → Images: renders · Overlay consumes selected image assets for display.
- Overlay → Chapters: renders · Overlay shows the current chapter state.
- Overlay → Title cards: renders · Overlay shows title card state.
- Draw → OBS: optionally integrates · Draw can use OBS WebSocket to sync preview and drawing behavior.
- CSV templates → Chapters: imports/exports · CSV templates cover chapter workflows.
- CSV templates → Title cards: imports/exports · CSV templates cover title card workflows.
- CSV templates → Images: imports/exports · CSV templates cover image configuration workflows.
- CSV templates → Apps: imports/exports · CSV templates cover app configuration workflows.
- Custom CSS → Dock: customizes · Custom CSS alters the package styling surface.
- App template → App registry: extends · The app template is used to create new bundled app entry points.
- Remote hooks → Dock: integrates with · Remote templates show companion and websocket control integrations.
