# farouq-gfishi/containerized-video-streaming-system architecture

> Architecture diagram of the GitHub repository farouq-gfishi/containerized-video-streaming-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farouq-gfishi/containerized-video-streaming-system
- Repository: https://github.com/farouq-gfishi/containerized-video-streaming-system

## Overview

##### Project Type and Purpose
- This is a full-blown microservices-based, containerized video streaming platform.
- Its purpose: let authenticated users upload MP4 videos, store metadata in MySQL, store files via a file-system microservice, and stream those videos on demand.

##### File Structure
- Top-level directories:
- authentication/ (Spring REST service for login)
- file-system-service/ (Spring REST service for file I/O)
- upload-video/ (Spring MVC service with HTML upload UI)
- video-streaming-service/ (Spring MVC service with HTML streaming UI)
- docker-compose.yml (orchestrates all containers, including MySQL)
- Common elements: each service is a Spring Boot app (pom.xml, Dockerfile) packaged and deployed as its own container.
- file-system-service/videos holds the actual video files on disk.

##### Pull Architecture Details from the README
- Four microservices plus MySQL DB.
- REST interfaces between services.
- Docker Compose for multi-container orchestration.
- Clients: static HTML pages in the MVC services.
- Auth is first in the call chain; DB holds metadata; file service holds blobs.

##### Main Components
a. External Actors
- Web Browser (uploads or streams videos)
- (Optional) CLI or REST client for programmatic access
b. Microservices Layer (each as a separate container)
- Authentication Service (validates credentials)
- Upload-Video Service (accepts upload, calls Auth, writes metadata to DB, stores file via File System Service)
- Video-Streaming Service (serves video pages, calls Auth, fetches metadata from DB, streams file via File System Service)
- File-System Service (REST API to save/load video files to a shared volume)
c. Data Layer
- MySQL Database Container (video metadata: name, path)
- Shared File Storage Volume (mounted by file-system-service)

##### Relationships and Data Flows
- Upload Flow: Browser → Upload Service → Auth Service → (on success) Upload Service → MySQL → File-System Service → Shared Volume
- Streaming Flow: Browser → Video-Streaming Service → Auth Service → (on success) Video-Streaming Service → MySQL → File-System Service → Shared Volume → Browser
- Inter-service calls are REST over HTTP, internal to Docker network.

##### Architectural Patterns and Key Technologies
- Pattern: Microservices, each single-responsibility, communicating via REST.
- Containerization: Docker + Docker Compose.
- Frameworks: Spring Boot (REST & MVC), MySQL (JDBC/Hibernate).
- Deployment: Each service has its own Dockerfile and Maven build, orchestrated by docker-compose.yml.

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef service fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef database fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef volume fill:#98FB98,stroke:#333,stroke-width:1px;
    classDef client fill:#FFD700,stroke:#333,stroke-width:1px;

    Browser["Web Browser"]:::client

    subgraph "Container Platform (Docker Compose)"
        subgraph "Services"
            Auth["Authentication Service"]:::service
            Upload["Upload-Video Service"]:::service
            Stream["Video-Streaming Service"]:::service
            FileSys["File-System Service"]:::service
        end
        subgraph "Data"
            MyDB[(MySQL Database)]:::database
            Volume[(File Storage Volume)]:::volume
        end
    end

    Browser -->|"POST /upload"| Upload
    Upload -->|"REST /login"| Auth
    Auth -->|"200 OK"| Upload
    Upload -->|"INSERT metadata"| MyDB
    MyDB -->|"ACK"| Upload
    Upload -->|"REST /saveVideo"| FileSys
    FileSys -->|"writes file"| Volume
    FileSys -->|"200 OK"| Upload
    Upload -->|"200 OK"| Browser

    Browser -->|"GET /stream page"| Stream
    Stream -->|"REST /login"| Auth
    Auth -->|"200 OK"| Stream
    Stream -->|"QUERY metadata"| MyDB
    MyDB -->|"metadata JSON"| Stream
    Stream -->|"REST /getVideo"| FileSys
    FileSys -->|"reads file"| Volume
    Volume -->|"video data"| FileSys
    FileSys -->|"stream chunk"| Stream
    Stream -->|"video stream"| Browser

    click Auth "https://github.com/farouq-gfishi/containerized-video-streaming-system/tree/master/authentication/"
    click FileSys "https://github.com/farouq-gfishi/containerized-video-streaming-system/tree/master/file-system-service/"
    click Upload "https://github.com/farouq-gfishi/containerized-video-streaming-system/tree/master/upload-video/"
    click Stream "https://github.com/farouq-gfishi/containerized-video-streaming-system/tree/master/video-streaming-service/"
    click MyDB "https://github.com/farouq-gfishi/containerized-video-streaming-system/blob/master/docker-compose.yml"
    click Volume "https://github.com/farouq-gfishi/containerized-video-streaming-system/tree/master/file-system-service/videos/"
```
