Skip to content

ivan0dyatlyukkk/book-worm

Repository files navigation

The BookWorm API

Overview

The BookWorm API 📚 provides simple APIs for managing an online bookstore.

Table of contents

👨‍💻Tech stack

Let's look at the whole list of technologies which are used in the project:

  1. Spring Boot simplifies the development of Java-based applications by providing a pre-configured environment, it serves as the foundational framework for building the backend of the online bookstore.

  2. Spring Data JPA provides a convenient way to interact with relational databases using Java Persistence API (JPA). It reduces the boilerplate code needed for database operations and allows you to work with database entities as Java objects.

  3. Spring Security provides authentication and authorization features to secure the API endpoints and protect user data.

  4. MySQL is a popular relational database management system known for its performance and scalability. It's used to store and manage data for the online bookstore, including user information, book details, and order records.

  5. Lombok is a library that reduces the need for writing repetitive boilerplate code in Java, such as getters, setters, and constructors. It simplifies code maintenance and readability.

  6. MapStruct is a code generation tool that simplifies mapping between Java objects. It's used to map data between DTOs (Data Transfer Objects) and entity classes, reducing manual coding and improving maintainability.

  7. Docker is used for containerization, allowing us to package the application and its dependencies into isolated containers. It ensures consistent environments across different stages of development and simplifies deployment, making it easier to manage and scale the application.

  8. Liquibase is a database version control and migration tool. It allows us to manage database schema changes in a systematic and controlled manner, ensuring that database changes are applied consistently across different environments and versions of the application.

  9. Postman is a popular API testing and documentation tool. It's invaluable for testing and debugging the API endpoints during development. It also helps in documenting the API for both internal and external users.

  10. OpenAPI (Swagger) is used to describe and document the RESTful API. It enhances API documentation, allows for interactive API exploration, and aids in generating client SDKs.

🌟Features

In this part, let's go through all of the features.

Authorization

Firstly, you should authorize and then you will access the main API features (default role - USER).

FEATURE Endpoint Required fields
Register a new user POST:/api/auth/register email, password, repeat password, first name, last name, shipping address
Log in POST:/api/auth/login email, password

The main features

So, we're on the right track 🎉, now you can find all of the features for future use 🙂

FEATURE Endpoint User Admin
Get all books GET:/api/books ✔️ ✔️
Get a certain book by id GET:/api/books/{id} ✔️ ✔️
Add a new book POST:/api/books ✔️
Delete an existing book by id DELETE:/api/books/{id} ✔️
Update an existing book by id PUT:/api/books/{id} ✔️
Get books of the category GET:/api/categories/{id}/book ✔️ ✔️
Get all categories GET:/api/categories ✔️ ✔️
Get a certain category by id GET:/api/categories/{id} ✔️ ✔️
Add a new book category POST:/api/categories ✔️
Delete an existing category by id DELETE:/api/categories/{id} ✔️
Get a user's shopping cart GET:/api/cart ✔️
Add a book to a shopping cart POST:/api/cart ✔️
Update a cart item by its id PUT:/api/cart/cart-item/{id} ✔️
Delete a cart item by its id DELETE:/api/cart?car-item/{id} ✔️
Get all orders GET:/api/orders ✔️
Get order items by order id GET:/api/orders/{id}/items ✔️
Get a certain order item by an order id and its id GET:/api/orders/{orderId}/items/{id} ✔️
Update a status of an order by an order id PATCH:/api/orders/{id} ✔️

🛠Installation

Okay, after the features overview let's start setting our environment up for running the application 🚀.

Prerequisites

There are some things which you should install locally on your PC.

Installation

Let's look at the steps of installing the application:

  1. Clone the project: https://github.com/ivan0dyatlyukkk/book-store.git by using a terminal or an IDEA:
    Using a terminal:

     git clone https://github.com/ivan0dyatlyukkk/book-store.git

    Using the IntelliJ IDEA:
    Click on "Get from VCS" -> Paste the link bash https://github.com/ivan0dyatlyukkk/book-store.git in an appropriate field

    the example of fields
  2. Build the project by Maven

    mvn clean install
  3. Compose the project by Docker Compose tool:

    docker-compose build
    
  4. Run the application:

    docker-compose up

Great! We already set our environment up! ⭐

⚙Integration with Postman

If you don't want to come up with an idea of data for the testing requests, and you don't want to type lots of similar requests again and again, you can use the prepared collection for Postman and the environment

Contributing

We appreciate your interest in contributing to this project!
Your help and input are valuable in making this project better for everyone.
Whether you want to report a bug, request a feature, or submit a pull request, you can follow 🛠Installation.
If you have any questions, need further information, or wish to explore opportunities for collaboration in the development of this project, feel free to reach out to me.
My email: [email protected]

🎯Summary

The BookWorm API is a powerful tool designed to create a seamless and user-friendly experience for book enthusiasts and administrators alike. It serves as the backbone for managing a virtual library of literary treasures and facilitates the process of discovering, purchasing, and managing books.

The video instructions for usage you can watch here: loom-video

Let's try! Just use the link: book-worm-api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published