A scalable, microservices-based video streaming platform inspired by YouTube and Netflix.
This project demonstrates how modern streaming systems work internally - from video upload to distributed processing and adaptive streaming using HLS.
This platform allows users to upload videos, which are then asynchronously processed into streamable formats and served efficiently using chunk-based streaming.
The system is designed with scalability, fault tolerance, and real-world architecture patterns in mind.
- Microservices architecture using Spring Boot
- Event-driven processing using Kafka
- Cloud storage integration using Cloudflare R2 (S3-compatible)
- Video transcoding using FFmpeg
- HLS (HTTP Live Streaming) generation for adaptive playback
- Scalable and decoupled system design
The platform is built using a microservices architecture where each service is responsible for a specific domain. Services communicate via REST APIs and asynchronous Kafka events.
-
API Gateway
- Single entry point for all client requests
- Handles routing and authentication headers
-
User Service
- Manages authentication and user data
- Issues JWT tokens
-
Video Service
- Stores video metadata
- Publishes events when a video is uploaded
- Tracks processing status and manifest URL
-
Upload Service
- Handles video uploads
- Stores raw videos in Cloudflare R2
-
Processing Service
- Consumes Kafka events
- Downloads raw video from R2
- Transcodes video using FFmpeg
- Generates HLS (m3u8 + .ts segments)
- Uploads processed files back to R2
- Updates video status
-
Like Service
- Handles like/unlike functionality
- Tracks like counts
-
Comment Service
- Manages video comments
-
Event Library
- Shared module for Kafka event schemas
User Uploads Video
β
Upload Service β Stores in R2
β
Video Service β Saves metadata + emits Kafka event
β
Processing Service (Consumer)
β
Download video from R2
β
FFmpeg processing (HLS generation)
β
Upload processed files to R2
β
Update Video Service (READY + manifest URL)
β
Client streams video using HLS
- Java 21
- Spring Boot
- Spring Security (JWT Authentication)
- Spring Data JPA
- PostgreSQL
- Apache Kafka
- Cloudflare R2 (S3-compatible object storage)
- FFmpeg (HLS transcoding)
- Spring Cloud Gateway
- Docker (Kafka setup)
- Maven (multi-module project)
- Master playlist (
master.m3u8) for adaptive bitrate streaming - Frontend video player using HLS.js
- Video buffering optimization
- User registration and login
- JWT-based authentication
- Secure API access via API Gateway
- Upload videos to cloud storage (R2)
- Store video metadata in database
- Track video processing status
- Event-driven architecture using Kafka
- Decoupled upload and processing pipeline
- Fault-tolerant video processing workflow
- Retry mechanisms for failed processing jobs
- Dead-letter queue (Kafka) for failed events
- Transcoding using FFmpeg
- HLS (HTTP Live Streaming) generation
- Segment-based streaming (
.m3u8+.tsfiles)
- Like / Unlike videos
- Like count tracking
- Comment system for videos
- Raw video storage in Cloudflare R2
- Processed video segments stored in R2
- Structured storage using object keys
- Microservices-based design
- Independent service deployment
- Easy horizontal scaling
The following features and improvements are planned to evolve the platform further:
- Thumbnail generation using FFmpeg
- Preview clips (short snippets)
- Video duration extraction
- Redis caching for frequently accessed data
- CDN integration for faster video delivery
- Parallel video processing (multi-worker support)
- Batch processing optimizations
- Rate limiting at API Gateway
- Logging improvements (structured logs)
- Metrics & monitoring (Prometheus/Grafana)
- Processing status tracking
- Video search functionality
- Recommendation system (basic)
- Subscription / follow system
- Share feature (v2)
- Full Docker Compose setup
- CI/CD pipeline (GitHub Actions)
- Kubernetes deployment
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software with proper attribution.
If you find this project useful:
- β Star the repository
- π΄ Fork and contribute
- π§ Share ideas and improvements
For discussions, suggestions, or collaboration:
- Open an issue
- Start a discussion
This project is a continuous effort to explore and implement real-world distributed system design for video streaming platforms.
Contributions, feedback, and ideas are always welcome!