Skip to content
All work

Case studyFull-Stack Streaming Platform

IMG The Label

A full-stack subscription and PPV media streaming platform for films, series, music, and masterclasses with direct-to-R2 multipart uploads, distributed FFmpeg HLS transcoding, and edge-authenticated playback.

Client projectLead Full-Stack & Infrastructure Engineer

www.imgthelabel.com

01

Overview

Type
Full-Stack Streaming Platform
Role
Lead Full-Stack & Infrastructure Engineer
Ownership
Client project
Year
2026 – Running
Live
www.imgthelabel.com

02

The problem

Independent media labels often rely on expensive third-party video hosts or fragile monolithic backends that bottleneck when handling large raw video uploads, transcoding, and gated streaming. IMG The Label needed an end-to-end platform to sell memberships and individual titles while keeping raw video bytes off the API server, protecting private media behind strict entitlement checks, and delivering smooth adaptive playback across desktop and mobile browsers (including Safari/iOS).

03

What I built

  • 01Built a monorepo platform featuring a member-facing streaming app and a dedicated admin portal using Next.js 16, React 19, Tailwind CSS, Zustand, and TanStack Query
  • 02Engineered a NestJS 11 and Prisma 7 REST API backed by PostgreSQL 17 and Redis with role-based access control, JWT memory-token rotation, and Zod-validated contracts
  • 03Implemented zero-byte-API browser-to-Cloudflare-R2 presigned multipart uploads with deterministic 5-stage lifecycle tracking and skeleton-first progress UI
  • 04Built an isolated BullMQ + FFmpeg transcoding worker on a separate AWS EC2 compute node to generate adaptive HLS streams, audio tracks, and time-limited previews
  • 05Deployed a Cloudflare Stream Worker to verify HMAC-SHA256 signed, scope-restricted playback tokens at the edge before serving segments from private R2 storage
  • 06Integrated Payline hosted card fields with server-authoritative webhook processing to grant and revoke subscriptions and title entitlements securely
  • 07Automated zero-downtime Blue-Green Docker deployments to AWS EC2 and the worker host via GitHub Actions with change-detected service builds

04

A hard part I solved

Secure, Cacheable Edge Streaming Across Browsers (Without Exposing Private R2 Media): Serving protected HLS video and single-file audio (audio.m4a) from private Cloudflare R2 without routing media traffic through the NestJS API required a custom Cloudflare Worker (stream-worker) enforcing HMAC-SHA256 signed URLs scoped to either full or preview access. Two subtle production bugs emerged under real traffic: first, caching responses at the edge using a tokenless internal cache key saved lowercase response headers, so spreading CORS headers on cache hits produced duplicate Access-Control-Allow-Origin headers and caused browsers to reject playback; normalizing the Headers object on cache hits resolved it. Second, Safari/iOS refused to play or seek single-file audio streams without exact HTTP 206 Partial Content Content-Range headers derived from R2's range metadata (offset, length, or suffix), which we implemented directly in the worker alongside background playback continuity fixes.

05

Stack

  • Next.js 16
  • React 19
  • TypeScript
  • Tailwind CSS
  • Motion
  • Zustand
  • TanStack Query
  • Zod
  • NestJS 11
  • Prisma 7
  • PostgreSQL 17
  • Redis
  • BullMQ
  • FFmpeg
  • HLS.js
  • Cloudflare R2
  • Cloudflare Workers
  • AWS EC2
  • Docker
  • GitHub Actions
Next projectBloodaidbd