-
-
Notifications
You must be signed in to change notification settings - Fork 0
Microservices
Truong Le Vinh Phuc edited this page Jun 21, 2025
·
1 revision
This page details each microservice in the Cloud-Native E-commerce Platform, their responsibilities, and how they interact.
Our platform is composed of several microservices, each responsible for a specific business domain. All services follow Clean Architecture principles with clear separation of concerns.
Manages the product catalog, including products, categories, and brands.
- Catalog.API: REST API endpoints for catalog operations
- Catalog.Application: Application business logic using CQRS pattern
- Catalog.Core: Domain entities and business rules
- Catalog.Infrastructure: MongoDB data access implementation
- Product CRUD operations
- Category and brand management
- Product search and filtering
- Product image handling
- MongoDB: Document database for flexible product attributes
-
GET /api/v1/catalog/products
: Get all products -
GET /api/v1/catalog/products/{id}
: Get product by ID -
GET /api/v1/catalog/products/category/{category}
: Get products by category -
POST /api/v1/catalog/products
: Create new product -
PUT /api/v1/catalog/products
: Update existing product -
DELETE /api/v1/catalog/products/{id}
: Delete product
Manages shopping carts for users, including adding/removing items and checkout.
- Basket.API: REST API endpoints for basket operations
- Basket.Application: Application business logic
- Basket.Core: Domain entities and business rules
- Basket.Infrastructure: Redis data access implementation
- Shopping cart creation and management
- Add/remove/update cart items
- Cart checkout process
- Integration with Discount service for applying discounts
- Redis: In-memory database for fast cart operations
-
GET /api/v1/basket/{username}
: Get basket by username -
POST /api/v1/basket
: Update basket -
DELETE /api/v1/basket/{username}
: Delete basket -
POST /api/v1/basket/checkout
: Checkout basket
Manages product discounts and coupon codes.
- Discount.API: REST API and gRPC service for discount operations
- Discount.Application: Application business logic
- Discount.Core: Domain entities and business rules
- Discount.Infrastructure: PostgreSQL data access implementation
- Discount CRUD operations
- Coupon validation
- Discount calculation
- gRPC service for internal communication
- PostgreSQL: Relational database for discount rules
-
GET /api/v1/discount/{productName}
: Get discount by product name -
POST /api/v1/discount
: Create discount -
PUT /api/v1/discount
: Update discount -
DELETE /api/v1/discount/{productName}
: Delete discount
-
GetDiscount
: Get discount for product -
CreateDiscount
: Create new discount -
UpdateDiscount
: Update existing discount -
DeleteDiscount
: Delete discount
Manages the order process from creation to fulfillment.
- Ordering.API: REST API endpoints for order operations
- Ordering.Application: Application business logic using CQRS with MediatR
- Ordering.Core: Domain entities and business rules
- Ordering.Infrastructure: SQL Server data access implementation
- Order creation and management
- Order status tracking
- Order history for users
- Event-driven integration with Basket service
- SQL Server: Relational database for order data
-
GET /api/v1/orders
: Get all orders -
GET /api/v1/orders/{username}
: Get orders by username -
POST /api/v1/orders
: Create order -
PUT /api/v1/orders
: Update order -
DELETE /api/v1/orders/{id}
: Delete order
-
BasketCheckoutConsumer
: Consumes basket checkout events from RabbitMQ
Serves as the entry point for all client requests, routing them to appropriate microservices.
- Ocelot.ApiGateway: API Gateway implementation using Ocelot
- Request routing
- Request aggregation
- Authentication and authorization
- Rate limiting and caching
- Load balancing
- Route configuration in
ocelot.json
- Environment-specific configurations
- REST APIs: For direct service-to-service communication
- gRPC: For high-performance internal communication (Basket to Discount)
- RabbitMQ: For event-driven communication
- Event Bus: Shared infrastructure for publishing and consuming events
-
BasketCheckoutEvent
: Published when a user checks out their basket -
OrderCreatedEvent
: Published when an order is created
- Basket Service → Discount Service: Gets product discounts via gRPC
- Basket Service → Ordering Service: Sends checkout events via RabbitMQ
- All Services → API Gateway: All client communication goes through the gateway