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.
- 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.
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.
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.
- Java 21 installed and
JAVA_HOME
configured. - Maven installed.
- Clone the repository:
git clone https://github.com/haririalii/imdb cd imdb
- Install dependencies using Maven:
mvn clean install
To run the application locally:
mvn spring-boot:run
The application will start on http://localhost:8080/api
.
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
-
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 thecom.lobox.imdb.service.importer.AbstractImporter.getType
method.Example:
curl -X POST http://localhost:8080/api/import/title_ratings
-
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"
-
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