Skip to content

Pharrellstu/Data-Processing

Repository files navigation

StreamFlix Data Processing System

1. Project Overview

StreamFlix is a comprehensive data processing system designed to manage a streaming platform's backend operations. It handles user accounts, profiles, subscriptions, media content (movies and series), viewing progress, and analytics. The system is built using a microservices-ready architecture with a Spring Boot API and a PostgreSQL database, fully containerized for easy deployment.

2. Technology Stack

  • Programming Language: Java 25 (Preview features enabled)
  • Framework: Spring Boot 4.0.1 (Custom/Preview build)
  • Database: PostgreSQL 16+
  • Containerization: Docker & Docker Compose
  • Authentication: Spring Security with JWT (JSON Web Tokens)
  • API Documentation: OpenAPI 3.1 (Swagger UI)
  • Build Tool: Maven
  • External Integration: TMDB API (The Movie Database)

3. System Architecture

The system follows a layered architecture:

  • Client Layer: Web-based frontend (HTML/JS) served by the backend.
  • API Layer: Spring Boot REST Controllers handling HTTP requests.
  • Service Layer: Business logic, transaction management, and external API integration.
  • Data Access Layer: Spring Data JPA repositories interacting with PostgreSQL.
  • Database: Relational database storing all persistent data.

Component Interactions:

  1. User interacts with the Web UI.
  2. Web UI sends REST requests to the API.
  3. API validates requests and calls Services.
  4. Services execute business logic and query the Database via Repositories.
  5. Database returns data, which flows back to the user.
  6. TMDB Service fetches external movie metadata when needed.

4. Prerequisites

  • Docker Desktop: Version 4.0+
  • Java JDK: Version 25 (for local development)
  • Maven: Version 3.9+ (optional, wrapper included)
  • Git: For cloning the repository

5. Installation & Setup

Clone Repository

git clone <repository-url>
cd Data-Processing

Environment Configuration

The system is pre-configured with default credentials in docker-compose.yml.

  • Database User: admin
  • Database Password: admin123
  • Database Name: streamflix

Database Initialization

The database is automatically initialized with schema and test data using scripts in the init-db/ directory when the Docker container starts.

6. Running the System

Start with Docker Compose

docker-compose up --build

Environment Variables

Ensure to create a .env file in the project root (next to docker-compose.yml) to avoid Docker Compose warnings:

use in git bash for example to generate token JWT_SECRET: openssl rand -base64 64

JWT_SECRET=change-me
TMDB_API_KEY=change-me

Wait for the logs to show "Started StreamflixApplication".

Access Points

7. API Documentation

Full API documentation is available via Swagger UI.

  • URL: http://localhost:8080/swagger-ui.html
  • Base URL: /api/v1
  • Authentication: Most endpoints require a Bearer Token.
    1. Register a user via /api/v1/auth/register.
    2. Login via /api/v1/auth/login to get a token.
    3. Use the "Authorize" button in Swagger to enter the token: Bearer <your-token>.

8. Database Access

You can connect to the database using tools like DataGrip or DBeaver.

  • Host: localhost
  • Port: 5432
  • Database: streamflix
  • User: admin
  • Password: admin123
  • Driver: PostgreSQL

9. Project Structure

Data-Processing/
├── src/
│   ├── main/
│   │   ├── java/com/example/streamflix/  # Source code
│   │   │   ├── config/       # Security & App config
│   │   │   ├── controller/   # API Endpoints
│   │   │   ├── entity/       # JPA Entities
│   │   │   ├── model/        # DTOs
│   │   │   ├── repository/   # DB Access
│   │   │   ├── service/      # Business Logic
│   │   └── resources/
│   │       ├── static/       # Frontend assets (HTML/JS/CSS)
│   │       └── application.yml # App configuration
├── init-db/                  # SQL scripts for DB init
├── Dockerfile                # API container definition
├── docker-compose.yml        # Orchestration config
└── pom.xml                   # Maven dependencies

10. Testing

Automated Tests

Run unit tests using Maven:

./mvnw test

Manual Testing

  1. Start the application.
  2. Open Swagger UI.
  3. Create an account and login.
  4. Test endpoints like GET /api/v1/media to verify data retrieval.

11. Assessment Compliance

  • Docker Containerization: Dockerfile and docker-compose.yml provided.
  • API Implementation: Spring Boot REST API with CRUD operations.
  • Database Design: 3NF PostgreSQL schema with Views, Triggers, and Procedures.
  • Security: JWT Authentication and Role-Based Access Control.
  • Documentation: OpenAPI/Swagger integration.
  • No Direct DB Access: App uses API; API uses JPA.
  • API User Account: Uses ORM (Spring Data JPA), so direct table access via admin user is permitted per assignment rules.

12. Known Issues/Limitations

  • Java 25: The project uses a very new Java version which might require specific IDE support.

13. Authors

  • Student Name: [Your Name]
  • Student Number: [Your Number]

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors