Skip to content

addee1/game-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

83 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Game Library โ€“ Spring Boot Web Application

๐Ÿ“Œ Overview

Game Library is a web-based application built with Spring Boot that allows users to browse, manage, and review games.

The project demonstrates a modern backend architecture using:

  • Spring MVC
  • Thymeleaf (server-side rendering)
  • Spring Data JPA
  • DTO & Mapper pattern
  • Filtering with Specifications
  • Validation & error handling
  • Comprehensive testing

๐Ÿš€ Features

๐ŸŽฎ Game Management

  • View all games
  • Create new games
  • Update existing games
  • Delete games

๐Ÿ” Filtering & Search (VG requirement)

  • Search by title or developer

  • Filter by:

    • Genre
    • Platform
    • Featured games
  • Sort by price (low โ†’ high / high โ†’ low)

  • Pagination support

๐Ÿ“„ Game Details

  • View detailed information about a game
  • See genres, price, platform, developer, etc.

โญ Reviews

  • Add reviews with:

    • Username
    • Rating (1โ€“5 stars)
    • Comment (optional)
  • View all reviews for a game

  • Average rating calculation

โš ๏ธ Note: Updating/deleting reviews is intentionally not implemented.

โค๏ธ Favorites (Partially implemented)

  • Games can be marked as favorite (backend support exists)
  • "My Games" page is present but not fully implemented yet

๐Ÿงญ How to Use

  1. Go to the Home page to see featured and recently added games

  2. Navigate to Discover Games to:

    • Search for games
    • Filter by genre/platform
    • Sort by price
  3. Click a game to view details and reviews

  4. Add a review using the form on the game details page

  5. Go to Settings to:

    • Add new games
    • Edit existing games
    • Delete games

๐Ÿ—๏ธ Architecture

The application follows a layered architecture:

Controller โ†’ Service โ†’ Repository โ†’ Database
                โ†“
              Mapper
                โ†“
               DTO

Layers Explained

  • Controller

    • Handles HTTP requests
    • Returns Thymeleaf views
  • Service

    • Contains business logic
    • Uses repositories and mappers
  • Repository

    • Spring Data JPA
    • Handles database access
  • DTOs

    • Used for form handling and view rendering
    • Includes validation
  • Mapper

    • Converts between Entity and DTO
  • Specifications

    • Dynamic filtering using JPA Criteria API

๐Ÿงฑ Tech Stack

  • Java 17 or higher
  • Spring Boot
  • Spring MVC
  • Spring Data JPA
  • Thymeleaf
  • H2 Database (in-memory)
  • JUnit 5
  • Mockito
  • MockMvc
  • JaCoCo

โš™๏ธ Requirements

  • Java 17+
  • Maven (or use the included Maven Wrapper)

๐Ÿ—„๏ธ Database

  • Uses H2 in-memory database
  • Preloaded with sample data via data.sql
  • Data resets on every application restart

Example data includes:

  • The Witcher 3
  • Cyberpunk 2077
  • Elden Ring

โšก Database Configuration

  • The application automatically runs data.sql on startup
  • This seeds the database with initial data
  • Any changes made during runtime are not persisted

โ–ถ๏ธ Running the Application

1. Clone the repository

git clone <your-repo-url>
cd game-library

2. Run the application

./mvnw spring-boot:run

or run via your IDE.

3. Open in browser

http://localhost:8080

4. H2 Console (optional)

http://localhost:8080/h2-console

๐Ÿ“‚ Project Structure

src/
 โ”œโ”€โ”€ controllers/
 โ”œโ”€โ”€ services/
 โ”œโ”€โ”€ repositories/
 โ”œโ”€โ”€ entities/
 โ”œโ”€โ”€ dtos/
 โ”œโ”€โ”€ mappers/
 โ”œโ”€โ”€ specifications/
 โ”œโ”€โ”€ exceptions/
 โ””โ”€โ”€ configs/

resources/
 โ”œโ”€โ”€ templates/ (Thymeleaf views)
 โ”œโ”€โ”€ static/
 โ”‚   โ”œโ”€โ”€ css/
 โ”‚   โ”œโ”€โ”€ js/
 โ”‚   โ””โ”€โ”€ images/
 โ””โ”€โ”€ data.sql

๐ŸŽจ Frontend

  • Built with Thymeleaf templates

  • Modular structure:

    • layout/
    • fragments/
    • pages/
  • Custom CSS architecture:

    • base/
    • components/
    • layout/
    • pages/
    • themes (dark/light mode)
  • Vanilla JavaScript for:

    • Modals
    • Filtering
    • Theme switching
    • Review interactions

๐Ÿงช Testing

The project includes extensive testing:

โœ… Unit Tests

  • Service layer
  • Mapper classes

โœ… Controller Tests

  • MockMvc

  • Verifies:

    • HTTP responses
    • Views
    • Model attributes

๐Ÿ“Š Coverage

  • Measured using JaCoCo
  • ~76% line coverage

โš ๏ธ Known Limitations

  • โŒ My Games (favorites page) is not fully implemented
  • โŒ No authentication (single-user system)
  • โŒ Reviews cannot be edited or deleted

๐Ÿ”ฎ Future Improvements

  • Complete Favorites system (My Games page)
  • Add user authentication
  • Improve UI/UX interactions
  • Add REST API
  • Add review editing/deleting
  • Improve test coverage further

๐Ÿ‘จโ€๐Ÿ’ป Author

Developed as part of a Spring Boot web development assignment.

About

game-library - Springboot

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors