# exrick/xmall architecture

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

- Interactive diagram: https://gitdiagram.com/exrick/xmall
- Repository: https://github.com/exrick/xmall

## Overview

##### Project type and purpose
- XMall is a SOA-style, distributed e-commerce platform. It comprises several loosely coupled services (content, order, member, search, SSO, management) communicating via Dubbo (RPC) with ZooKeeper as service registry. It provides a Vue-based public storefront, a classic SpringMVC back-office UI, and multiple backend services exposing interfaces for business logic and persistence.

##### File structure
- Top-level modules (in xmall-parent):
- generatorSqlmapCustom – MyBatis code generator tool
- xmall-common – shared annotations, constants, utils, Redis clients
- xmall-content (interface & service) – content/advertisement service
- xmall-manager (interface, DAO, POJO, service, web) – back-office administration
- xmall-front-web – SpringMVC façade for the public front end
- xmall-search (interface & service) – Elasticsearch-based product search
- xmall-sso (interface & service) – single sign-on/auth service
- xmall-parent – parent POM
- xmall-search, xmall-sso, xmall-manager, xmall-content, xmall-common – typical multi-module Maven layout
- Each service module has DAO, service-impl, interface, MyBatis XML, and Spring XML (DAO, service, transaction, Redis, ActiveMQ configs). Web modules include SpringMVC configs, controllers, views/static assets.

##### README for additional insights
- XMall runs as six independent deployable units (content, manager-service, manager-web, front-web, search-service, sso-service).
- Uses: Spring, SpringMVC, MyBatis, Dubbo, ZooKeeper, MySQL/Mycat, Redis, Elasticsearch, ActiveMQ, Shiro, Swagger2, Docker, Nginx, third-party SDKs (Qiniu, weather API).
- Describes service responsibilities: content/banner management, user/permission management, order processing, search indexing, SSO.

