VOD Docs

Trade-offs

The main design choices, what each one costs, and when it would change.

DecisionBenefitCostRevisit when
tus via tusd instead of uploads through the APIResumable; API stays freeOne more stateful service; every byte hops twiceIngest bandwidth becomes the bottleneck → presigned multipart direct to storage
HLS instead of progressive MP4Adaptive quality, cacheable segments, seeking without range tricksMany small files; packaging step— (HLS is the standard choice)
MPEG-TS segmentsMaximum compatibilityMore overhead than fMP4; TS-onlyAdding HEVC/AV1 or DASH → CMAF/fMP4
Seven fixed renditionsSimple, predictableWastes bits on easy content, too few for hard contentEncoding cost matters → per-title ladders
Two-pass pipeline (encode MP4, then segment)Each stage is simple and debuggableDecodes the source many times; extra diskThroughput matters → single-pass multi-output encode
One video at a timePredictable CPU and memory; videos finish in orderThroughput capped at one videoMore hardware → parallel workers with per-video ownership
Redis lock + DB queueQueue state visible and editable with SQLLock release must be correct on every path—
CeleryRich workflow primitives, retries, ecosystemCanvas semantics are subtle (see the incident)Workflows get complex → a workflow engine such as Temporal
Synchronous SQLAlchemySimple, matureasync handlers must not call it directlyHigh concurrency → async driver or more workers
Single VPSCheap, simple to reason aboutSingle point of failure; no isolation between tiersReal traffic or SLAs → split tiers, managed services
Media served through the proxy from object storageNo Python in the hot path; CDN-readyAll egress from one server todayAny real audience → CDN
JWT access + DB-tracked refresh tokensStateless request auth; revocable sessionsAccess tokens cannot be revoked before expiryInstant revocation needed → short TTL plus a denylist
Tokens in localStorageSimple; works across reloadsReadable by any script on the pageHardening → httpOnly refresh cookie, in-memory access token
Client-rendered pagesSimple data flow with TanStack QueryNo per-video metadata in initial HTML (SEO, link previews)Discoverability matters → server components
Frontend on Vercel, backend self-hostedGlobal frontend delivery, independent deploysTwo platforms to operate—