Appearance
Architecture overview
Bitstream splits the work in two: a control plane that knows everything and streams nothing, and nodes that stream everything and know only what they need.
The parts
bs-control is the brain. It serves the admin API (used by the panel, scripts and agents) and the Xtream compatible client API (used by IPTV apps). It checks every viewer, counts connections, picks a node and signs a short play token. It tells nodes what to run over one WebSocket per node. It never runs ffmpeg and never carries video unless you ask it to (proxy delivery).
bs-node is the muscle. It opens each channel once, keeps it alive with fallback sources, and hands the same bytes to every viewer from a memory buffer. It builds HLS itself. It can relay a channel to other nodes. It never touches the database and never sees a client password: it trusts a play token signed by the control.
PostgreSQL is the source of truth: users, lines, catalog, nodes, settings, logs.
Redis holds live state that can be rebuilt: connection slots, rate limits, node stats, caches and change events. See Redis keys.
bs-license is run by the platform. At setup every panel gets a free license key, then checks in once a day. There are no limits, and an offline license server never blocks anything. See Free, with a license.
The web panel is a Vue single page app. It only knows the public admin API, so anything the panel does, you can script. It is written to be open sourced on its own.
The contracts
The parts only talk through a few written contracts:
| Contract | Between | Where |
|---|---|---|
| Admin API | panel, scripts and bs-control | spec/openapi/admin.yaml, reference |
| Client API | IPTV apps and bs-control | spec/client-api.md, reference |
| Node protocol and play token | bs-control and bs-node | core/internal/shared/nodeproto, playtoken, reference |
Why this shape
- Nodes are cheap and safe to add. A node holds no database credentials and no client passwords. If one is compromised, the attacker gets a few streams, not your business. In XC_VM every load balancer had the main MySQL and Redis passwords.
- One place decides. Connection limits are counted atomically in Redis by the control, so two nodes can never both let the same line in past its limit.
- Nodes keep working. If the control or Redis goes down, viewers already watching keep watching. Only new connections fail, and they fail closed.
The control is a single point of failure in this first version. That is a known, documented trade-off.