How minhhoanq/ecommerce_web works
Project Components
• Client (Frontend):
– Located in the “client” directory.
– Built with React (JSX files, component structure, TailwindCSS).
– Contains pages for public views, member functions, and admin dashboards.
• API Gateway:
– Found in the “gateway” directory.
– Acts as the central entry point providing “unified” API endpoints for authentication, cart, category, feedback, image, order, and product services.
• AuthService Service:
– Present in the “AuthService” folder.
– Handles user authentication and related logic.
• CommentService Service:
– Present in the “CommentService” folder.
– Focused on feedback/comments handling. Note that it uses Prisma for database interactions.
• Server (Backend Core Service):
– Located in the “server” directory.
– Implements a layered architecture with clear separation into presentation, application (usecases and dtos), domain (entities, repositories, value objects), and infrastructure (dependency injection, repositories, external services like RabbitMQ, Redis, Elasticsearch, Kafka).
– This service likely handles the core business logic for product, order, cart, and category management.
• Additional Components & Integrations:
– Docker: “docker-compose.yml” and Dockerfile present in “server” indicate container-based deployment.
– Messaging / Integration Technologies: RabbitMQ (present in multiple services and in “server/src/infrastructure/rabbitmq”), Redis (for caching or session management), Kafka, and possibly Elasticsearch.
– Supporting configuration files (logstash.conf, tailwind.config.js) for logging and styling.
Architectural Relationships & Data Flow
• The Client interacts with the system via the API Gateway.
• The Gateway routes requests to respective microservices or backend services.
– For example, authentication requests go to AuthService, comment/feedback requests go to CommentService, and product/order related requests are forwarded to the Server.
• The Server service follows a layered (or Domain-Driven Design) architecture:
• Data Storage & External Integrations:
– Include separate components for databases (via Prisma in CommentService; possibly a relational database connected to the Server backend), message brokers (RabbitMQ/Redis/Kafka), and external services (S3 for file storage – as seen with s3.config.ts).
Architectural Patterns & Technologies
• Microservices Architecture: Each service (AuthService, CommentService, Server) is largely independent and communicates via an API Gateway.
• API Gateway Pattern: Centralizes front-end communication and dispatches to the appropriate backend service.
• Domain-Driven Design (especially in the “server” service): Look for aggregates in areas like product, cart, and order management.
• Use of modern frontend frameworks: The client is built with React, Tailwind CSS.
• Technology Stack Indicators: Node.js/Express (in various services), TypeScript (especially in “server”), and Prisma as an ORM.