How luantruongptit/shopee_api-msa-nestjs works
Main Components
a. API Gateway Layer:
• Authentication/authorization components (JWT, Google Auth)
• Rate limiting and API key validation
b. Microservices:
• Auth Service
• User Service
• Product Service
• Logistics Service
• Seller Channel Service
• Role Service
• File Upload Service
• Brand Service
• Inventory Service
c. Message Broker:
• Kafka as the event bus between services
• Event publishing/subscription patterns
d. Databases:
• MongoDB instances for different services
• Redis for caching and session management
Component Relationships
a. Data Flow:
• API Gateway routing requests to appropriate services
• Event-driven communication between services via Kafka
• Database connections for each service
b. Authentication Flow:
• JWT token validation path
• Refresh token mechanism
• Google OAuth integration
Specific Implementation Details
a. Service Patterns:
• CQRS pattern in Product service
• Event Sourcing implementation
• Repository pattern usage
b. Cross-Cutting Concerns:
• Shared libraries usage
• Common middleware
• Error handling flow
Additional Components
• Nginx as the reverse proxy
• Docker containers
• Monitoring and logging components
• File storage service (AWS S3)
Layered Architecture
For each service, show:
• Controllers/API Layer
• Application Layer (CQRS)
• Domain Layer
• Infrastructure Layer
• Repository Layer
Infrastructure components
Remember to:
• Use consistent notation
• Both synchronous and asynchronous communication patterns
• Critical paths and dependencies
This system design should reflect the complex nature of the e-commerce platform while maintaining clarity in showing how different components interact and work together.