Modules Overview
Figure X: Walkthrough Diagram
This module is responsible for managing the book inventory and providing users with the ability to search, browse, filter, and view detailed information about books in the catalog. The Catalog Manager serves as the primary interface between users and the bookstore's product data.
The Catalog Manager Module is rooted in the Repository Pattern with integrated search capabilities. This design element provides a unified interface for all catalog operations, combining data access, search functionality, and presentation logic.
The module supports the following key operations:
Browse and Filter - Users can browse books by category, filter by price range, availability status, and sort results by criteria such as new arrivals, bestsellers, or price. The backend Java services implement strategy patterns for flexible filtering and sorting, exposing these capabilities through RESTful APIs.
Full-Text Search - The MySQL database supports full-text search across book metadata including title, author, ISBN, and keywords. The search service queries the database using MySQL's FULLTEXT indexes and returns ranked results. The system supports partial matching and provides search suggestions.
Metadata Display - The module retrieves and presents structured book information including title, author, price, description, and real-time availability status. The Java backend queries the MySQL database and returns book data as JSON through REST APIs. The React frontend displays this data in an intuitive, responsive interface.
The Catalog Manager does not concern itself with user authentication or purchase transactions. It is solely focused on presenting accurate, searchable product information to users. The module serves data to both authenticated and anonymous users through the same RESTful endpoints, ensuring broad accessibility to the catalog.
This module is responsible for handling all transactional operations including user authentication, shopping cart management, payment processing, order fulfillment, and administrative functions. The Transaction Processor serves as the business logic layer for all customer and administrative transactions within the system, implemented using Java and Jakarta EE running on Apache Tomcat.
The Transaction Processor implements session-based authentication using Jakarta EE security features. This design element manages the complete user lifecycle from registration through authenticated sessions.
The module provides the following authentication operations:
Account Creation - New users can register by providing credentials that are validated against security policies. User data is stored in the MySQL database with passwords hashed before storage.
Authentication - Users authenticate via secure login through RESTful APIs. The Java backend validates credentials against the MySQL database and creates a session managed by Tomcat. Session tokens are returned to the React frontend and included in subsequent API requests.
Session Management - Sessions are tracked server-side in Tomcat with automatic timeout policies. The system maintains session state while ensuring the backend services remain scalable across multiple Tomcat instances.
Role-Based Access Control - The Jakarta EE backend differentiates between regular users and administrators using role-based security annotations, enforcing appropriate permissions for each role.
The User Account module integrates with all other Transaction Processor components, providing the authentication context necessary for personalized shopping experiences and administrative functions.
The Shopping Cart and Checkout System is rooted in the State Pattern for cart management and the Strategy Pattern for payment processing. This design element handles the complete purchase workflow from cart management through payment completion, implemented in Java with Jakarta EE.
The module supports the following operations:
Persistent Shopping Cart - Users can add, remove, and update book quantities in their cart through REST APIs consumed by the React frontend. The cart persists in the MySQL database, associated with the user's account. The Java backend validates book availability by querying inventory levels before allowing items to be added.
Checkout Orchestration - When users initiate checkout from the React interface, the Java backend orchestrator coordinates validation of cart contents, inventory checks, and payment processing. This ensures data consistency across multiple database operations using MySQL transactions.
Payment Processing - The system supports multiple payment methods through the Strategy Pattern implemented in Java. Each payment method implements a common interface, allowing the system to process different payment types uniformly. The Java backend integrates with external payment provider APIs to securely process transactions.
Security - All sensitive payment data is transmitted over HTTPS. The Tomcat server is configured with SSL/TLS certificates. The system never stores raw credit card information in the MySQL database, instead storing only transaction references from payment providers.
The Shopping Cart and Checkout System does not handle order fulfillment or notification delivery. It is concerned only with managing the cart state and successfully processing payments. Upon successful payment, the system hands off to the Order Management component.
The Order and Inventory Management component is rooted in domain-driven design principles, treating Orders as aggregate roots with complete lifecycle management. This design element handles both customer-facing order operations and administrative inventory control, implemented as Java services with Jakarta EE.
The module provides the following capabilities:
Order Creation and Tracking - When checkout completes successfully, the Java backend creates an Order entity in the MySQL database containing all order details, line items, and customer information. Each order progresses through status transitions (pending, processing, shipped, delivered) tracked by database state updates.
Order History - Users can access their complete order history through REST APIs consumed by the React frontend. The Java backend queries the MySQL database to retrieve order details, providing filtering and sorting capabilities.
Administrative Catalog Management - Administrators can perform CRUD operations on books through dedicated REST endpoints. The Java backend with Jakarta EE security annotations enforces administrative permissions, allowing authorized users to add new titles, edit existing information, and remove discontinued items. Changes are persisted to the MySQL database.
Inventory Management - Administrators manage stock levels and availability status through the React admin interface. The Java backend provides real-time inventory tracking stored in MySQL, preventing overselling through validation checks during cart operations and checkout using database transactions.
Audit Logging - All administrative actions are logged to the MySQL database for accountability and compliance purposes.
The Order and Inventory Management component integrates with the Catalog Manager for inventory synchronization and with the Notification Controller for order status updates. It does not concern itself with payment processing or user authentication, relying on other Transaction Processor components for these functions.
The Recommendation Engine leverages a Large Language Model (LLM) to provide personalized book suggestions based on user behavior and book metadata. This design element enhances user engagement by surfacing relevant products through AI-powered recommendations.
The module generates recommendations through the following mechanisms:
Behavioral Analysis - The Java backend tracks user browsing history, search queries, cart additions, and purchase history, storing this data in the MySQL database to build user preference profiles.
LLM Integration - The system sends user behavior data and book metadata to the LLM through API calls from the Java backend. The LLM analyzes patterns and generates personalized book recommendations based on user interests and similar user behaviors.
Content-Based Analysis - The LLM considers book attributes such as genre, author, topics, and descriptions stored in the MySQL database to recommend books with similar characteristics to those a user has previously shown interest in.
Recommendation Delivery - The Java backend exposes recommendation data through REST APIs, which the React frontend consumes to display personalized recommendations on the homepage, product detail pages, and during checkout.
The Recommendation Engine operates as a separate service within the Java backend, processing user behavior data without impacting transaction processing performance. It does not interfere with core catalog or transaction operations, serving purely as an enhancement layer.
This module is responsible for providing an event-driven notification system through which order-related updates are communicated to users. The Notification Controller serves as the messaging hub that responds to order lifecycle events and delivers notifications through multiple channels, implemented as Java services within the Jakarta EE backend.
The Notification Controller is rooted in the Event-Driven/Publish-Subscribe (Pub-Sub) architectural style with the Strategy Pattern for multi-channel delivery. The controller listens for order-related events within the Java backend and delivers appropriate notifications to users.
The Notification Controller responds to the following events:
OrderPlaced - This event notifies users that their order has been successfully created and payment has been processed. The Java service sends an order confirmation with order details and estimated delivery date.
OrderConfirmed - This event notifies users that their order has been confirmed by the system and is being prepared for shipment.
OrderShipped - This event notifies users that their order has been shipped, including tracking information for package monitoring.
OrderDelivered - This event notifies users that their order has been successfully delivered.
PaymentProcessed - This event confirms successful payment processing with transaction details.
PaymentFailed - This event notifies users of payment failures with instructions for resolution.
The Notification Controller does not care which module publishes these events within the Java backend. It is only concerned with listening for events and delivering appropriate messages to users. The controller subscribes to events using Jakarta EE's event system or internal messaging mechanisms.
The system delivers notifications through multiple channels:
Email Delivery - The Java backend sends notifications via SMTP using JavaMail API to the user's registered email address. Email templates are stored in the application and populated with order-specific data.
In-App Messaging - The Java backend stores notifications in the MySQL database, which are then retrieved by the React frontend and displayed in the user's dashboard when they log into the system.
Delivery Management - The notification system manages asynchronous delivery using Java threading or Jakarta EE asynchronous processing. Failed delivery attempts are logged in the MySQL database for retry processing.
User Preferences - Users can configure their preferred notification channels through the React interface, which stores preferences in the MySQL database. The Java backend respects these preferences when determining delivery methods.
The Notification Controller operates as a set of Java services within the backend, responding to events published by the Transaction Processor module. It does not participate in order processing or catalog management, focusing solely on communication delivery.
This module encomposses all of the nonfunction requirements that do not fit into the other three main modules.
The UI Framework provides a consistent, accessible, and responsive interface across all user touchpoints using React and TypeScript. This design element ensures usability and accessibility compliance while maintaining visual consistency throughout the application, with Vite serving as the build tool and development server.
Key components include:
Responsive Layout System - The React frontend adapts seamlessly to mobile, tablet, and desktop devices using CSS media queries and responsive design patterns. Vite's hot module replacement enables rapid development and testing of responsive layouts.
Component Library - Reusable React components provide consistent patterns for navigation, catalog browsing, cart management, and order tracking. TypeScript ensures type safety and better maintainability across components.
Accessibility Compliance - The React components implement accessibility best practices including semantic HTML, ARIA labels, keyboard navigation support, and proper color contrast.
Single-Page Application - React Router manages client-side routing, providing a seamless single-page application experience. Vite optimizes the build process, producing efficient bundles for production deployment.
The Security Infrastructure implements comprehensive security measures across authentication, data protection, and compliance. This design element protects sensitive user and payment information while preventing common security vulnerabilities, leveraging Jakarta EE security features and MySQL database security.
Security measures include:
Authentication Security - Jakarta EE security annotations enforce authentication and authorization. User passwords are hashed before storage in the MySQL database using Java security libraries.
Data Encryption - HTTPS/TLS secures data transmission between the React frontend and Java backend. Tomcat is configured with SSL certificates to encrypt all network traffic.
Input Validation - The Java backend validates and sanitizes all input data to prevent SQL injection attacks. Jakarta EE validation annotations ensure data integrity. MySQL prepared statements prevent SQL injection vulnerabilities.
Secure Payment Processing - Payment card data is never stored in the MySQL database. The Java backend transmits payment information directly to external payment providers over secure HTTPS connections, storing only transaction references.
Session Security - Tomcat manages secure sessions with HTTP-only cookies and CSRF protection. Session timeout policies are configured in the Jakarta EE application.
The Scalability and Performance Architecture ensures the system can handle increasing user load while maintaining low-latency responses and high availability. This design element implements horizontal scaling, fault tolerance, and performance optimization strategies using the three-tier architecture with React frontend, Java backend, and MySQL database.
Key architectural components include:
Horizontal Scalability - Multiple Tomcat instances run the Java backend behind a load balancer, distributing traffic across servers. The stateless REST API design allows any Tomcat instance to handle any request, enabling linear scaling as demand increases.
Database Optimization - MySQL indexes optimize query performance for frequently accessed data such as book searches, user lookups, and order queries. Connection pooling in the Java backend reduces database connection overhead. Database query optimization ensures efficient data retrieval.
Frontend Performance - Vite optimizes the React application for production with code splitting, tree shaking, and minification. Static assets are served efficiently, and the single-page application design minimizes server requests.
Caching Strategy - The Java backend implements application-level caching for frequently accessed catalog data, reducing MySQL query load. HTTP caching headers instruct browsers to cache static resources.
High Availability - Multiple Tomcat instances provide redundancy, eliminating single points of failure. MySQL replication maintains data availability with primary-replica configurations. Load balancers monitor server health and route traffic only to healthy instances.
Performance Targets - The system delivers fast response times for search, checkout, and account operations through optimized database queries, efficient Java code, and a lightweight React frontend built with Vite.
Traceability Matrix
Figure X: Traceability Matrix of the Functional and Nonfunctional Requirements