The primary inspiration for this project was my desire to build a robust backend system that interacts seamlessly with APIs. I envisioned creating a fully functional online bookstore, a platform that would provide users with an easy-to-navigate interface for browsing, purchasing, and managing books. This project allows me to delve deeper into backend development, honing my skills in API integration, data management, and scalability. By working on this, I aim to create a service that could be expanded upon in the future and potentially serve as a foundation for other API-driven applications.
This web application addresses several key issues related to the selection and purchase of books online. It provides a seamless platform where users can easily browse through various book categories, search for specific titles, and make purchases in a user-friendly and efficient manner. The application simplifies the shopping experience by organizing books into relevant categories, allowing users to quickly find what they are looking for.
Moreover, it resolves common challenges such as the difficulty of managing large inventories, offering a well-structured interface that supports both users and administrators in handling data efficiently. The integration of secure payment methods ensures that transactions are safe, further enhancing the overall customer experience. This project also paves the way for scalability, allowing for future expansion to include features such as personalized recommendations, user reviews, and enhanced filtering options.
- Can register an account.
- Can search for books based on various criteria (e.g., title, author, ISBN).
- Can add books to the shopping cart.
- Can edit their shopping cart (e.g., remove books).
- Can update the quantity of books in the shopping cart.
- Has the ability to add, update, and delete books in the system.
- Can manage book categories, including adding, removing, and modifying them.
- Has the authority to set and modify book prices.
| HTTP Request | Endpoint | Description |
|---|---|---|
| POST | /auth/registr |
Register a new user |
| POST | /auth/login |
Login an existing user |
| HTTP Request | Endpoint | Description |
|---|---|---|
| GET | /books |
Get a list of all available books |
| GET | /books/{id} |
Get one book by its ID |
| POST | /books |
Create book and save to database |
| PUT | /books/{id} |
Update one book by its ID |
| DELETE | /books/{id} |
Delete one book from database by its ID |
| GET | /books/search |
Search book by specific criteria |
| HTTP Request | Endpoint | Description |
|---|---|---|
| POST | /categories |
Create category and save to database |
| GET | /categories |
Get all available categories |
| GET | /categories/{id} |
Get one category by its ID |
| PUT | /categories/{id} |
Update one category by its ID |
| DELETE | /categories/{id} |
Delete one category from database by its ID |
| GET | /categories/{id}/books |
Get list of book by categories by the its ID |
| HTTP Request | Endpoint | Description |
|---|---|---|
| POST | /orders |
Create order and save to database |
| GET | /orders |
Get all orders made by the user |
| PATCH | /orders/{id} |
Update order status by its ID |
| GET | /orders/{orderId}/items |
Get all order items by order ID |
| GET | /orders/{orderId}/items/{itemId} |
Get information about the order item by order ID and item ID |
| HTTP Request | Endpoint | Description |
|---|---|---|
| GET | /cart |
Get users shopping cart |
| POST | /cart |
Create and add items to shopping cart |
| PUT | /cart/items/{cartItemId} |
Update quantity by items ID |
| DELETE | /cart/items/{cartItemId} |
Delete items from shopping cart by items ID |
- Prerequisites Docker and Docker Compose on your machine.
- Clone the Repository
git clone https://github.com/Dima23-ops5/StringBootIntro.git
- Navigate to the project directory
cd StringBootIntro - Configure Environment Variables:
- Create a
.envfile in the project directory to store your database credentials. This file should contain the necessary environment variables, such asDB_HOST,DB_USER, andDB_PASSWORD. - Update the
application.propertiesfile located in thesrc/main/resourcesdirectory with your specific database connection details and any other necessary configurations.
-
Set Up the Environment:
Ensure Docker and Docker Compose are installed on your system. You can configure environment variables directly in the
docker-compose.ymlfile. -
Build and Run the Application:
docker-compose build docker-compose up
-
Access the Application:
The application will be available at
http://localhost:8080/.
To explore and test the API endpoints, you can use Swagger. Swagger provides interactive API documentation that allows you to test endpoints directly from the browser.
Book Store.postman_collection.json
You can view the instructional video via this link : https://www.loom.com/share/5989d84459324ed7a4badabb21d7babc?sid=e8b4b142-7767-4cf0-88c7-c3e6ee3140bb
- Controller Testing and User Authentication
One of the most difficult tasks was writing unit tests for the controllers, particularly when dealing with user authentication in the Shopping Cart controller tests. The issue was related to properly authenticating users during the tests. The solution involved ensuring that all required entities were correctly added to the test database and applying the @WithUserDetails annotation on the test class to simulate a logged-in user.
- Creating the
.jarFile and Docker Integration Another significant challenge was correctly generating the.jarfile for the project. This issue was compounded by problems with Docker integration. The solution was to update the IntelliJ IDEA settings to specify the correct path to the main class, as well as fixing issues in thepom.xmlfile. These adjustments ensured that the.jarfile was correctly built and integrated with Docker without further issues.
By addressing these challenges with the appropriate solutions, I was able to successfully overcome the obstacles and move forward with the project.
For any questions or suggestions, feel free to reach out:
- GitHub: Dima23-ops5
- email: dmmhnk23@gmail.com
































