# danhthanhle/wmk_be_01 architecture

> Architecture diagram of the GitHub repository danhthanhle/wmk_be_01, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danhthanhle/wmk_be_01
- Repository: https://github.com/danhthanhle/wmk_be_01

## Overview

##### High-Level Architecture Components

a. Main System Components:
- Web API Layer (WMK_BE_RecipesAndPlans_Controller)
- Business Logic Layer (WMK_BE_BusinessLogic)
- Data Access Layer (WMK_BE_RecipesAndPlans_DataAccess)
- Web Admin Interface (WMK_WebAdmin)
- External Services Integration (Payment systems: Momo, ZaloPay)
- Message Queue System (RabbitMQ)
- Caching Layer (Redis)

b. Core Domain Areas:
- Recipe Management
- Meal Planning
- Order Processing
- User Management
- Transaction Processing
- Ingredient Management
- Category Management

##### Detailed Component Relationships

a. API Layer:
- Controllers handling different domain areas
- Authentication/Authorization flow
- Request/Response pipeline

b. Business Layer:
- Service implementations
- Business logic validators
- AutoMapper profiles
- Helper utilities

c. Data Access Layer:
- Repository pattern implementation
- Entity models
- Database context
- Unit of Work pattern

##### Integration Points

- Payment Gateway Integration (Momo, ZaloPay)
- Message Queue System (RabbitMQ Producer/Consumer)
- Caching System (Redis)
- Email Service Integration

##### Key Workflows to Highlight

- User authentication flow
- Recipe creation and management
- Order processing pipeline
- Payment processing sequence
- Weekly meal plan generation

##### Infrastructure Components

- Docker containers (as evidenced by Dockerfile presence)
- Kubernetes deployment (k8s folder)
- Configuration management
- Logging and monitoring

##### Persistent Storage

Remember to highlight the microservices architecture aspects and the containerized nature of the application, as evidenced by the Docker and Kubernetes configurations present in the project structure.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef client fill:#B3E5FC,stroke:#0288D1
    classDef api fill:#90CAF9,stroke:#1976D2
    classDef business fill:#9FA8DA,stroke:#3F51B5
    classDef data fill:#B39DDB,stroke:#673AB7
    classDef infrastructure fill:#E0E0E0,stroke:#757575
    classDef external fill:#A5D6A7,stroke:#4CAF50
    classDef storage fill:#FFF59D,stroke:#FBC02D
    classDef security fill:#FFCC80,stroke:#FF9800

    %% Client Layer
    WebAdmin["Web Admin Interface"]:::client
    click WebAdmin "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_WebAdmin/Components"

    %% API Layer
    subgraph API
        Controllers["API Controllers"]:::api
        click Controllers "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_RecipesAndPlans_Controller/Controllers"
        AuthMiddleware["Authentication Middleware"]:::security
    end

    %% Business Layer
    subgraph BusinessLogic
        Services["Business Services"]:::business
        click Services "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_BusinessLogic/Service/Implement"
        AuthService["Authentication Service"]:::security
        click AuthService "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/WMK_BE_BusinessLogic/Service/Implement/AuthService.cs"
        Validation["Data Validation"]:::business
        click Validation "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_BusinessLogic/ValidationModel"
        DataMapper["AutoMapper"]:::business
        click DataMapper "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_BusinessLogic/Mapper"
        TransactionService["Transaction Service"]:::business
        click TransactionService "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/WMK_BE_BusinessLogic/Service/Implement/TransactionService.cs"
    end

    %% Data Access Layer
    subgraph DataAccess
        Repository["Repositories"]:::data
        click Repository "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_RecipesAndPlans_DataAccess/Repository/Implement"
        DomainModels["Domain Models"]:::data
        click DomainModels "https://github.com/DanhThanhLe/WMK_BE_01/tree/main/WMK_BE_Core/WMK_BE_RecipesAndPlans_DataAccess/Models"
        RedisService["Redis Service"]:::data
        click RedisService "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/WMK_BE_RecipesAndPlans_DataAccess/Repository/Implement/RedisService.cs"
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        RabbitMQProducer["RabbitMQ Producer"]:::infrastructure
        click RabbitMQProducer "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/WMK_BE_BusinessLogic/Service/Implement/RabitMQProducer.cs"
        RabbitMQConsumer["RabbitMQ Consumer"]:::infrastructure
        click RabbitMQConsumer "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/WMK_BE_BusinessLogic/Service/Implement/RabitMQConsumer.cs"
        Docker["Docker Container"]:::infrastructure
        click Docker "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/WMK_BE_Core/docker-compose.yml"
        K8s["Kubernetes"]:::infrastructure
        click K8s "https://github.com/DanhThanhLe/WMK_BE_01/blob/main/k8s/configs.yaml"
    end

    %% External Services
    MomoPayment["Momo Payment"]:::external
    ZaloPayment["ZaloPay Payment"]:::external

    %% Storage
    Database[(Database)]:::storage
    Redis[(Redis Cache)]:::storage

    %% Relationships
    WebAdmin --> Controllers
    Controllers --> AuthMiddleware
    AuthMiddleware --> Services
    Services --> Repository
    Services --> AuthService
    Services --> Validation
    Services --> DataMapper
    Services --> TransactionService
    TransactionService --> MomoPayment
    TransactionService --> ZaloPayment
    Repository --> DomainModels
    Repository --> Database
    Services --> RabbitMQProducer
    RabbitMQConsumer --> Services
    Services --> RedisService
    RedisService --> Redis

    %% Legend
    subgraph Legend
        Client["Client Component"]:::client
        APIComp["API Component"]:::api
        BusinessComp["Business Component"]:::business
        DataComp["Data Component"]:::data
        InfraComp["Infrastructure Component"]:::infrastructure
        ExtComp["External Service"]:::external
        StorageComp["Storage"]:::storage
        SecComp["Security Component"]:::security
    end
```
