Skip to content
Back to Work
Open Sourcefrontendbackendai-mldevops

YT Player

A full-stack, YouTube-like video streaming platform with an AI-powered processing pipeline. It ingests video URLs, transcodes them into multiple quality levels (HLS + DASH), generates AI captions/subtitles, detects chapters, creates thumbnail sprites, and serves everything through a polished adaptive bitrate player.

TypeScriptReact 19Fastify 5PrismaPostgreSQLRedisBullMQFFmpegOPENAI WhisperHLS.jsdash.jsTailwind CSSViteshadcn/uiDockerAWS S3MinIOTurboRepopnpm WorkspacesTerraformGithub Actions

Problem

Building a production-grade video streaming platform requires orchestrating multiple complex systems — video transcoding, adaptive bitrate streaming, AI-powered speech-to-text, asset management, and background job processing — all working together seamlessly. Existing solutions are either closed-source (YouTube) or lack the full pipeline (basic FFmpeg scripts) needed for a complete streaming experience.

Approach

Designed a modular monorepo architecture with 7 independent packages (shared, database, storage, queue, pipeline, api, web) connected through typed interfaces. The processing pipeline runs as background BullMQ workers with 6 specialized queues for parallel execution. Each video goes through a 10-step pipeline: download → transcode → caption → chapters → thumbnails → AI descriptions → S3 upload. The frontend uses HLS.js with dash.js fallback for true adaptive streaming across all browsers.

Key Engineering Decisions

1

Monorepo with Turborepo + pnpm Workspaces

Chose a monorepo over microservices for developer experience and type safety. Each package (shared, database, storage, queue, pipeline, api, web) has clear boundaries but shares TypeScript types end-to-end. Turborepo provides parallel builds and caching, cutting build times significantly.

2

BullMQ over RabbitMQ/Kafka

Selected BullMQ for its native Redis integration, retry logic, rate limiting, and priority queues. The 6 specialized queues (download, transcode, caption, chapter, thumbnail, upload) allow independent scaling and fault isolation without the overhead of a full message broker.

3

Dual Streaming Protocols (HLS + DASH)

Implemented HLS as the primary protocol with DASH fallback to maximize browser compatibility. HLS.js handles most modern browsers while dash.js covers edge cases. This ensures seamless playback without codec negotiation issues.

4

Whisper.cpp + Python Fallback

Built a dual speech-to-text system: whisper.cpp (GGML) for fast local inference in production, with Python openai-whisper as a fallback for development. This gives flexibility between performance and ease of setup.

5

MinIO for Dev, AWS S3 for Prod

Abstracted storage behind an S3-compatible interface using MinIO locally and AWS S3 in production. Pre-signed URLs eliminate the need for the API to proxy video streams, reducing server load and improving latency.

6

Multi-stage Docker Builds

Created three optimized Dockerfiles (api, worker, web) with multi-stage builds. The API/worker images compile whisper.cpp from source, while the web image uses Nginx for static serving. This keeps production images minimal while including all dependencies.

Results

8

Quality Levels (144p → 4K)

6

Specialized Processing Queues

10

Pipeline Steps per Video

7

Modular Packages in Monorepo

3

AI Caption Providers (Whisper, GPT-4o, Claude)

<1s

API Response Time

Technologies

TypeScriptReact 19Fastify 5PrismaPostgreSQLRedisBullMQFFmpegOPENAI WhisperHLS.jsdash.jsTailwind CSSViteshadcn/uiDockerAWS S3MinIOTurboRepopnpm WorkspacesTerraformGithub Actions

Links