The "Online bookstore" is a web application for purchasing books online. In this app, users can browse available books, search for desired books by multiple criteria, save them to a shopping cart, and place an order. This allows users to buy books without the need to leave their homes or browse through physical bookshelves, making the process comfortable and fast.
- Java 21
- Spring Boot 3.3.2, Spring Security, Spring Data JPA
- MySQL 9, Liquibase
- JWT
- Maven, Docker
- Lombok, Mapstruct, Swagger
- Junit, Mockito, Testcontainers
- Clone repo.
- Install and run Docker.
- Configure access parameters in the
.env
file (refer to the required fields in the.env.template
file). - Open a terminal and navigate to the root directory of the project on your machine.
- Run the application using Docker Compose:
docker-compose up
- Voilà! :)
Feel free to test the available functionality using endpoints with tools like Postman or via Swagger UI, which you can find below ⬇️
Currently, the application supports two roles: ADMIN
and USER
. The USER
role is automatically assigned to each new user but has limited access to certain endpoints. To assign the ADMIN
role, you must create a Liquibase script or use an SQL query.
Base URL: - http://localhost:8080/api
Authentication - Endpoints for managing authentication:
POST: /auth/registration
- Register a new userPOST: /auth/login
- Log in
Book - Endpoints for managing books:
GET: /books
- Get all available booksGET: /books/{id}
- Get a book by its IDPOST: /books
- Create a new book (ADMIN only)PUT: /books/{id}
- Update a book (ADMIN only)GET: /books/search
- Search for books by parameters such as authors, ISBN, max price, or part of the titleDELETE: /books/{id}
- Delete a book by its id (ADMIN only)
Category - Endpoints for managing categories:
GET: /categories
- Get all categoriesGET: /categories/{id}
- Get a category by its IDPOST: /categories
- Create a new category (ADMIN only)PUT: /categories/{id}
- Update a category (ADMIN only)GET /categories/{id}/books
- Get all books by category IDDELETE: /categories/{id}
- Delete a category by its ID (ADMIN only)
Shopping cart - Endpoints for shopping cart management:
GET: /cart
- Retrieve the user's shopping cartPOST: /cart
- Add a book to the shopping cartPUT: /cart/items/{cartItemId}
- Update the quantity of a book in the shopping cartDELETE: /cart/items/{cartItemId}
- Remove a book from the shopping cart
Order - Endpoints for managing user orders:
GET: /orders
- Retrieve the user's order historyPOST: /orders
- Place an orderPATCH: /orders/{id}
- Update the order status (ADMIN only)GET: /orders/{orderId}/items/{itemId}
- Retrieve a specific ordered item within an orderGET: /orders/{orderId}/items
- Retrieve all ordered items for a specific order
For examples of request bodies, refer to the Swagger documentation.