# jasonwang82/mall architecture

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

- Interactive diagram: https://gitdiagram.com/jasonwang82/mall
- Repository: https://github.com/jasonwang82/mall

## Overview

##### Project type and purpose
- This is a full-stack, modular e-commerce system (“mall”) implemented as a multi-module Maven project.
- It consists of backend micro-services (mall-admin, mall-portal, mall-search, plus supporting modules mall-common, mall-security, mall-mbg) and two separate frontend applications (mall-admin-web for the back office and mall-app-web for the mobile/portal).
- The goal is to provide typical e-commerce workflows: administration, storefront browsing, ordering, search, messaging, caching, logging and analytics.

##### File structure
- Top-level modules:
- mall-common: shared utilities and API result objects
- mall-mbg: MyBatis code generator
- mall-security: Spring Security extension library
- mall-admin: back-office REST API
- mall-portal: storefront REST API
- mall-search: Elasticsearch-based search service
- mall-demo: test/demo code
- document/docker and sh scripts for Docker Compose and container orchestration.
- document/elk shows Logstash config for centralized logging.
- External resources: SQL schema, Postman collections, PDM and mind-map designs.

##### Insights from README
- System is Spring Boot + MyBatis; uses Docker for containerization.
- Core infrastructure: MySQL, Redis, RabbitMQ, Elasticsearch, MongoDB, MinIO/OSS, Nginx, ELK stack.
- Frontend frameworks: Vue.js (admin & portal), uni-app for mobile.
- Typical deployment via Nginx (static asset hosting and reverse proxy), Docker Compose for services.

##### Diagramming recommendations
- Client (blue),
- Edge/router (orange),
- Services (green),
- Data stores (red),
- Messaging (purple),
- Logging/monitoring (grey).
- User → Nginx → Service
- Service → Data store
- Service ↔ RabbitMQ → Service
- Service → Logstash → Elasticsearch → Kibana

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    subgraph "Client Tier"
        AdminWeb["Admin Web (Vue.js SPA)"]:::frontend
        PortalWeb["Portal Web/Mobile (Vue.js/uni-app)"]:::frontend
    end

    %% Edge / Ingress
    subgraph "Edge / Ingress"
        Nginx["Nginx Ingress"]:::edge
    end

    AdminWeb -->|HTTP| Nginx
    PortalWeb -->|HTTP| Nginx
    click Nginx "https://github.com/jasonwang82/mall/blob/master/document/docker/nginx.conf"

    %% Shared Libraries
    subgraph "Shared Libraries"
        MallCommon["mall-common"]:::service
        MallSecurity["mall-security"]:::service
        MallMBG["mall-mbg"]:::service
    end
    click MallCommon "https://github.com/jasonwang82/mall/tree/master/mall-common/"
    click MallSecurity "https://github.com/jasonwang82/mall/tree/master/mall-security/"
    click MallMBG "https://github.com/jasonwang82/mall/tree/master/mall-mbg/"

    %% Backend Services
    subgraph "Backend Services"
        MallAdmin["mall-admin"]:::service
        MallPortal["mall-portal"]:::service
        MallSearch["mall-search"]:::service
    end
    click MallAdmin "https://github.com/jasonwang82/mall/tree/master/mall-admin/"
    click MallPortal "https://github.com/jasonwang82/mall/tree/master/mall-portal/"
    click MallSearch "https://github.com/jasonwang82/mall/tree/master/mall-search/"

    Nginx -->|/admin-api/**| MallAdmin
    Nginx -->|/portal-api/**| MallPortal

    %% Services use shared libraries
    MallAdmin -.-> MallCommon
    MallAdmin -.-> MallSecurity
    MallAdmin -.-> MallMBG
    MallPortal -.-> MallCommon
    MallPortal -.-> MallSecurity
    MallPortal -.-> MallMBG
    MallSearch -.-> MallCommon
    MallSearch -.-> MallSecurity
    MallSearch -.-> MallMBG

    %% Messaging
    subgraph "Messaging"
        RabbitMQ["RabbitMQ"]:::message
    end
    click RabbitMQ "https://github.com/jasonwang82/mall/blob/master/mall-portal/src/main/java/com/macro/mall/portal/config/RabbitMqConfig.java"

    MallPortal -->|AMQP publish order-cancel| RabbitMQ
    RabbitMQ -->|AMQP consume order-cancel| MallPortal
    RabbitMQ -->|AMQP notify admin| MallAdmin

    %% Data Stores
    subgraph "Data Stores"
        MySQL["MySQL"]:::datastore
        Redis["Redis"]:::datastore
        ElasticsearchDS["Elasticsearch (Product Index)"]:::datastore
        MongoDB["MongoDB"]:::datastore
        MinIO["MinIO/OSS"]:::datastore
    end

    MallAdmin -->|JDBC/Redis| MySQL
    MallAdmin -->|Cache| Redis
    MallAdmin -->|Upload| MinIO

    MallPortal -->|JDBC/Redis| MySQL
    MallPortal -->|Cache| Redis
    MallPortal -->|Upload| MinIO

    MallSearch -->|Index/Query| ElasticsearchDS
    MallSearch -->|JDBC| MySQL
    MallSearch -->|Cache| Redis

    click MinIO "https://github.com/jasonwang82/mall/blob/master/mall-admin/src/main/java/com/macro/mall/config/OssConfig.java"

    %% Logging & Monitoring
    subgraph "Logging & Monitoring"
        Logstash["Logstash"]:::logging
        ESLogging["Elasticsearch (Logs)"]:::logging
        Kibana["Kibana"]:::logging
    end

    MallAdmin -->|Logs| Logstash
    MallPortal -->|Logs| Logstash
    MallSearch -->|Logs| Logstash
    Logstash --> ESLogging
    ESLogging --> Kibana
    click Logstash "https://github.com/jasonwang82/mall/blob/master/document/elk/logstash.conf"

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        Jenkins["Jenkins"]:::infra
        DockerCompose["Docker Compose"]:::infra
    end
    Jenkins --> DockerCompose
    click DockerCompose "https://github.com/jasonwang82/mall/blob/master/document/docker/docker-compose-app.yml"
    click DockerCompose "https://github.com/jasonwang82/mall/blob/master/document/docker/docker-compose-env.yml"

    %% Styles
    classDef frontend fill:#deebff,stroke:#4c78a8;
    classDef edge fill:#ffe7ba,stroke:#d69922;
    classDef service fill:#d9f0d3,stroke:#4c9331;
    classDef datastore fill:#f8c8c1,stroke:#bf1e2e;
    classDef message fill:#d4c4fb,stroke:#5f32a3;
    classDef logging fill:#e8e9eb,stroke:#999999;
    classDef infra fill:#f5e1da,stroke:#a55194;
```
