How arunnkutty/videostreaming works
Project Type & Purpose
• This is a full-stack video streaming and email-scheduling platform.
• Frontend: TypeScript/React app (HLS.js video player, scheduling UI).
• Backend: Python FastAPI monolith providing video APIs, upload/processing (FFmpeg + HLS), email scheduling (APScheduler + Resend), and health endpoints.
Main Components
a. Frontend (Browser/React App)
• Video Player component (HLS.js)
• Video Scheduler component (FullCalendar.js UI)
• HTTP calls to backend REST API
b. Backend (FastAPI Server)
• API Routes layer (/api/v1/health, /videos, /schedules, /calendar)
• Core layer (config, error handling)
• Models layer (Pydantic schemas for video & schedule)
• Services layer:
• video_service (invokes FFmpeg, writes HLS segments to local storage)
• scheduler_service (APScheduler job registration & management)
• email_service (calls Resend API with chosen template)
• Static file server (serves /videos/[video‐id]/index.m3u8 and .ts segments)
c. Storage & External Systems
• Local File System storage (“videos” directory)
• External Email API (Resend)
• FFmpeg process (for video ingestion → HLS conversion)
Relationships & Data Flows
• User’s browser → HTTP(S) → Frontend React App
• React App → REST API calls → FastAPI server
• FastAPI video upload endpoint → FFmpeg → write HLS segments → videos/ directory
• FastAPI HLS endpoints → serve .m3u8 + .ts files back to React/HLS.js
• React/HLS.js streams video segments in real time
• Scheduler creation calls FastAPI → scheduler_service registers APScheduler job
• APScheduler (in-process background) triggers job at scheduled times → calls email_service → Resend API → email delivered
• Calendar UI fetches scheduled events from FastAPI → FullCalendar renders on React side
Architectural Patterns & Design Principles
• Layered architecture: API → services → models → storage
• Separation of concerns: video logic vs. scheduling vs. emailing
• Monolithic deployment (single FastAPI container), but clearly modularized for future microservices split
• Use of background job scheduler (APScheduler) for decoupled timed tasks