# prohibitedtv/bitriver-live architecture

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

- Interactive diagram: https://gitdiagram.com/prohibitedtv/bitriver-live
- Repository: https://github.com/prohibitedtv/bitriver-live

## Overview

BitRiver Live is a self-hosted streaming platform: creators publish RTMP streams, the Go control plane coordinates channel state and media services, and viewers discover and watch live video, chat, follow creators, and play VODs. The principal path runs from OBS through SRS and OME to the Next.js viewer, with API-managed channel mapping and transcoding; uploads form a separate creator-to-VOD path. README capabilities also include authentication, moderation, analytics, installation, and health operations. Edges are limited to README-documented flows or visible source references; several implementation details are unsampled.

Main entry points: [`cmd/server/main.go`](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/server/main.go) (Go API), [`web/viewer/app`](https://github.com/prohibitedtv/bitriver-live/tree/main/web/viewer/app) (Next.js viewer), [`web/viewer/lib/viewer-api-core.ts`](https://github.com/prohibitedtv/bitriver-live/blob/main/web/viewer/lib/viewer-api-core.ts) (Viewer API client), [`cmd/srs-controller/main.go`](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/srs-controller/main.go) (SRS controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_viewer["Viewer experience"]
  node_webviewer["Next.js viewer"]
  node_webapi["Viewer API client<br/>[viewer-api-core.ts]"]
  node_uploadui["Upload manager<br/>[UploadManager.tsx]"]
  node_chatclient["Chat client<br/>[chat-client.js]"]
end

subgraph group_control["Control plane"]
  node_controlapi["Go API<br/>[main.go]"]
  node_apihandlers["API handlers"]
  node_auth["Authentication"]
  node_chat["Chat gateway<br/>[gateway.go]"]
  node_ingestcontroller["Ingest controller<br/>[http_controller.go]"]
  node_installpreflight["Install preflight"]
  node_adminui["Control centre<br/>[app.js]"]
end

subgraph group_media["Media pipeline"]
  node_srscontroller["SRS controller<br/>[main.go]"]
  node_srs["SRS ingest"]
  node_ome["OME playback"]
  node_transcoder["FFmpeg transcoder<br/>[main.go]"]
end

subgraph group_persistence["Persistence and coordination"]
  node_postgres[("Postgres")]
  node_redis[("Redis")]
  node_storage["Storage layer<br/>[storage.go]"]
end

subgraph group_operations["Host operations"]
  node_installer["Installer wizard<br/>[installer.js]"]
  node_desktop["Host CLI<br/>[main.go]"]
end

node_creator(("Creator / OBS"))
node_viewers(("Viewers"))

node_creator -->|"publishes RTMP"| node_srs
node_srs -->|"publish callback"| node_srscontroller
node_srscontroller -.->|"authenticates callback"| node_controlapi
node_controlapi -->|"maps channel"| node_srs
node_srs -->|"forwards RTMP"| node_ome
node_ome -->|"serves LL-HLS"| node_webviewer
node_controlapi -->|"manages jobs"| node_transcoder
node_transcoder -->|"serves HLS"| node_webviewer
node_viewers -->|"browses and watches"| node_webviewer
node_webviewer -.->|"requests data"| node_webapi
node_webapi -.->|"calls API"| node_controlapi
node_uploadui -->|"creates uploads"| node_webapi
node_webviewer -.->|"uses chat"| node_chatclient
node_chatclient -->|"WebSocket events"| node_chat
node_controlapi -.->|"routes requests"| node_apihandlers
node_apihandlers -.->|"authenticates users"| node_auth
node_controlapi -.->|"persists product data"| node_storage
node_storage -.->|"reads and writes"| node_postgres
node_controlapi -.->|"coordinates services"| node_redis
node_creator -->|"manages channel"| node_webviewer
node_installer -->|"checks setup"| node_installpreflight
node_adminui -->|"requests status"| node_controlapi
node_desktop -.->|"manages host"| node_controlapi
node_ingestcontroller -.->|"coordinates ingest"| node_srscontroller

click node_webviewer "https://github.com/prohibitedtv/bitriver-live/tree/main/web/viewer/app"
click node_webapi "https://github.com/prohibitedtv/bitriver-live/blob/main/web/viewer/lib/viewer-api-core.ts"
click node_uploadui "https://github.com/prohibitedtv/bitriver-live/blob/main/web/viewer/components/UploadManager.tsx"
click node_chatclient "https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/chat-client.js"
click node_controlapi "https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/server/main.go"
click node_apihandlers "https://github.com/prohibitedtv/bitriver-live/tree/main/internal/api"
click node_auth "https://github.com/prohibitedtv/bitriver-live/tree/main/internal/auth"
click node_chat "https://github.com/prohibitedtv/bitriver-live/blob/main/internal/chat/gateway.go"
click node_ingestcontroller "https://github.com/prohibitedtv/bitriver-live/blob/main/internal/ingest/http_controller.go"
click node_srscontroller "https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/srs-controller/main.go"
click node_transcoder "https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/transcoder/main.go"
click node_storage "https://github.com/prohibitedtv/bitriver-live/blob/main/internal/storage/storage.go"
click node_installer "https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/installer.js"
click node_installpreflight "https://github.com/prohibitedtv/bitriver-live/blob/main/internal/api/installer_preflight.go"
click node_desktop "https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/bitriver/main.go"
click node_adminui "https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/app.js"

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_webviewer,node_webapi,node_uploadui,node_chatclient,node_viewers toneBlue
class node_controlapi,node_apihandlers,node_auth,node_chat,node_ingestcontroller,node_installpreflight,node_adminui toneAmber
class node_srscontroller,node_srs,node_ome,node_transcoder toneMint
class node_postgres,node_redis,node_storage toneRose
class node_installer,node_desktop,node_creator toneIndigo
```

## Components

### Viewer experience

- [Next.js viewer](https://github.com/prohibitedtv/bitriver-live/tree/main/web/viewer/app): `web/viewer/app`
- [Viewer API client](https://github.com/prohibitedtv/bitriver-live/blob/main/web/viewer/lib/viewer-api-core.ts): `web/viewer/lib/viewer-api-core.ts`
- [Upload manager](https://github.com/prohibitedtv/bitriver-live/blob/main/web/viewer/components/UploadManager.tsx): `web/viewer/components/UploadManager.tsx`
- [Chat client](https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/chat-client.js): `web/static/chat-client.js`

### Control plane

- [Go API](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [API handlers](https://github.com/prohibitedtv/bitriver-live/tree/main/internal/api): `internal/api`
- [Authentication](https://github.com/prohibitedtv/bitriver-live/tree/main/internal/auth): `internal/auth`
- [Chat gateway](https://github.com/prohibitedtv/bitriver-live/blob/main/internal/chat/gateway.go): `internal/chat/gateway.go`
- [Ingest controller](https://github.com/prohibitedtv/bitriver-live/blob/main/internal/ingest/http_controller.go): `internal/ingest/http_controller.go`
- [Install preflight](https://github.com/prohibitedtv/bitriver-live/blob/main/internal/api/installer_preflight.go): `internal/api/installer_preflight.go`
- [Control centre](https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/app.js): `web/static/app.js`

### Media pipeline

- [SRS controller](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/srs-controller/main.go): `cmd/srs-controller/main.go`
- **SRS ingest**
- **OME playback**
- [FFmpeg transcoder](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/transcoder/main.go): `cmd/transcoder/main.go`

### Persistence and coordination

- **Postgres**
- **Redis**
- [Storage layer](https://github.com/prohibitedtv/bitriver-live/blob/main/internal/storage/storage.go): `internal/storage/storage.go`

### Host operations

- [Installer wizard](https://github.com/prohibitedtv/bitriver-live/blob/main/web/static/installer.js): `web/static/installer.js`
- [Host CLI](https://github.com/prohibitedtv/bitriver-live/blob/main/cmd/bitriver/main.go): `cmd/bitriver/main.go`

### Other components

- **Creator / OBS**
- **Viewers**

## Connections

- Creator / OBS → SRS ingest: publishes RTMP (evidence: `README.md`)
- SRS ingest → SRS controller: publish callback (evidence: `README.md`)
- SRS controller → Go API: authenticates callback
- Go API → SRS ingest: maps channel (evidence: `README.md`)
- SRS ingest → OME playback: forwards RTMP (evidence: `README.md`)
- OME playback → Next.js viewer: serves LL-HLS (evidence: `README.md`)
- Go API → FFmpeg transcoder: manages jobs (evidence: `README.md`)
- FFmpeg transcoder → Next.js viewer: serves HLS (evidence: `README.md`)
- Viewers → Next.js viewer: browses and watches (evidence: `README.md`)
- Next.js viewer → Viewer API client: requests data
- Viewer API client → Go API: calls API
- Upload manager → Viewer API client: creates uploads (evidence: `web/viewer/components/UploadManager.tsx`)
- Next.js viewer → Chat client: uses chat
- Chat client → Chat gateway: WebSocket events (evidence: `web/static/chat-client.js`)
- Go API → API handlers: routes requests
- API handlers → Authentication: authenticates users
- Go API → Storage layer: persists product data
- Storage layer → Postgres: reads and writes
- Go API → Redis: coordinates services
- Creator / OBS → Next.js viewer: manages channel (evidence: `README.md`)
- Installer wizard → Install preflight: checks setup (evidence: `web/static/installer.js`)
- Control centre → Go API: requests status (evidence: `web/static/app.js`)
- Host CLI → Go API: manages host
- Ingest controller → SRS controller: coordinates ingest
