How maithanh1307/e-commerce works
This repository implements a multi-service e-commerce backend. The principal workflow runs from API requests through authentication and catalog/cart operations into order checkout, where the order service coordinates product, promotion and inventory checks; payment and review are separate order-related stages. Kafka carries order, payment and review events to notifications. Edges among sampled components are grounded in excerpts; the README documents gateway routes and service capabilities, but many controllers and integrations were not sampled, so uncertain links are omitted.
Main entry points: ApiGatewayApplication.java API Gateway · OrderService.java Checkout Orchestration · PaymentService.java Payment Processing · ReviewService.java Review Management
Components 31
Entry and Identity
- API Gateway
backend/api-gateway/src/main/java/com/ecommerce/api_gateway/ApiGatewayApplication.java - Auth API
backend/auth-service/src/main/java/com/ecommerce/auth_service/controller/AuthController.java - Authentication
backend/auth-service/src/main/java/com/ecommerce/auth_service/service/AuthService.java - JWT Security
backend/auth-service/src/main/java/com/ecommerce/auth_service/security/JwtService.java - User Store
backend/auth-service/src/main/java/com/ecommerce/auth_service/repository/UserRepository.java
Shopping and Catalog
- Product API
backend/product-service/src/main/java/com/ecommerce/product_service/controller/ProductController.java - Product Catalog
backend/product-service/src/main/java/com/ecommerce/product_service/service/ProductService.java - Product Store
backend/product-service/src/main/java/com/ecommerce/product_service/repository/ProductRepository.java - Cart API
backend/cart-service/src/main/java/com/ecommerce/cart_service/controller/CartController.java - Cart Management
backend/cart-service/src/main/java/com/ecommerce/cart_service/service/CartService.java - Cart Store
backend/cart-service/src/main/java/com/ecommerce/cart_service/repository/CartRepository.java - Cart Cache
backend/cart-service/src/main/java/com/ecommerce/cart_service/service/CartCacheService.java - Inventory API
backend/inventory-service/src/main/java/com/ecommerce/inventory_service/controller/InventoryController.java - Stock Management
backend/inventory-service/src/main/java/com/ecommerce/inventory_service/service/InventoryService.java - Stock Store
backend/inventory-service/src/main/java/com/ecommerce/inventory_service/repository/InventoryRepository.java
Order and Payment
- Order API
backend/order-service/src/main/java/com/ecommerce/order_service/controller/OrderController.java - Checkout Orchestration
backend/order-service/src/main/java/com/ecommerce/order_service/service/OrderService.java - Order Store
backend/order-service/src/main/java/com/ecommerce/order_service/repository/OrderRepository.java - Promotion Service
backend/promotion-service/src/main/java/com/ecommerce/promotion_service/service/PromotionService.java - Payment API
backend/payment-service/src/main/java/com/ecommerce/payment_service/controller/PaymentController.java - Payment Processing
backend/payment-service/src/main/java/com/ecommerce/payment_service/service/PaymentService.java - Payment Store
backend/payment-service/src/main/java/com/ecommerce/payment_service/repository/PaymentRepository.java
Customer Engagement
- Review API
backend/review-service/src/main/java/com/ecommerce/review_service/controller/ReviewController.java - Review Management
backend/review-service/src/main/java/com/ecommerce/review_service/service/ReviewService.java - Review Store
backend/review-service/src/main/java/com/ecommerce/review_service/repository/ReviewRepository.java - Event Consumer
backend/notification-service/src/main/java/com/ecommerce/notification_service/event/NotificationKafkaConsumer.java - Notifications
backend/notification-service/src/main/java/com/ecommerce/notification_service/service/NotificationService.java - Notification Store
backend/notification-service/src/main/java/com/ecommerce/notification_service/repository/NotificationRepository.java
Platform Services
- Kafka Events
backend/order-service/src/main/java/com/ecommerce/order_service/event/KafkaEventPublisher.java - Service Registry
backend/service-registry/src/main/java/com/ecommerce/service_registry/ServiceRegistryApplication.java
Other components
- API Client
Connections 37
- API Client → API Gateway: sends requests
- API Gateway → Auth API: routes auth
- API Gateway → Product API: routes catalog
- API Gateway → Cart API: routes cart
- API Gateway → Order API: routes orders
- API Gateway → Payment API: routes payments
- API Gateway → Inventory API: routes stock
- API Gateway → Review API: routes reviews
- Auth API → Authentication: delegates
- Authentication → User Store: reads/writes users
- Authentication → JWT Security: creates tokens
- Product API → Product Catalog: delegates
- Product Catalog → Product Store: reads/writes products
- Cart API → Cart Management: delegates
- Cart Management → Cart Store: reads/writes carts
- Cart Management → Cart Cache: checks/invalidates
- Inventory API → Stock Management: delegates
- Stock Management → Stock Store: reads/writes stock
- Order API → Checkout Orchestration: delegates
- Checkout Orchestration → Order Store: reads/writes orders
- Checkout Orchestration → Cart Management: fetches cart
- Checkout Orchestration → Product Catalog: fetches products
- Checkout Orchestration → Stock Management: reserves stock
- Checkout Orchestration → Promotion Service: validates code
- Checkout Orchestration → Kafka Events: publishes events
- Payment API → Payment Processing: delegates
- Payment Processing → Checkout Orchestration: fetches order
- Payment Processing → Payment Store: reads/writes payments
- Payment Processing → Kafka Events: publishes events
- Review API → Review Management: delegates
- Review Management → Checkout Orchestration: checks order
- Review Management → Review Store: reads/writes reviews
- Review Management → Kafka Events: publishes events
- Kafka Events → Event Consumer: delivers events
- Event Consumer → Notifications: handles events
- Notifications → Notification Store: reads/writes notifications
- API Gateway → Service Registry: discovers services