PulseStream is an enterprise-grade, high-performance video streaming backend API. Engineered as a robust monolith, it is designed to handle complex relational data, hierarchical content delivery (Movies and TV Shows), and memory-optimized video streaming using HTTP 206 Partial Content protocols.
This platform is built with a focus on high concurrency, data integrity, and strict architectural boundaries, moving beyond standard CRUD operations.
Instead of loading massive .mp4 files directly into server RAM, PulseStream utilizes Spring Boot's ResourceRegion to deliver video in byte-range chunks. This allows the client side to buffer efficiently and prevents server Out-Of-Memory (OOM) exceptions under heavy viewer load.
- N+1 Query Eradication: Utilizes
@NamedEntityGraphand@EntityGraphto fetch deep relational hierarchies (e.g., fetching a Profile, its Watch History, and the associated Content) in a single optimized SQL join. - Composite Key Architecture: Employs
@EmbeddedIdand@MapsIdin intersection tables (my_list) to enforce strict, database-level data integrity without redundant surrogate keys. - Lazy Loading by Default: All
@ManyToOneand@OneToManyrelationships are strictly mapped withFetchType.LAZYto prevent accidental data cascades.
Data validation is strictly decoupled from the @Entity layer. All incoming traffic is intercepted by immutable Data Transfer Objects (DTOs) equipped with advanced Regex and boundary constraints, backed by a global @RestControllerAdvice exception handler that returns standardized 400 Bad Request JSON maps.
The PostgreSQL 18 database is highly normalized and logically segmented into three core domains:
users: Core account management, secure authentication credentials, and subscription tiers.profiles: Multi-profile support per user (similar to Netflix), enforcingMaturityRatingconstraints (e.g., G, PG-13, R).
content: The master table mapping the core media metadata (Titles, Release Dates, Media Types).seasons&episodes: Hierarchical one-to-many structures specifically mapping episodic TV show data and runtime tracking.genres: A many-to-many taxonomy mapped via a hiddencontent_genresbridge table.
watch_history: Tracks precisestopped_at_secondstimestamps using@UpdateTimestamp, powering the "Continue Watching" engine.my_list: Bookmark engine enforcing unique profile-to-content relationships via composite primary keys.
- Core: Java 25
- Framework: Spring Boot 4.0.6 (Web, Data JPA, Validation)
- Database: PostgreSQL 18
- Build Tool: Maven Wrapper
- Utilities: Lombok (Strictly controlled, avoiding
@Dataon entities) - Architecture Pattern: Monolithic API / Controller-Service-Repository Pattern
- JDK 25+
- PostgreSQL 18
- Maven
git clone [https://github.com/YourUsername/PulseStream.git](https://github.com/YourUsername/PulseStream.git)
cd PulseStream