Book House is an online bookstore project designed to provide a comprehensive experience for both users and administrators. This application is built on a microservices architecture, enabling high scalability and flexibility. Book House is developed using technologies such as Java, Spring Boot, MongoDB, MySQL, Spring Cloud, and others, with implementation and deployment managed through Docker and Docker Compose.
The application consists of several key microservices that manage different areas of the system. CatalogueService handles the book catalog in a MongoDB database, while CartService manages shopping carts, orders, and invoices in MySQL. AuthService manages user authentication and operates on MongoDB as well. ReviewService deals with book reviews and ratings, and NotificationService handles transactional emails and invoice generation using JasperReports and SendGrid.
Some of the standout features of Book House include an intuitive user interface that allows customers to explore the book catalog, apply advanced filters, and make purchases effortlessly. Administrators can manage users and view purchase histories through a robust admin panel. Additionally, the app ensures a secure experience with JWT-based authentication and efficient notifications through automatically generated invoices and emails.
-
Distributed Microservices: The application is designed with a microservices architecture, including services like CatalogueService for the book catalog, CartService for carts and orders, AuthService for user authentication, ReviewService for reviews and ratings, and NotificationService for emails and invoice generation.
-
Hybrid Database: Utilizes MongoDB for non-relational data management and MySQL for relational data, ensuring efficient information handling tailored to each service's needs.
-
Intuitive User Interface: Provides a seamless experience with a modern interface that makes book navigation, advanced filtering, and purchases simple. Includes an admin panel for user management and monitoring purchases.
-
PayPal Integration: Enables users to securely complete payments via PayPal, simplifying the purchase process on the platform.
-
Load Balancing: Uses Docker and Docker Compose to create at least two instances of each service, ensuring high availability and efficient load balancing to handle traffic.
-
Auto-discovery Server: Implements Netflix Eureka as a discovery server, allowing microservices to dynamically register and discover each other.
-
Centralized Configuration Server: Utilizes Spring Cloud Config Server for centralized configuration, with configuration files stored in a GitHub repository, ensuring consistent management and updates across all microservices.
-
Spring Cloud Gateway: The API Gateway powered by Spring Cloud acts as the single entry point for clients, routing requests to the appropriate services and managing communication between different microservices.
-
Secure Authentication: Implements Spring Security with JWT to ensure secure authentication and authorization, protecting access to application features and ensuring only authorized users can perform certain actions.
-
Monitoring and Scalability: Utilizes Zipkin for transaction monitoring and Docker for deployment, ensuring the application is scalable and can efficiently handle traffic and transactions.
Book House offers a series of views designed to provide a smooth and comprehensive user experience. Below are the detailed views available in the application:
The application uses Netflix Eureka for service management. The Eureka Server dashboard allows you to visualize the status of all deployed service instances, facilitating the administration and monitoring of the microservices infrastructure.
The architecture, as previously observed, is based on microservices with high availability. To ensure high availability, each microservice has at least two instances running. This guarantees that if one instance fails, another is available to handle the requests, thereby minimizing downtime. The number of instances is managed in Docker Compose using the "Deploy" parameter. Additionally, an API Gateway has been effectively implemented to route all access URLs to the microservices, facilitating communication between the system's components. In the test image, only one instance per service is visible because Docker is not being used at that time.
Users can access the application via a login and registration page. New users complete a registration form, while existing users enter their credentials in the login form.
After completing the registration, users receive a confirmation email. Below are the desktop and mobile versions of the email.
The main page of the application presents an attractive design with book recommendations, new releases, and links to the main sections. Users can explore the featured content and access key areas of the store.
We decided to create a comprehensive view for Book House with a highly intuitive and aesthetic interface. In this main view, users will have access to book recommendations, see the latest books added, and more. They will also have the option to explore the full catalog. If the user is logged in, they will be able to make purchases, view their purchase history, and access additional features. Furthermore, if the user is logged in and has admin privileges, they will have access to an admin panel with a dashboard providing information about the state of the bookstore.
Displays a list of books available in the library, with options for applying filters and sorting. Users can search for books by different criteria.
It is essential that the book catalog allows filtering by author, title, and literary genre. Below is an example of these filters in action. The filters are sensitive in the sense that when searching for "Sleep," for example, it will find all books containing that word or consecutive letters in the title, and the same applies to the author, enriching the search and improving SEO. Additionally, books can have more than one genre, but only the main genre is displayed on the cover. Therefore, if you filter by a genre and see a book with a cover showing a different genre than the one you selected, it means that one of its secondary genres belongs to the selected category.
As observed, there are also some additional filters, including:
- Sort from A to Z
- Sort from Z to A
- Sort from lowest price to highest price
- Sort from highest price to lowest price
Provides complete information about a book, including its description, author, genre, user reviews, and related books. Users can explore the details and opinions of other readers.
- Review Restriction: A user who hasn't purchased the book cannot leave a review.
Displays all the reviews of a specific book. If the book has no reviews, a message is shown indicating that the book has not been rated yet.
The average rating value is calculated based on the list of reviews that the book in question has.
Shows the items added to the cart, allowing users to review their selections before proceeding to checkout.
Allows users to enter payment details and complete the purchase. The system uses PayPal for secure payment processing.
- PayPal Payment Confirmation View: Displays the payment confirmation after completing the transaction.
The invoice is generated using Jasper Reports.
After this, the .jrxml file was exported to the notification service, and a ReportService was created where the confirmed order data is sent and loaded into the invoice file. Finally, the report is exported as a PDF and attached to the email sent via the SendGrid service.
Allows administrators to create new users with different roles and permissions.
Shows a summary of all previous purchases made by the user.
Allows users to view a list of all their purchases, with details for each transaction.
We created a dashboard that displays purchases made by day and by genre. We also included a purchase history and, additionally, added statistical cards showing the total number of orders, the number of genres, the number of books, and the number of users in the system.
The application uses Zipkin for microservice monitoring. Although embedded versions of Zipkin are deprecated, it has been implemented as a Docker image, integrated with Docker Compose. This allows tracking and monitoring the performance of microservices, excluding the discovery server.
The system has high performance in terms of security. Upon logging in, the user receives a token valid for one hour. This token is encrypted and stored in a cookie, which the client uses to make requests to the Gateway. The Gateway, in collaboration with the authentication service, validates the token and either grants or denies access to the route. Additionally, the user's role is checked to ensure it has the necessary permissions for access. Otherwise, the system will generate an error.
It is important to note that when a session expires or when logging out, the user must log in again to refresh their token.
-
Java: The primary programming language used for backend development of the platform.
-
Spring Boot: The framework used to build the backend of the application, providing a robust and scalable architecture.
-
Spring Security: Implemented for authentication and authorization within the platform, ensuring secure access to functionalities.
-
JWT (JSON Web Tokens): Used for managing authentication and secure communication between the web application and microservices.
-
MongoDB: NoSQL database used for storing various types of data across different services.
-
MySQL: Relational database used for managing structured data related to orders, reviews, and other transactional information.
-
Spring Cloud: Provides tools for managing distributed systems, including configuration management, service discovery, and circuit breakers.
-
Spring Cloud Gateway: Used as an API Gateway to route requests to various microservices.
-
Feign Client: Used for declarative REST client creation, simplifying communication between microservices.
-
Zipkin: Distributed tracing system used for monitoring and troubleshooting the performance of microservices.
-
JasperReports: Reporting tool used for generating and formatting invoices and other documents.
-
DataFaker: Library used for generating realistic test data, such as random books and user profiles.
-
HTML, CSS, JS, Bootstrap: Front-end technologies used to develop the user interface, ensuring a responsive and interactive experience.
-
Docker and Docker Compose: Used to containerize and orchestrate the microservices, simplifying deployment and scaling.
- Java 17 or higher
- Gradle (instead of Maven)
- Docker and Docker Compose
- Configured databases (MongoDB and MySQL)
-
Clone the repository:
git clone https://github.com/user/book-house.git
-
Navigate to the project directory:
cd book-house -
Configure databases:
- Deploy MongoDB either in the cloud or locally (e.g., MongoDB Atlas).
- Deploy MySQL either in the cloud or locally.
-
Configure local properties:
-
AuthService: Configure the JWT secret in the
application.propertiesfile.security.jwt.secret-key=addjwtkey -
CatalogueService: Configure whether you want to generate random books on application startup in the
application.propertiesfile.library.catalogue.generate-books-on-startup=false library.catalogue.generate-books-count=50
-
ClientService: Configure local properties such as the port, encryption secret, and PayPal configuration in the
application.propertiesfile.crypto.secret-key=${CRYPTO_SECRET_KEY:addKey} paypal.client-id=${PAYPAL_CLIENT_ID:addClientId} paypal.client-secret=${PAYPAL_CLIENT_SECRET:addClientSecret} paypal.mode=${PAYPAL_MODE:sandbox}
-
ConfigServer: Configure access to your Git repository in the
application.propertiesfile.spring.cloud.config.server.git.uri=add your git repo here with the folder in url spring.cloud.config.server.git.clone-on-start=true spring.cloud.config.server.git.username=add your git username here spring.cloud.config.server.git.password=add your git password or token here spring.cloud.config.server.git.default-label=master
-
Warning
Reference should be made to the folder where the configuration files are located, not to the repository in general.
-
GatewayService: Configure the JWT secret in the
application.propertiesfile.security.jwt.secret-key=addjwtkey -
NotificationService: Configure SendGrid in the
application.propertiesfile.sendgrid.api.key=add_your_sendgrid_api_key_here sendgrid.api.sender-mail=example@gmail.com
-
Modify in the Auth, Catalogue and Notification services the following url of MongoDB (this is in the properties of the configuration server).
spring.data.mongodb.uri=${SPRING_DATA_MONGODB_URI:add_your_mongodb_uri_here} -
Modify in the Cart and Review services the following MySQL configuration (this is in the properties of the configuration server).
spring.datasource.url=${SPRING_DATASOURCE_URL:add_your_mysql_url_here} spring.datasource.username=${SPRING_DATASOURCE_USERNAME:add_your_mysql_username_here} spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:add_your_mysql_password_here}
-
Run the services:
-
Configure and run with Docker Compose:
Create a
.envfile in the same directory asdocker-compose.ymlwith the following variables:# Eureka configuration EUREKA_PORT=8761 # Config Server configuration CONFIG_SERVER_PORT=8889 # Database configuration MONGO_URI=mongodb+srv://libraryUser:your_password@librarycluster.mongodb.net/ MONGO_AUTH_DB=auth_db MONGO_CATALOGUE_DB=catalogue_db MONGO_NOTIFICATION_DB=notification_db MYSQL_URL=jdbc:mysql://your_mysql_host:3306/ MYSQL_USER=root MYSQL_PASSWORD=your_mysql_password MYSQL_SHOPPING_CART_DB=shopping_cart MYSQL_REVIEW_DB=review_db # Gateway configuration GATEWAY_PORT=8090 # Client configuration CLIENT_PORT=8081 # Client configuration CRYPTO_SECRET_KEY=crypto_secret_key PAYPAL_CLIENT_ID=key PAYPAL_CLIENT_SECRET=secret
Then, run the services with Docker Compose:
docker-compose up --build
-
Without Docker Compose:
If not using Docker Compose, follow this order to run the projects:
- DiscoveryServer (Service discovery)
- ConfigServer (Centralized configuration server)
- AuthService
- CatalogueService
- CartService
- ReviewService
- NotificationService
- GatewayService (API Gateway)
- ClientService (User interface)
-
-
Access the application:
Open your browser and visit
http://localhost:8081to access the user interface.
-
Performance Enhancement in Recommendation Algorithm: There is no recommendation algorithm; it was only simulated.
-
Expand Administration Panel Functionality: Add additional features to the admin panel for more comprehensive and detailed management.
-
Add Unit and Integration Tests for Greater Code Coverage: Implement and improve tests to ensure code stability and detect issues early.
-
Pagination in the Backend: Implement pagination to handle large volumes of data more efficiently and improve page load speed.
-
Documentation and Code Organization: Add explanatory comments and improve code organization to facilitate maintenance and understanding.
Here are the contributors to this project:
darvybm |
AnthonyBeato |
This project is licensed under the MIT License - see the LICENSE file for details.

