##### Detail without overcomplicating
- Six services, two web modules, shared libraries, and infrastructure
- Cross-cutting concerns (common module) only if it clarifies reuse
- Keep labels concise; group similar services if needed

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    subgraph "Client Tier"
        Vue["Vue.js Frontend"]:::frontend
        AdminUI["Manager UI (H-UI)"]:::frontend
    end

    %% API Gateway
    Nginx["Nginx (API Gateway/Load Balancer)"]:::infra

    %% Web Tier
    subgraph "Web Tier"
        FrontWeb["xmall-front-web (SpringMVC)"]:::web
        ManagerWeb["xmall-manager-web (SpringMVC)"]:::web
    end

    %% Service Tier
    subgraph "Service Tier"
        ZK["ZooKeeper (Service Registry)"]:::infra

        subgraph "Content Service"
            CS_IF["Content Service Interface"]:::service
            CS_Impl["Content Service Implementation"]:::service
        end

        subgraph "Manager Service"
            MS_IF["Manager Service Interface"]:::service
            MS_DAO["Manager Service DAO"]:::service
            MS_POJO["Manager Service POJO"]:::service
            MS_Impl["Manager Service Implementation"]:::service
        end

        subgraph "Search Service"
            SS_IF["Search Service Interface"]:::service
            SS_Impl["Search Service Implementation"]:::service
        end

        subgraph "SSO Service"
            SSO_IF["SSO Service Interface"]:::service
            SSO_Impl["SSO Service Implementation"]:::service
        end

        Generator["SQLMap Generator Tool"]:::service
        Common["xmall-common (Shared Lib)"]:::service
        ParentPOM["xmall-parent POM"]:::service
        DubboXSD["Dubbo Schema (xmall/dubbo.xsd)"]:::service
        SQLScript["SQL Script (xmall/xmall.sql)"]:::service
    end

    %% Infrastructure
    subgraph "Infrastructure"
        MQ["ActiveMQ"]:::infra
        MySQL["MySQL/Mycat"]:::infra
        Redis["Redis"]:::infra
        ES["Elasticsearch"]:::infra
        Qiniu["Qiniu Storage"]:::infra
        WeatherAPI["Weather API"]:::infra
    end

    %% Connections
    Vue --> Nginx
    AdminUI --> Nginx

    Nginx --> FrontWeb
    Nginx --> ManagerWeb

    FrontWeb --> ZK
    ManagerWeb --> ZK

    FrontWeb -->|"Dubbo Call"| CS_IF
    FrontWeb -->|"Dubbo Call"| SS_IF
    FrontWeb -->|"Dubbo Call"| SSO_IF
    FrontWeb -->|"Dubbo Call"| MS_IF

    ManagerWeb -->|"Dubbo Call"| CS_IF
    ManagerWeb -->|"Dubbo Call"| SS_IF
    ManagerWeb -->|"Dubbo Call"| SSO_IF
    ManagerWeb -->|"Dubbo Call"| MS_IF

    CS_IF --> ZK
    MS_IF --> ZK
    SS_IF --> ZK
    SSO_IF --> ZK

    CS_Impl --> MySQL
    MS_Impl --> MS_DAO
    MS_DAO --> MySQL
    SSO_Impl --> MySQL

    CS_Impl --> Redis
    MS_Impl --> Redis
    SSO_Impl --> Redis

    MS_Impl -->|"publishes events"| MQ
    CS_Impl -->|"publishes events"| MQ
    MQ -.->|"index events"| SS_Impl

    SS_Impl --> ES

    CS_Impl --> Qiniu
    SSO_Impl --> WeatherAPI

    %% Artifacts (no arrows)
    ParentPOM
    Generator
    Common
    DubboXSD
    SQLScript

    %% Click Events
    click ParentPOM "https://github.com/exrick/xmall/blob/master/xmall-parent/pom.xml"
    click Generator "https://github.com/exrick/xmall/tree/master/generatorSqlmapCustom/"
    click Common "https://github.com/exrick/xmall/tree/master/xmall-common/"
    click CS_IF "https://github.com/exrick/xmall/blob/master/xmall-content/xmall-content-interface/src/main/java/cn/exrick/content/service/ContentService.java"
    click CS_IF "https://github.com/exrick/xmall/blob/master/xmall-content/xmall-content-interface/src/main/java/cn/exrick/content/service/PanelService.java"
    click CS_Impl "https://github.com/exrick/xmall/tree/master/xmall-content/xmall-content-service/"
    click FrontWeb "https://github.com/exrick/xmall/tree/master/xmall-front-web/"
    click ManagerWeb "https://github.com/exrick/xmall/tree/master/xmall-manager-web/"
    click MS_IF "https://github.com/exrick/xmall/tree/master/xmall-manager/xmall-manager-interface/"
    click MS_DAO "https://github.com/exrick/xmall/tree/master/xmall-manager/xmall-manager-dao/"
    click MS_POJO "https://github.com/exrick/xmall/tree/master/xmall-manager/xmall-manager-pojo/"
    click MS_Impl "https://github.com/exrick/xmall/tree/master/xmall-manager/xmall-manager-service/"
    click SS_IF "https://github.com/exrick/xmall/tree/master/xmall-search/xmall-search-interface/"
    click SS_Impl "https://github.com/exrick/xmall/tree/master/xmall-search/xmall-search-service/"
    click SSO_IF "https://github.com/exrick/xmall/tree/master/xmall-sso/xmall-sso-interface/"
    click SSO_Impl "https://github.com/exrick/xmall/tree/master/xmall-sso/xmall-sso-service/"
    click DubboXSD "https://github.com/exrick/xmall/blob/master/xmall/dubbo.xsd"
    click SQLScript "https://github.com/exrick/xmall/blob/master/xmall/xmall.sql"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef web fill:#90EE90,stroke:#333,stroke-width:1px
    classDef service fill:#FFA500,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px
```
