# sahishnucb/vibe architecture

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

- Interactive diagram: https://gitdiagram.com/sahishnucb/vibe
- Repository: https://github.com/sahishnucb/vibe

## Overview

Vibe is a Phoenix LiveView experiment for synchronized YouTube playback and chat in shared rooms. The main workflow is client intent handled by a LiveView, authoritative room-state updates, PubSub broadcasts, and other clients reflecting the state. Room selection and YouTube search/playback are additional product branches. The README documents the event flow and integrations; the sampled source confirms room-state operations, PubSub broadcasting, supervision, and routes. Some LiveView and YouTube implementation details were not excerpted, so those links rely on README documentation.

Main entry points: [`lib/vibe_web/live/room_live.ex`](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/room_live.ex) (Room interface), [`lib/vibe/application.ex`](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/application.ex) (OTP supervisor), [`lib/vibe_web/router.ex`](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/router.ex) (LiveView routes), [`lib/vibe_web/live/yt_search_live.ex`](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/yt_search_live.ex) (YouTube search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Live web experience"]
  node_router["LiveView routes<br/>[router.ex]"]
  node_choose["Room selection<br/>[choose_live.ex]"]
  node_room_live["Room interface<br/>[room_live.ex]"]
  node_ui["Core UI components<br/>[core_components.ex]"]
  node_layouts["Page layouts<br/>[layouts.ex]"]
end

subgraph group_rooms["Room coordination"]
  node_room_server["Room state process<br/>[room_server.ex]"]
  node_pubsub(("Phoenix PubSub"))
  node_chat["Room chat<br/>[room_server.ex]"]
  node_playback["Playback state<br/>[room_server.ex]"]
end

subgraph group_media["Media discovery"]
  node_yt_search["YouTube search<br/>[yt_search_live.ex]"]
  node_yt_suggest["Search suggestions<br/>[yt_suggest.ex]"]
  node_youtube(("YouTube API"))
  node_video_embed["Video playback embed<br/>[you_tube.ex]"]
end

subgraph group_runtime["Application runtime"]
  node_application["OTP supervisor<br/>[application.ex]"]
  node_endpoint["Phoenix endpoint<br/>[endpoint.ex]"]
  node_telemetry["Telemetry<br/>[telemetry.ex]"]
  node_repo[("Ecto repository<br/>[repo.ex]")]
end

node_client(("Room clients"))

node_client -->|"opens room"| node_router
node_router -->|"routes to"| node_choose
node_router -->|"routes to"| node_room_live
node_router -->|"routes to"| node_yt_search
node_client -->|"sends events"| node_room_live
node_room_live -->|"updates state"| node_room_server
node_room_server -->|"broadcasts state"| node_pubsub
node_pubsub -->|"broadcasts updates"| node_client
node_room_live -->|"handles chat"| node_chat
node_room_live -->|"controls playback"| node_playback
node_yt_search -.->|"searches videos"| node_youtube
node_yt_search -.->|"uses suggestions"| node_yt_suggest
node_youtube -.->|"provides media"| node_video_embed
node_application -->|"starts process"| node_room_server
node_application -->|"starts service"| node_pubsub
node_application -->|"starts endpoint"| node_endpoint
node_application -->|"starts service"| node_telemetry

click node_router "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/router.ex"
click node_choose "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/choose_live.ex"
click node_room_live "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/room_live.ex"
click node_ui "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/components/core_components.ex"
click node_layouts "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/components/layouts.ex"
click node_room_server "https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex"
click node_chat "https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex"
click node_playback "https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex"
click node_yt_search "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/yt_search_live.ex"
click node_yt_suggest "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/yt_suggest.ex"
click node_video_embed "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/you_tube.ex"
click node_application "https://github.com/sahishnucb/vibe/blob/main/lib/vibe/application.ex"
click node_endpoint "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/endpoint.ex"
click node_telemetry "https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/telemetry.ex"
click node_repo "https://github.com/sahishnucb/vibe/blob/main/lib/vibe/repo.ex"

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_router,node_choose,node_room_live,node_ui,node_layouts,node_client toneBlue
class node_room_server,node_pubsub,node_chat,node_playback toneAmber
class node_yt_search,node_yt_suggest,node_youtube,node_video_embed toneMint
class node_application,node_endpoint,node_telemetry,node_repo toneRose
```

## Components

### Live web experience

- [LiveView routes](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/router.ex): `lib/vibe_web/router.ex`
- [Room selection](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/choose_live.ex): `lib/vibe_web/live/choose_live.ex`
- [Room interface](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/room_live.ex): `lib/vibe_web/live/room_live.ex`
- [Core UI components](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/components/core_components.ex): `lib/vibe_web/components/core_components.ex`
- [Page layouts](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/components/layouts.ex): `lib/vibe_web/components/layouts.ex`

### Room coordination

- [Room state process](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex): `lib/vibe/room_server.ex`
- **Phoenix PubSub**
- [Room chat](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex): `lib/vibe/room_server.ex`
- [Playback state](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/room_server.ex): `lib/vibe/room_server.ex`

### Media discovery

- [YouTube search](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/yt_search_live.ex): `lib/vibe_web/live/yt_search_live.ex`
- [Search suggestions](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/yt_suggest.ex): `lib/vibe_web/live/yt_suggest.ex`
- **YouTube API**
- [Video playback embed](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/live/you_tube.ex): `lib/vibe_web/live/you_tube.ex`

### Application runtime

- [OTP supervisor](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/application.ex): `lib/vibe/application.ex`
- [Phoenix endpoint](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/endpoint.ex): `lib/vibe_web/endpoint.ex`
- [Telemetry](https://github.com/sahishnucb/vibe/blob/main/lib/vibe_web/telemetry.ex): `lib/vibe_web/telemetry.ex`
- [Ecto repository](https://github.com/sahishnucb/vibe/blob/main/lib/vibe/repo.ex): `lib/vibe/repo.ex`

### Other components

- **Room clients**

## Connections

- Room clients → LiveView routes: opens room (evidence: `lib/vibe_web/router.ex`)
- LiveView routes → Room selection: routes to (evidence: `lib/vibe_web/router.ex`)
- LiveView routes → Room interface: routes to (evidence: `lib/vibe_web/router.ex`)
- LiveView routes → YouTube search: routes to (evidence: `lib/vibe_web/router.ex`)
- Room clients → Room interface: sends events (evidence: `README.md`)
- Room interface → Room state process: updates state (evidence: `README.md`)
- Room state process → Phoenix PubSub: broadcasts state (evidence: `lib/vibe/room_server.ex`)
- Phoenix PubSub → Room clients: broadcasts updates (evidence: `README.md`)
- Room interface → Room chat: handles chat (evidence: `README.md`)
- Room interface → Playback state: controls playback (evidence: `README.md`)
- YouTube search → YouTube API: searches videos (evidence: `README.md`)
- YouTube search → Search suggestions: uses suggestions
- YouTube API → Video playback embed: provides media (evidence: `README.md`)
- OTP supervisor → Room state process: starts process (evidence: `lib/vibe/application.ex`)
- OTP supervisor → Phoenix PubSub: starts service (evidence: `lib/vibe/application.ex`)
- OTP supervisor → Phoenix endpoint: starts endpoint (evidence: `lib/vibe/application.ex`)
- OTP supervisor → Telemetry: starts service (evidence: `lib/vibe/application.ex`)
