Skip to content

Full CRUD Library System application with Spring Boot and Spring Data JPA

Notifications You must be signed in to change notification settings

Zeyad2003/Library-System-Crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library-System

Welcome to the Library-System-Crud project!

Table of Contents

Brief Introduction

A Spring-Boot RESTful API for managing books, authors, and categories and the relation between them in a library system with full CRUD functionalities.

Features

  • Full CRUD functionalities for books, authors, and categories.
  • Separated layers for controllers, services, repositories, and models.
  • Documented API using Swagger.
  • Applied multiple design patterns like DTO, Builder, and Facade.
  • Used external libraries like MapStruct and Lombok to reduce boilerplate code.
  • Utilized MySQL database to store the data, and managed it using Spring Data JPA and Hibernate.
  • Used Docker to containerize the application, and modify GitPod workspace for running the application.

🚀  Installation

GitPod

Install on cloud-based IDE - GitPod

Open in Gitpod

  1. Open the project in GitPod using the button above.

    • It will take about 2 or 3 minutes to build the workspace.
  2. Open the terminal, and download the required tools

    • Maven
      sudo apt install maven -y
    • Java 17 (Press y after complete for using java 17)
      source "$HOME/.sdkman/bin/sdkman-init.sh"
      sdk install java 17.0.10.fx-zulu
  3. Prepare the database with random sample data:

    mysql -u root < ./src/main/resources/prepare.sql
  4. Build and run the application using Maven

     mvn spring-boot:run
  5. Check the ports page and navigate to the link that has the port 8080:

    port


Local Machine

Install on your local machine

First, make sure you install the following tools:

  • Java 17
  • Maven
  • MySQL

Once you have the required tools installed, follow these steps to install the Bank Management System:

  1. Clone this repository:

       git clone https://github.com/Zeyad2003/Library-System-Crud.git
  2. Navigate to the project directory:

    cd Library-System-Crud
  3. Prepare the database with random sample data:

    mysql -u root < ./src/main/resources/db/prepare.sql
  4. Build and run the application using Maven

    mvn spring-boot:run
  5. Access the application endpoints via: http://localhost:8080

Important

  • on Local Machine the url will be like this: http://localhost:8080/{endpoint}

  • on GitPod As we're using a cloud based IDE the url may be like this:

  • https://8080-<workspace-id>.ws-eu107.gitpod.io/{endpoint}

  • {endpoint} is the endpoint you want to access.

  • For example, here are some endpoints for GET requests:

    • /author
    • /author/1
    • /author/1/books
    • /book
    • /book/1
    • /book/1/authors
    • /category
    • /category/1
    • /category/1/books
    • /swagger-ui.html

If you want to see the API documentation without running the application you can check this File

Postman Requests

Run In Postman

If you couldn't find the collection for any reason, you can import this File manually to Postman.

Database Schema

erDiagram
    CATEGORY ||--|{ BOOK : ""
    BOOK_AUTHOR }|--|| AUTHOR: ""
    BOOK_AUTHOR }|--|| BOOK: ""

    BOOK {
        Long id PK
        string name
        BigDecimal price
    }

    AUTHOR {
        Long id PK
        string name
        string email
    }

    BOOK_AUTHOR {
        Long book_id PK
        Long author_id PK
    }

    CATEGORY {
        Long id PK
        string name
        string description    
        Long category_id FK
    }
Loading

Used Technologies & Tools

  • Java 17
  • Spring Boot
  • Maven
  • MySQL
  • Spring Data JPA
  • Lombok
  • MapStruct
  • Swagger
  • Docker
  • GitPod

Note

The unit tests aren't complete yet, I'm going to complete them soon.

About

Full CRUD Library System application with Spring Boot and Spring Data JPA

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages