Full-Stack & Media Streaming

Filmexa: Angular & Spring Boot Streaming Platform

A full-stack movie discovery and streaming platform with torrent-based downloads, adaptive HLS playback, and on-the-fly FFmpeg transcoding.

Last updated:

Filmexa: Angular & Spring Boot Streaming Platform

Introduction

Filmexa is a movie discovery and streaming platform built as a team for the Hypertube project at 42, together with Marouane Addou, Mohamed Baanni, and Mohssen El Gandali. It brings movie discovery, torrent-based downloading, real-time streaming, adaptive playback, and user management into a single application.

Users can search, filter, and browse movies by category, watch trailers, build watchlists, comment, and manage their profiles in English, French, or Arabic. Development was organized with GitHub Projects, with more than 250 tasks completed across authentication, streaming, database design, testing, deployment, and infrastructure.

The problem

Hypertube asks for a web application where users search for a film and start watching it in the browser almost immediately, even though the file is not on the server yet: it has to be fetched over BitTorrent first. Torrents deliver pieces in arbitrary order, many releases are MKV files with codecs browsers cannot play, and a single film can weigh several gigabytes.

The platform therefore had to turn a slow, unordered, and often incompatible source into a smooth stream that starts within seconds, keeps working while several people watch different films, and does not fill the disk, all behind a properly secured account system.

Architecture

The frontend is an Angular 19 application written in TypeScript that uses HLS.js for adaptive playback. The backend is a Java 17 Spring Boot API built on Spring Security and Spring Data JPA with PostgreSQL, integrating TMDB for movie metadata and external torrent providers for content.

Movies are downloaded in the background with progress tracking, then transcoded on the fly with FFmpeg into multi-quality HLS streams, which also makes MKV files playable in the browser. A cleanup job removes inactive movie files automatically. The API is documented with OpenAPI/Swagger, the stack runs with Docker Compose, and GitHub Actions runs tests and build checks before deployment.

Implementation decisions

Sequential piece selection
Torrent clients normally fetch the rarest pieces first. Filmexa uses a sequential piece selector so the start of the file arrives first, and re-prioritizes pieces around the playhead when the viewer seeks, trading a little swarm efficiency for a fast start.
HLS instead of serving the raw file
Rather than streaming the original file with range requests, the backend transcodes it into HLS segments with FFmpeg. That makes MKV and other incompatible formats playable, lets HLS.js adapt quality to bandwidth, and keeps segments small enough to produce while the download is still running.
A quality ladder derived from the source
Output resolutions are computed from the source height, so a 720p release is never upscaled to 1080p and no transcoding time is wasted on renditions that add nothing.
Long-running work off the request path
Downloads and transcoding run on dedicated async executors and a shared torrent runtime pool, so API requests never wait on them and several films can be prepared and streamed concurrently.
Dedicated streaming tokens
The video player requests many small segment files that cannot easily carry an Authorization header. Segments are authorized with a short-lived streaming token, while the session itself relies on JWT access tokens and an HttpOnly refresh-token cookie.
Feature modules and scheduled cleanup
The Spring Boot backend is split into feature modules (auth, movies, categories, comments, download, streaming), and a scheduler deletes films nobody has watched recently, keeping disk usage bounded without manual work.

Technical challenges

  • Starting playback while a movie is still downloading, which required careful handling of buffering and HLS playlist generation
  • Transcoding to multiple quality levels on the fly with FFmpeg without blocking the API
  • Coordinating background downloads, concurrency, and error recovery across long-running asynchronous workloads
  • Securing the platform with JWT, refresh-token cookies, BCrypt, email verification, password recovery, rate limiting, and OAuth with 42, Google, and Facebook

Results

  • Playback starts while the film is still downloading, and seeking ahead re-prioritizes the pieces that are needed next
  • MKV and other formats that browsers cannot play natively stream in the browser through HLS
  • Several users can watch different films at the same time, including files that are only partially downloaded
  • A complete product delivered by a team of four across more than 250 tracked tasks, with a UI in English, French, and Arabic and OAuth sign-in with 42, Google, and Facebook
  • Tests and build checks run on every change with GitHub Actions, and the full stack runs with Docker Compose

Demo video

Related case studies