Back to Home

WatchTV — Full-Stack Video Streaming Platform

WatchTV is a complete video streaming solution I built from scratch. It features a **passwordless email OTP login** system with JWT-based session management for users, and a separate email+password login for sub-admins. The backend runs on **Elysia.js (Bun)** with a **MongoDB + Prisma ORM** database, and integrates with **Cloudflare R2** (S3-compatible object storage) for all media assets. **Video Pipeline:** Videos can be uploaded directly via presigned URLs or imported from external URLs through an intelligent background queue that processes one video at a time. The import queue automatically detects file formats via Content-Disposition headers, URL extensions, and magic byte signatures. Once uploaded, a separate **HLS transcoding pipeline** (running externally via bash scripts) converts videos into adaptive-bitrate HLS streams with **multi-language audio tracks** and **subtitle support**. The system handles stalled/crashed transcoding jobs gracefully by detecting stale processing states (>6 hours) and re-queuing them. **Frontend:** The user-facing app (Next.js 16 with React 19) features an HLS.js-powered video player with **audio track switching**, **adaptive quality selection**, infinite-scroll catalog browsing, and an integrated support ticket system where users can create and track tickets. The admin panel (separate Next.js app using Ant Design) provides dashboard cards for uploading videos, importing from URLs, managing users, and bulk video management with selective deletion of HLS/output files independently. **Architecture:** The entire project is organized as a **Turborepo monorepo** managed with Bun, with shared types between frontends and backend via Elysia Eden treaty client for end-to-end type safety.

Tech Stack

BunElysia.jsNext.js 16React 19TypeScriptTurborepoMongoDBPrisma ORMCloudflare R2 (S3-compatible)HLS.jsFFmpeg / HLS transcodingAnt DesignTailwind CSS v4shadcn/uiNodemailerJWTEden (Elysia treaty client)

Key Features

  • Passwordless OTP email authentication with auto-user creation on first login
  • Separate sub-admin authentication (email + password) for admin panel
  • HLS adaptive-bitrate video streaming with multi-audio track switching
  • Video player with quality level selection and audio language switching
  • Presigned URL direct upload to Cloudflare R2
  • Remote URL import with automatic format detection and sequential queue processing
  • External HLS transcoding pipeline with multi-audio/subtitle track support
  • Support ticket system with user/admin messaging and status tracking
  • Admin dashboard for video management (bulk delete with selective R2 cleanup)
  • User management (view all registered users)
  • HLS regeneration capability
  • Infinite-scroll video catalog with search and filtering
  • Dark/light mode responsive UI
  • Monorepo architecture with shared types and Elysia Eden type-safe API client