# gabrielsantos1101/lobby-cast architecture

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

- Interactive diagram: https://gitdiagram.com/gabrielsantos1101/lobby-cast
- Repository: https://github.com/gabrielsantos1101/lobby-cast

## Overview

Lobby Cast is a browser-based live screen-sharing app: a broadcaster captures a display and publishes tracks, then viewers join by stream ID and receive media through Cloudflare Calls. The main product paths cover stream creation, viewing, multi-stream layouts and playback controls; optional audience presence adds viewer counts, join/leave sounds and elapsed-time indicators through Supabase. Edges follow the README or shown imports and calls. The watch route and several UI modules were not excerpted, so their internal behavior is represented only where the index or README supports it.

Main entry points: [`src/routes/share.tsx`](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/share.tsx) (Broadcast route), [`src/components/stream-player.tsx`](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/stream-player.tsx) (Stream player), [`src/routes/watch.$streamId.tsx`](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/watch.%24streamId.tsx) (Watch route), [`src/lib/calls.ts`](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/calls.ts) (Calls signaling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_streaming["Live streaming"]
  node_home["Entry page<br/>[index.tsx]"]
  node_share["Broadcast route<br/>[share.tsx]"]
  node_capture["Display capture<br/>[share.tsx]"]
  node_calls["Calls signaling<br/>[calls.ts]"]
  node_router["Route registry<br/>[routeTree.gen.ts]"]
end

subgraph group_audience["Audience metrics"]
  node_audience_hook["Audience polling<br/>[use-audience.ts]"]
  node_presence["Presence service<br/>[presence.ts]"]
  node_viewer_name["Viewer name<br/>[viewer-name.tsx]"]
  node_join_sound["Join sound<br/>[Join.mp3]"]
  node_leave_sound["Leave sound<br/>[Leave.mp3]"]
end

subgraph group_playback["Viewing experience"]
  node_watch["Watch route"]
  node_player["Stream player<br/>[stream-player.tsx]"]
  node_layout["Stream layout<br/>[stream-layout.ts]"]
  node_zoom["Zoom and pan<br/>[use-zoom-pan.ts]"]
  node_minimap["Zoom minimap<br/>[zoom-minimap.tsx]"]
  node_draggable["Draggable view<br/>[draggable.tsx]"]
end

subgraph group_shared["Shared interface"]
  node_button["Button<br/>[button.tsx]"]
  node_input["Input<br/>[input.tsx]"]
  node_select["Select<br/>[select.tsx]"]
  node_slider["Slider<br/>[slider.tsx]"]
  node_toggle["Toggle<br/>[toggle.tsx]"]
  node_tooltip["Tooltip<br/>[tooltip.tsx]"]
end

node_broadcaster(("Broadcaster"))
node_viewer(("Viewer"))
node_cloudflare["Cloudflare Calls"]
node_supabase[("Supabase")]

node_broadcaster -->|"opens app"| node_home
node_home -->|"starts broadcast"| node_share
node_home -->|"opens stream"| node_watch
node_broadcaster -->|"configures stream"| node_share
node_share -->|"captures display"| node_capture
node_share -->|"creates session"| node_calls
node_share -->|"pushes tracks"| node_calls
node_calls -->|"signals tracks"| node_cloudflare
node_viewer -->|"opens link"| node_watch
node_watch -->|"renders streams"| node_player
node_player -->|"creates session"| node_calls
node_player -->|"pulls tracks"| node_calls
node_player -->|"renegotiates SDP"| node_calls
node_player -->|"handles gestures"| node_zoom
node_player -->|"renders minimap"| node_minimap
node_share -->|"sizes watch grid"| node_layout
node_watch -->|"uses stream layout"| node_layout
node_share -->|"shows own stream"| node_player
node_share -->|"renders movable view"| node_draggable
node_share -->|"reads audience status"| node_audience_hook
node_player -->|"reads stream status"| node_audience_hook
node_audience_hook -->|"polls and heartbeats"| node_presence
node_presence -->|"reads and writes"| node_supabase
node_presence -->|"plays on arrival"| node_join_sound
node_presence -->|"plays on departure"| node_leave_sound
node_share -->|"shows identity field"| node_viewer_name
node_watch -->|"shows viewer identity"| node_viewer_name
node_share -->|"renders controls"| node_button
node_home -->|"renders actions"| node_button
node_home -->|"accepts stream code"| node_input
node_share -->|"sets capture options"| node_select
node_share -->|"sets volume"| node_slider
node_player -->|"controls volume"| node_slider
node_player -->|"controls mute"| node_toggle
node_share -->|"explains status"| node_tooltip
node_share -->|"registers route"| node_router
node_watch -->|"registers route"| node_router

click node_home "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/index.tsx"
click node_share "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/share.tsx"
click node_capture "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/share.tsx"
click node_calls "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/calls.ts"
click node_watch "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/watch.%24streamId.tsx"
click node_player "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/stream-player.tsx"
click node_layout "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/stream-layout.ts"
click node_zoom "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/hooks/use-zoom-pan.ts"
click node_minimap "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/zoom-minimap.tsx"
click node_draggable "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/draggable.tsx"
click node_audience_hook "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/hooks/use-audience.ts"
click node_presence "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/presence.ts"
click node_viewer_name "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/viewer-name.tsx"
click node_join_sound "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/assets/Join.mp3"
click node_leave_sound "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/assets/Leave.mp3"
click node_button "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/button.tsx"
click node_input "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/input.tsx"
click node_select "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/select.tsx"
click node_slider "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/slider.tsx"
click node_toggle "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/toggle.tsx"
click node_tooltip "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/tooltip.tsx"
click node_router "https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routeTree.gen.ts"

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_home,node_share,node_capture,node_calls,node_router,node_viewer toneBlue
class node_audience_hook,node_presence,node_viewer_name,node_join_sound,node_leave_sound,node_supabase toneAmber
class node_watch,node_player,node_layout,node_zoom,node_minimap,node_draggable toneMint
class node_button,node_input,node_select,node_slider,node_toggle,node_tooltip toneRose
class node_broadcaster,node_cloudflare toneIndigo
```

## Components

### Live streaming

- [Entry page](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Broadcast route](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/share.tsx): `src/routes/share.tsx`
- [Display capture](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/share.tsx): `src/routes/share.tsx`
- [Calls signaling](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/calls.ts): `src/lib/calls.ts`
- [Route registry](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`

### Audience metrics

- [Audience polling](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/hooks/use-audience.ts): `src/hooks/use-audience.ts`
- [Presence service](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/presence.ts): `src/lib/presence.ts`
- [Viewer name](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/viewer-name.tsx): `src/components/viewer-name.tsx`
- [Join sound](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/assets/Join.mp3): `src/assets/Join.mp3`
- [Leave sound](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/assets/Leave.mp3): `src/assets/Leave.mp3`

### Viewing experience

- [Watch route](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/routes/watch.%24streamId.tsx): `src/routes/watch.$streamId.tsx`
- [Stream player](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/stream-player.tsx): `src/components/stream-player.tsx`
- [Stream layout](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/lib/stream-layout.ts): `src/lib/stream-layout.ts`
- [Zoom and pan](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/hooks/use-zoom-pan.ts): `src/hooks/use-zoom-pan.ts`
- [Zoom minimap](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/zoom-minimap.tsx): `src/components/zoom-minimap.tsx`
- [Draggable view](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/draggable.tsx): `src/components/draggable.tsx`

### Shared interface

- [Button](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Input](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Select](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/select.tsx): `src/components/ui/select.tsx`
- [Slider](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/slider.tsx): `src/components/ui/slider.tsx`
- [Toggle](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/toggle.tsx): `src/components/ui/toggle.tsx`
- [Tooltip](https://github.com/gabrielsantos1101/lobby-cast/blob/main/src/components/ui/tooltip.tsx): `src/components/ui/tooltip.tsx`

### Other components

- **Broadcaster**
- **Viewer**
- **Cloudflare Calls**
- **Supabase**

## Connections

- Broadcaster → Entry page: opens app (evidence: `src/routes/index.tsx`)
- Entry page → Broadcast route: starts broadcast (evidence: `src/routes/index.tsx`)
- Entry page → Watch route: opens stream (evidence: `src/routes/index.tsx`)
- Broadcaster → Broadcast route: configures stream (evidence: `README.md`)
- Broadcast route → Display capture: captures display (evidence: `src/routes/share.tsx`)
- Broadcast route → Calls signaling: creates session (evidence: `src/routes/share.tsx`)
- Broadcast route → Calls signaling: pushes tracks (evidence: `src/routes/share.tsx`)
- Calls signaling → Cloudflare Calls: signals tracks (evidence: `src/lib/calls.ts`)
- Viewer → Watch route: opens link (evidence: `README.md`)
- Watch route → Stream player: renders streams (evidence: `src/routes/watch.$streamId.tsx`)
- Stream player → Calls signaling: creates session (evidence: `src/components/stream-player.tsx`)
- Stream player → Calls signaling: pulls tracks (evidence: `src/components/stream-player.tsx`)
- Stream player → Calls signaling: renegotiates SDP (evidence: `src/components/stream-player.tsx`)
- Stream player → Zoom and pan: handles gestures (evidence: `src/components/stream-player.tsx`)
- Stream player → Zoom minimap: renders minimap (evidence: `src/components/stream-player.tsx`)
- Broadcast route → Stream layout: sizes watch grid (evidence: `src/routes/share.tsx`)
- Watch route → Stream layout: uses stream layout (evidence: `src/routes/watch.$streamId.tsx`)
- Broadcast route → Stream player: shows own stream (evidence: `README.md`)
- Broadcast route → Draggable view: renders movable view (evidence: `src/routes/share.tsx`)
- Broadcast route → Audience polling: reads audience status (evidence: `src/routes/share.tsx`)
- Stream player → Audience polling: reads stream status (evidence: `src/components/stream-player.tsx`)
- Audience polling → Presence service: polls and heartbeats (evidence: `src/hooks/use-audience.ts`)
- Presence service → Supabase: reads and writes (evidence: `src/lib/presence.ts`)
- Presence service → Join sound: plays on arrival (evidence: `src/lib/presence.ts`)
- Presence service → Leave sound: plays on departure (evidence: `src/lib/presence.ts`)
- Broadcast route → Viewer name: shows identity field (evidence: `src/routes/share.tsx`)
- Watch route → Viewer name: shows viewer identity (evidence: `src/routes/watch.$streamId.tsx`)
- Broadcast route → Button: renders controls (evidence: `src/routes/share.tsx`)
- Entry page → Button: renders actions (evidence: `src/routes/index.tsx`)
- Entry page → Input: accepts stream code (evidence: `src/routes/index.tsx`)
- Broadcast route → Select: sets capture options (evidence: `src/routes/share.tsx`)
- Broadcast route → Slider: sets volume (evidence: `src/routes/share.tsx`)
- Stream player → Slider: controls volume (evidence: `src/components/stream-player.tsx`)
- Stream player → Toggle: controls mute (evidence: `src/components/stream-player.tsx`)
- Broadcast route → Tooltip: explains status (evidence: `src/routes/share.tsx`)
- Broadcast route → Route registry: registers route (evidence: `src/routeTree.gen.ts`)
- Watch route → Route registry: registers route (evidence: `src/routeTree.gen.ts`)
