Skip to content

Latest commit

 

History

History
120 lines (99 loc) · 4.16 KB

README.md

File metadata and controls

120 lines (99 loc) · 4.16 KB

IMDB Project

Table of Contents

  1. Overview
  2. Features
  3. Tech Stack
  4. Architecture
  5. Installation
  6. Usage
  7. Configuration
  8. Endpoints

Overview

The IMDB project is a comprehensive Java-based application designed for managing and viewing movie-related data. It offers a wide range of functionalities, from data import/export to real-time metrics monitoring. Built with a modern stack, it provides a robust and user-friendly platform for movie enthusiasts and database managers alike.

Features

  • Data Import/Export: Easily import and export movie data in various formats.
  • Search and Filter: Powerful search and filtering capabilities for movies.
  • Metrics Monitoring: Real-time monitoring of user metrics and application performance.
  • API Request Counting: Track and analyze API interactions.
  • User Management: Secure user authentication and authorization.

Tech Stack

The project leverages the following technologies and frameworks:

  • Java 21: The core programming language.
  • Jakarta EE: Enterprise features and APIs.
  • Spring Boot: Application framework for managing dependencies and configurations.
    • Spring Data JPA: Simplified database interactions.
    • Spring MVC: Framework for building RESTful web services.
  • Lombok: Reduces boilerplate code for model classes.
  • Maven: Dependency management and build automation.
  • H2 Database: In-memory database for development and testing.

Architecture

The application follows a layered architecture:

  • Controller Layer: Handles incoming HTTP requests and returns responses.
  • Service Layer: Contains business logic and service implementations.
  • Repository Layer: Handles data access and interacts with the database.
  • Model Layer: Represents the data structures used in the application.

Installation

Prerequisites

  • Java 21 installed and JAVA_HOME configured.
  • Maven installed.

Steps

  1. Clone the repository:
    git clone https://github.com/haririalii/imdb
    cd imdb
  2. Install dependencies using Maven:
    mvn clean install

Usage

To run the application locally:

mvn spring-boot:run

The application will start on http://localhost:8080/api.

Configuration

Configuration for the application can be customized in the application.yaml file located in src/main/resources/. Key configurations include:

  • Database Settings:

    spring:
      datasource:
        url: jdbc:h2:mem:testdb
        driverClassName: org.h2.Driver
        username: sa
        password: password
  • Server Settings:

    server:
      port: 8080

Endpoints

Import and Data Management

  • POST /api/import/{data_type}: Imports the specified dataset into the application. The API supports IMDB TSV datasets. Replace {data_type} with the type of dataset you are importing (e.g., title_ratings). The list of supported data types can be obtained from the com.lobox.imdb.service.importer.AbstractImporter.getType method.

    Example:

    curl -X POST http://localhost:8080/api/import/title_ratings

Movie Queries

  • GET /api/titles?same_director_writer=true&alive=true: Returns all titles in which both director and writer are the same person and he/she is still alive.

    Example:

    curl -X GET "http://localhost:8080/api/titles?same_director_writer=true&alive=true"
  • GET /api/titles?actor=nm0000190&actor=nm0004266: Gets two actors and returns all titles in which both of them played.

    Example:

    curl -X GET "http://localhost:8080/api/titles?actor=nm0000190&actor=nm0004266"
  • GET /api/titles/genre/{genre}: Gets a genre from the user and returns the best titles of each year for that genre based on the number of votes and rating.

    Example:

    curl -X GET "http://localhost:8080/api/titles/genre/Drama"

Metrics

  • GET /api/metrics/http_requests: Counts how many HTTP requests were received by the application since the last startup.

    Example:

    curl -X GET http://localhost:8080/api/metrics/http_requests