Welcome to the Bookstore project! This is a project developed with Java Spring Boot for searching and buying books. My project contains implemented relevant functionality, contains security, and is also great for e-commerce. Learn more about this application in the following sections
Language Java
Application Configuration Spring Boot, Spring, Maven
Accessing Data Spring Data JPA, Hibernate, MySQL
Web Development Spring MVC, Servlets, JSP, Tomcat
Security Spring Security
Testing and Documentation JUnit, Mockito, Swagger, TestContainers
Version Control Git
-
POST: /auth/registration
- endpoint for user registration -
POST: /auth/login
- endpoint for user login -
GET: /books
- endpoint for viewing all books -
GET: /books/{id}
- endpoint for searching a specific book -
GET: /books/search
- endpoint for searching a specific book by title or author -
POST: /books
- endpoint for administrators to adding a new book -
PUT: /books/{id}
- endpoint for administrators to updating a book -
DELETE: /books/{id}
- endpoint for administrators to deleting books -
GET: /categories
- endpoint for viewing all categories -
GET: /categories/{id}
- endpoint for searching a specific category -
GET: /categories/{id}/books
- endpoint for viewing books with specific category -
POST: /categories
- endpoint for administrators to create a new category -
PUT: /categories/{id}
- endpoint for administrators to update information about specific category -
DELETE: /categories/{id}
- endpoint for administrators to delete categories -
GET: /cart
- endpoint for users to view all items in their shopping cart -
POST: /cart
- endpoint for users to add items in their shopping cart -
PUT: /cart/cart-items/{itemId}
- endpoint for users to update quantity of the cart item -
DELETE: /cart/cart-items/{itemId}
- endpoint for users to delete items from their shopping cart -
GET: /orders
- endpoint for users to view orders history -
POST: /orders
- endpoint for users to place an orders -
PATCH: /orders/{id}
- endpoint for administrators to update orders status -
GET: /orders/{orderId}/items
- endpoint for users to view order items from specific order -
GET: /orders/{orderId}/items/{itemId}
- endpoint for users to view a specific item from certain order
- Clone repository: clone from the console with the command:
git clone https://github.com/AgroFix/book-store.git
- Check database setup: Customize the database settings in the application.properties file.
- Build and run project:
mvn spring-boot:run
If you prefer to run the Bookstore application in a Docker container using Docker Compose, follow these steps:
-
Clone repository: Clone the repository from the console with the command:
git clone https://github.com/AgroFix/book-store.git
-
Check Docker Compose file: Ensure that the
docker-compose.yml
file in the root of the project is configured appropriately. You can customize environment variables, ports, and other settings in this file. -
Build and run the project: Execute the following commands in the project root directory:
docker-compose build docker-compose up
After deploying my application using Docker, I found that my new liquibase scripts were no longer working, which prevented me from expanding my local database further. To solve this problem, I asked my mentor for help, and together we found a solution. I created a separate application-local.properties file where I set spring.docker.compose.enabled=false and ran my application locally from there, which helped me fix the problem.
While testing the controller for the order, I found out that I was getting a Lazy Initialization exception on one of the endpoints (every programmer has probably experienced this). However, I was able to handle this exception by writing a native query on one of the OrderRepository methods.
In the future I plan to add ratings for books and the ability to rate them. And I also plan to add a system of discounts for books. These two features will help to increase book sales, as it is important for a beginner to find an interesting book, and for experienced readers, there will be more incentive to buy a book through discounts.
Thank you for reading to the end, good luck!!!