Skip to content

LinusWestling/IMDBlite

 
 

Repository files navigation

🎬 IMDBlite - Movie Database CLI

IMDBlite is a Java-based Command Line Interface (CLI) application designed to manage and explore a movie database. It leverages JPA (Jakarta Persistence) and Hibernate to interact with a MySQL database, following a "Code First" approach.

The application features a dual-interface system: a User Menu for movie enthusiasts to browse, rate, and favorite movies, and an Admin Menu for database management.


🚀 Features

👤 User Interface

  • Browse Movies: List all movies or filter by language, ranking, length, release date, actor, director, or genre.
  • Search: Find specific movies by title.
  • Personal Favorites: Maintain a personal list of favorite movies.
  • Ratings: Rate movies (1-5 scale) and view your previous ratings.
  • User Search: Find other users by their username.

🔑 Admin Interface

  • User Management: Add or delete users.
  • Content Management: Create and delete movies, actors, directors, and genres.
  • Relationships: Associate actors and directors with specific movies.
  • Validation: Basic input validation for names, dates, and numeric values.

🛠️ Tech Stack

  • Language: Java 25
  • Persistence: Jakarta Persistence (JPA) & Hibernate 7.2.0.Final
  • Database: MySQL (Driver: mysql-connector-j 9.5.0)
  • Build Tool: Maven
  • Testing: JUnit 5, AssertJ, Mockito
  • Development Utility: ClassGraph (for classpath scanning)

📊 Data Model

The project uses a relational data model with the following entities:

  • Movie: The central entity containing title, release date, length, and language.
  • Actor & Director: Entities containing name and country of origin.
  • Genre: Categorizes movies.
  • User: Manages login credentials and profile information.
  • UserRating: A join entity representing the rating given by a User to a Movie.

Key Relations:

  • One-to-Many: One Director can have many Movies.
  • Many-to-Many:
    • Movies <-> Actors
    • Movies <-> Genres
    • Users <-> Favorite Movies

🚦 Getting Started

Prerequisites

  • Java 25 or higher.
  • MySQL Server running locally.
  • Maven for dependency management.

Database Configuration

The database connection is configured programmatically in src/main/java/org/example/JpaUtil.java. By default, it looks for:

  • URL: jdbc:mysql://localhost:3306/codeTraumaTeam
  • User: user
  • Password: password

Ensure you have a database named codeTraumaTeam created, or update the settings in JpaUtil.java to match your local environment.

Installation & Execution

  1. Clone the repository:
    git clone <repository-url>
  2. Build the project:
    mvn clean install
  3. Run the application:
    mvn exec:java -Dexec.mainClass="org.example.App"

First Run & Seeding

On the first launch, the application detects if the database is empty. If so, it automatically triggers the DatabaseFiller to seed the database with initial data (movies, actors, directors, etc.) to get you started immediately.


📂 Project Structure

  • src/main/java/org/example/entity: JPA Entity definitions.
  • src/main/java/org/example/repo: Repository interfaces.
  • src/main/java/org/example/jpaimpl: JPA-specific implementations of the repositories.
  • src/main/java/org/example/seed: Data seeding logic.
  • src/main/java/org/example/CliApp.java: Main logic for the User CLI.
  • src/main/java/org/example/CliAdminApp.java: Main logic for the Admin CLI.

About

This is a simple movie CLI app that lets you rate movies and add them as favoriets among other simple queries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%