graph LR
Basket_API_Entry_Point_Orchestration_["Basket.API (Entry Point & Orchestration)"]
Basket_Business_Logic_Handlers_Domain_Models_["Basket Business Logic (Handlers & Domain Models)"]
Basket_Data_Access_Repositories_["Basket Data Access (Repositories)"]
Data_Store_Redis_["Data Store (Redis)"]
Discount_gRPC_Service["Discount gRPC Service"]
Unclassified["Unclassified"]
Basket_API_Entry_Point_Orchestration_ -- "dispatches commands/queries to" --> Basket_Business_Logic_Handlers_Domain_Models_
Basket_Business_Logic_Handlers_Domain_Models_ -- "utilizes for data persistence" --> Basket_Data_Access_Repositories_
Basket_Data_Access_Repositories_ -- "interacts with for storage" --> Data_Store_Redis_
Basket_API_Entry_Point_Orchestration_ -- "consumes for discount information" --> Discount_gRPC_Service
The Basket Microservice is structured around a single Basket.API project, which acts as the central hub for all shopping cart functionalities. This Basket.API component serves as the entry point for client requests, handling HTTP communication and orchestrating the flow of operations. It dispatches commands and queries to the Basket Business Logic component, which encapsulates the core business rules, domain models (like ShoppingCart and ShoppingCartItem), and MediatR handlers responsible for processing these operations. For data persistence, the Basket Business Logic relies on the Basket Data Access component, which includes repository implementations and a caching layer. The Basket Data Access component, in turn, interacts directly with the Data Store (Redis) for high-performance storage and retrieval of basket data. Additionally, the Basket.API component integrates with an external Discount gRPC Service to apply discounts to shopping carts, demonstrating an interaction with an external dependency. This architecture emphasizes a consolidated approach where API, business logic, and data access concerns are managed within a single service, while leveraging external services for specialized functionalities like discounts and a dedicated data store for persistence.
Serves as the primary entry point for client requests, exposing RESTful endpoints for managing shopping cart operations (e.g., adding, retrieving, deleting items). It handles HTTP request/response cycles, authentication, and authorization. This component also orchestrates the overall business logic by dispatching commands and queries to internal handlers using MediatR.
Related Classes/Methods:
Encapsulates the core business rules and entities related to the shopping cart. This component processes commands and queries for basket operations, ensuring business invariants are maintained. It includes the MediatR handlers that implement the specific logic for each basket action and the domain models representing the structure of a shopping cart and its items.
Related Classes/Methods:
StoreBasketHandler.csGetBasketHandler.csDeleteBasketHandler.csShoppingCart.csShoppingCartItem.cs
Provides concrete implementations for data access, managing the persistence and retrieval of shopping cart data. This component includes the primary repository responsible for interacting with the underlying data store and a caching layer to optimize performance for frequent basket operations.
Related Classes/Methods:
An external, high-performance key-value data store used for persisting shopping cart data. It offers fast read/write capabilities essential for dynamic and frequently accessed basket operations.
Related Classes/Methods:
An external gRPC service that provides discount information. The Basket microservice consumes this service to apply relevant discounts to shopping carts during various operations.
Related Classes/Methods:
Component for all unclassified files and utility functions (Utility functions/External Libraries/Dependencies)
Related Classes/Methods: None