Welcome to the Library-System-Crud project!
A Spring-Boot RESTful API for managing books, authors, and categories and the relation between them in a library system with full CRUD functionalities.
- Full CRUD functionalities for
books
,authors
, andcategories
. - Separated layers for
controllers
,services
,repositories
, andmodels
. - Documented API using Swagger.
- Applied multiple design patterns like
DTO
,Builder
, andFacade
. - Used external libraries like
MapStruct
andLombok
to reduce boilerplate code. - Utilized
MySQL
database to store the data, and managed it usingSpring Data JPA
andHibernate
. - Used
Docker
to containerize the application, and modifyGitPod
workspace for running the application.
Install on cloud-based IDE - GitPod
-
Open the project in GitPod using the button above.
- It will take about 2 or 3 minutes to build the workspace.
-
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
- Maven
-
Prepare the database with random sample data:
mysql -u root < ./src/main/resources/prepare.sql
-
Build and run the application using Maven
mvn spring-boot:run
-
Check the ports page and navigate to the link that has the port 8080:
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:
-
Clone this repository:
git clone https://github.com/Zeyad2003/Library-System-Crud.git
-
Navigate to the project directory:
cd Library-System-Crud
-
Prepare the database with random sample data:
mysql -u root < ./src/main/resources/db/prepare.sql
-
Build and run the application using Maven
mvn spring-boot:run
-
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
If you couldn't find the collection for any reason, you can import this File manually to Postman.
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
}
- 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.