Web AppProjects

Re-broadcast Control Room

A desktop control room for live commerce that packs a Go backend, an ffmpeg engine and a React SPA into one easy-to-install app. It loops recorded clips out as a stable live stream, with overlays, live chat and automatic product pinning through a browser oracle, and the data never leaves the user's machine.

11 min read

A desktop app that packs a Go backend + ffmpeg engine + React SPA into a single app. It loops recorded clips out over RTMP as a live stream, with clock/text overlays, live chat, product pinning and multi-account control from one screen, and the data never leaves the machine.

ElectronGo 1.26chi + sqlcffmpeg / RTMPSQLiteReact 19 + ViteSSEZitadel OIDC
Empathize · Define

The problem

Live sellers need to be on air almost all the time, but talking live day and night is a path to burnout

A video library with 3 product clips
The library of recorded clips: raw material for re-airing (demo data)

Shops that sell through live streams need to stay "on screen" as long as possible to make sales, but nobody can talk live all day, especially on the night shift. The usual setup is OBS + scripts + several VMs wired together by hand. It's fragile and often breaks mid-stream, and with several accounts or rooms at once it gets out of control. The brief: one control room that loops "recorded clips" out as a stable live stream.

— The starting brief, before building the re-broadcast app

Nobody can stream live all day

Sales are tied to airtime, but people have limits, especially late at night. Recorded clips need to be re-aired in a way that still feels close to a real live stream for viewers.

Tooling = hand-wired, fragile, easy to break

OBS + scripts + several VMs wired together, with no central control. When the stream drops, someone has to sit and restart it. No built-in auto-restart or keep-alive.

Many accounts and rooms, no single place to control them

Agencies run several brands at once, and each account needs its own identity and network egress. There was no single screen showing the status of every room.

Audio dropping out or going silent mid-stream

Some looped files have audio shorter than the video, or long silences in the middle, so the stream airs silence without anyone noticing and loses customers for nothing

Some actions the server can't call on its own

Things like chat, product pinning and reading live sales need a "request signature" generated by the platform's JS in a logged-in web page. The backend can't send them directly.


Ideate

The solution

Bring every piece that used to be wired by hand into one desktop app — open it and it works, no server to set up

Settings for automatically ending and restarting the live stream
Auto end/restart — streams loop without anyone watching

A local re-air engine

ffmpeg pushes clips over RTMP with -c copy at native frame rate (no re-encoding unless needed) + keep-alive pings to the room + auto-stop/auto-restart when the stream stalls

Everything packed into one app

Electron wraps the Go backend (spawned as a loopback sidecar), static ffmpeg and the React SPA in one package. Users don't install Docker, Go or Node; install and it runs.

A command center for every room

A single React console shows every session: start/stop the stream, switch clips, set overlays, watch chat and live sales, clearly separated by account

Built-in audio dropout guard

A pre-flight ffprobe check on each file (short audio / no audio) before going live + monitoring for long silences on air, so silence never goes out

A browser oracle as the "signer"

A hidden, logged-in window sends requests from inside the web page so the platform's own JS adds the signature. This unlocks chat, product pinning and GMV that the server can't sign itself.


Prototype

How it works — 4 steps

From picking a clip to looping it out live with chat and live sales

Step 4 of 6 in adding a live account: choosing products to pin
A 6-step wizard — the step for choosing the product set to pin
1

Prepare the session

Pick clips + set overlay / proxy / the product set to pin

2

Go live

The backend opens the room + ffmpeg pushes RTMP + keep-alive pings

3

Oracle listens live

The hidden window decodes chat/GMV → backend → SSE → console

4

Watch + loop

Audio dropout monitoring + auto-restart keep the stream going to the end


Prototype

Tech Stack & Architecture

One family of processes on the seller's machine — no cloud app server, no per-shop infrastructure

The system activity log, showing time, action and reference ID
Workspace activity log (operator names blurred)
React SPA Console (Vite + Tailwind v4 + shadcn/ui)
control-room session-detail overlay / basket chat + GMV panel
↕
Electron main — spawn sidecar + oracle
wait /healthz first-party OIDC loopback partitioned windows bundle ffmpeg
↕
Go backend (chi + sqlc) — re-air engine + SSE broker
sessions / media overlay / basket gmv / chatreply vault / egress
↕
SQLite (file:) + ffmpeg (RTMP) + object store + Zitadel OIDC
goose migrations -c copy push video clips (S3) workspace_id tenancy
Why this stack?

Electron wrapping a Go sidecar — packs backend + ffmpeg + SPA into one app with zero setup for users, and the window opens on the backend's origin so the OIDC login flow is first-party · SQLite (file: DSN) — desktop mode runs self-contained, migrates on start, no DB server · Go (chi + sqlc) — production shape: no ORM, no inline SQL, multi-tenant with workspace_id from day one · React 19 + Vite + Tailwind v4 — a console the backend serves itself on the same origin


Prototype

What I built — 8 core capabilities

Taken from a proven POC, then ported to behave the same on a Go / React / Electron stack

Overlay settings page: an LED-style digital clock and text over the clip
Overlay Compositor: LED clock + text with adjustable position, color and angle

Re-air Engine

ffmpeg pushes RTMP with -c copy at native rate + keep-alive pings + auto-stop/restart — the core that loops clips out as a live stream

Overlay Compositor

LED clock / text over the video with filter_complex + live repositioning via ZMQ — re-encodes only sessions that have an overlay

Audio-Drop Guard

Pre-flight ffprobe catches NO_AUDIO/AUDIO_SHORT + runtime silencedetect — no silent airtime

Browser Oracle

A hidden partitioned window per account runs preloaded executeJavaScript so the web page signs requests itself — the shared base that chat, basket and GMV all use

Realtime Chat

The oracle decodes live comments/viewers → /ingest/chat → SSE broker fan-out → console panel (dedup by msgId)

Manual Reply

Replies typed in the UI → in-memory queue → the oracle sends message/chat from the web page → shown only once actually delivered (not optimistic)

Product Pin (basket)

Prepare product sets (product_sets) → go live → pin queue + afterLive hook → the oracle pins automatically, with a "Pinned X/X" status

Per-Account Egress

Network egress per account (utls fingerprint + SOCKS5/HTTP CONNECT) — each identity's traffic is clearly separated


Prototype

The Session Console

Open a clip → go live → see chat, viewers, sales and overlays together on one screen

A session page during a live stream, showing keep-alive, products in the stream, live chat and the event log
Session console: keep-alive · products in the stream · live chat · event log
▶ Go Live Overlay Basket LIVE
Live now — re-airing a recorded clip · uptime 01:12:40
clip: promo-spring-set.mp4 · -c copy · native-rate
1,284 viewers Pinned 6/6 audio ok
ChannelLiveDetails
Chat SSE 42 messages/min · live replies reply
GMV poll 45s Live sales · top 5 SKUs panel
Overlay on Clock + text · ZMQ move edit
# re-air engine — stream-copy, no re-encode
ffmpeg -re -i clip.mp4 -c copy -f flv 'rtmp://live.…/app/<stream-key>'

Test & Iterate

Hacks and problems

6 engineering problems I had to solve myself — desktop runtime + media core + browser automation

The Q&A tab for setting up keyword auto-replies
Keyword-based chat auto-replies — actually sent through the browser oracle

Combining 3 processes into one easy-to-install app

The Go backend, ffmpeg and the SPA are separate runtimes. Sellers can't be asked to install each one, so they have to be packaged together with a smooth lifecycle.

Fix: Electron main spawns the Go binary as a sidecar (loopback) and waits for /healthz 200 before opening the BrowserWindow on the backend's origin, so the OIDC login → callback → cookie flow is entirely first-party · static ffmpeg ships inside the package (electron-builder)

Overlays vs. the "no re-encode" rule

The re-air core is locked to -c copy (invariant: no re-encode = constant quality and CPU), but drawing a clock or text has to go through filter_complex, which means re-encoding

Fix: enable a re-encode branch (libx264 + filtergraph) only for sessions with an overlay — sessions without one stay exactly -c copy · a deliberately narrow decision at the media-core level

A silence detector can't go into a stream-copy

silencedetect is an audio filter (-af), but the main push is -c copy — adding -af directly breaks stream-copy

Fix: run a second ffmpeg in parallel (-af silencedetect -f null -) as a co-goroutine that decodes only the audio and discards it — the main push stays -c copy and the video is untouched · stderr is scanned live instead of reading the whole log file

Some actions need a signature from a logged-in web page

Chat, product pinning and GMV need a request signature generated by the platform's JS in a logged-in page — Go can't sign them itself

Fix: a browser oracle — a hidden BrowserWindow per account (session.fromPartition) takes jobs from the backend over validated IPC (sender id + size cap), then calls a preloaded executeJavaScript function (no string-interpolating logic into the remote page) so the web page fetches and signs itself → returns the result

Chat and GMV are live data — not every item belongs in the DB

Comments and live sales stream in very fast. Writing every event to the DB = a bottleneck, and there's no need for history across restarts

Fix: an SSE broker as the live transport — chat/GMV/pin are ephemeral (in-memory queue, fan-out over SSE) and never touch the DB · only what really needs to persist (product_sets, overlay config, accounts) is stored, through migrations

Per-account credentials must never leak

Each identity's cookies and credentials are the most sensitive secrets — the moment they're stored in plaintext or logged, it's over

Fix: vault envelope encryption (AES-256 via the OS keychain) for every secret · only the length is logged, never the value · desktop↔backend uses a per-machine key (constant-time bearer, loopback only) instead of a hardcoded static key

Define

Deliberate design decisions

A deliberately "narrow" scope — so it's implemented correctly and easy to maintain

The proxy settings step for a live account
A proxy per account — separate network egress for each identity

The whole system runs on the seller's machine: no central app server, credentials never leave the machine, re-encoding only when there's actually an overlay, and only what must survive a restart goes into the DB. A sharp scope from the start let every feature build on the same re-air core without bloating or slowing it.


Desktop-local

Runs on the seller's machine; data and credentials stay off the cloud


-c copy invariant

Re-encode only for sessions with an overlay


Transient by default

Chat/GMV are live; persist only what needs history


Every secret in the vault

Envelope encryption + log only the length, never the value


Level Up · Reflect

Knowledge domains that got stronger

5 areas where my level really moved up from this project

A table summarizing past live streams
Past live stream summary — viewers, sales and chat per stream (account names blurred)
1. Desktop app architecture (Electron + native sidecar) — from pure web to a real desktop app:

Packaging a native backend as a sidecar, managing its lifecycle (spawn → wait for /healthz → teardown), making OIDC login first-party through a loopback origin, and bundling per-target binaries with electron-builder (dmg/nsis). Lesson: "one app and done" for the user = several runtimes behind the scenes that have to be assembled smoothly.

2. Real-time media / ffmpeg engineering — understanding what every stage of the pipeline does:

RTMP push with stream-copy vs re-encode, writing filter_complex overlays, live repositioning via ZMQ, and silence detection with a parallel silencedetect that never touches the main push. Lesson: streaming isn't a black box — knowing when to copy and when to re-encode is how you control both CPU and quality.

3. A production-shaped Go backend — a structure that's actually maintainable:

chi + sqlc (no ORM, no inline SQL — enforced by tests), goose migrations embedded in the binary, multi-tenant with workspace_id on every query, and an SSE broker for live fan-out. Lesson: setting structural rules (tenant guard, no inline SQL) from day one lets the system grow without breaking.

4. Browser automation / signing oracle — work the server can't do itself:

A partitioned session per account, executeJavaScript calling preloaded functions (no string interpolation into the remote page), and validated IPC (sender id + size cap), along with understanding the tradeoffs of contextIsolation:false. Lesson: safe automation means strictly isolating untrusted contexts and talking only through channels you can verify.

5. Secure by default & scoping — "narrow" is good design:

Envelope encryption for every secret, a per-machine key instead of a static backdoor, logging only lengths, and deciding what persists and what's transient at design time. Lesson: good security starts with safe defaults and a sharp scope, not something patched on later.

8
Core features ported from the POC
40
Go internal packages (~26k lines)
3→1
processes (Go + ffmpeg + SPA) in one app
0
servers per shop — the desktop app is self-contained

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%