Skip to content

evagapi/great-reads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Greatreads Backend

Table of Contents

  1. Description
  2. Class Diagram
  3. Entity Relationship Diagram
  4. Setup
  5. Technologies Used
  6. Controllers and Routes Structure
  7. Extra Links
  8. Future Work
  9. Resources

Description

Greatreads is the final project of the Ironhack Java Backend Bootcamp. It is a Java API inspired by Goodreads, designed to provide a platform for users to discover and manage their reading preferences. It offers a simplified version of Goodreads' features while maintaining some of the core functionalities. With Greatreads, users can register, interact with books, and organize their reading lists effectively.

Core Features

  1. User Registration and Management: Users can sign up for an account on Greatreads and manage their profiles. The platform supports multiple user roles:
  • Admin: Administrators have access to administrative features such as managing users and books, adding genres, and deleting authors.
  • Librarian: Librarians have access to a lower level of administrative features such as creating and updating books, authors, and translators.
  • User: Regular users can explore books, authors, translators, and manage their reading lists.
  1. Book Management: Greatreads offers the possibility to manage a reading list of books that users can explore. They can search for books by title, author, or genre.

  2. User's Library: Each user has a library where they can manage their reading progress. The library includes manages the following reading stages:

  • Want to Read: Users can add books they're interested in reading.
  • Currently Reading: Users can track books they're currently reading.
  • Read: Once users finish a book, they can mark it as read.
  1. Authentication and Authorization: Greatreads ensures secure access to user accounts through authentication mechanisms. Different user roles have varying levels of access, ensuring that administrators, librarians, and regular users can perform their respective tasks efficiently.

Class Diagram

---
title: Greatreads
---
classDiagram
    Person : -int id
    Person : -String firstName
    Person : -String lastName
    class User {
    -int id
    -String name
    -String username
    -String email
    -String password
    }
    class Role {
        -int id
        -String name
    }
    class Book {
        -int id
        -String title
        -int numberOfPages
        -String isbn
        -Genre genre
        -String language
        -String publisher
        -Author author
        -List~BookStatus~ bookStatuses
    }
    class Author {
        -List~Book~ books
    }
    class Translator {
        -List~Book~ translatedBooks
    }
    Translator --|> Person : implements
    Author --|> Person : implements
    class Genre {
        -int id
        -String name
        -List~Book~ books
    }
    class Library {
        -int id
        -User reader
        -List~BookStatus~ bookStatuses
    }
    class BookStatus {
        -int id
        -Book book
        -Status status
    }
    User "1" <--> "1" Library
    Book "1" <--> "*" Library
    Book "1" <--> "*" BookStatus
    Book "*" --> "1" Genre
    Book "*" --> "1" Author
    Book "*" --> "1" Translator


Loading

Entity Relationship Diagram

err-diagram-v02.jpg

Setup

Make sure you have the following installed:

  • Java (version >= 21)
  • MySQL Database
  • Maven

1. Clone the repository

git clone https://github.com/evagapi/great-reads.git
cd great-reads

2. Install Maven dependencies

Using Command Line

mvn install

Using IntelliJ IDEA

  • Open IntelliJ IDEA.
  • Open the great-reads project.
  • Navigate to View > Tool Windows > Maven.
  • Click on Reload All Maven Projects icon to update dependencies.
  • Alternatively, right-click on pom.xml and select Reload Project.

Configure MySQL

Create your local profile resources file

Create a application-local.properties file and include the following properties matching your configuration:

spring.datasource.url=jdbc:mysql://localhost:[yourlocalhostport]/[yourdatabasename]?serverTimezone=UTC
spring.datasource.username=[youruser]
spring.datasource.password=[yourpassword]

First Run

The database will be automatically created the first time you run the application with the following configurations:

spring.profiles.active=local

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.hibernate.ddl-auto=create

spring.jpa.show-sql=true

After the First Run

After the first run, you need to update the spring.jpa.hibernate.ddl-auto to none to prevent data overwriting. You can update spring.jpa.show-sql to false to disable SQL logging.

GitHub Actions

This project utilizes GitHub Actions for Continuous Integration (CI) with Maven. This GitHub Actions workflow is triggered on pull requests targeting the main branch. It sets up the required environment with JDK 21 and Maven. Then, it runs unit tests using Maven. This ensures that any code changes introduced via pull requests are tested automatically, providing quick feedback on the project's health and preventing bugs.

Technologies Used

  • Java 21
  • Maven
  • Spring Boot 3.2.4
  • MySQL Database (development database)
  • H2 Database (testing and GithubActions database)
  • Spring Data JPA
  • Spring Web
  • Spring Security
  • JWT (Java JSON Web Token)
  • Lombok
  • Spring Boot Starter Test
  • Spring Boot Starter Validation
  • JUnit Jupiter

Controllers and Routes structure

You can access the API documentation through http://localhost:8080/swagger-ui/index.html/

greatreads_controllers.png

Extra links

Future work

  1. Ratings for Books
  • Allow users to rate the books they read.
  • Store and display individual user ratings for each book in the database.
  • Calculate and display an average rating for each book based on the ratings provided by users.
  • Provide sorting and filtering options to explore books based on their ratings.
  1. Social Features
  • Allow users to connect with each other by adding friends.
  • Enable users to make book recommendations to their added friends.

Resources

About

Greatreads is the final project of the Ironhack Java Backend Bootcamp (2024)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages