# crmeb/crmeb_java architecture

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

- Interactive diagram: https://gitdiagram.com/crmeb/crmeb_java
- Repository: https://github.com/crmeb/crmeb_java

## Overview

##### Project Type and Purpose
- This is a full-stack, modular e-commerce platform (“CRMEB Java版”) comprising:
- A PC management console (“admin”) built with Vue + Element UI
- A mobile storefront (“app”) built with Uni-app (H5, WeChat mini-program, etc.)
- A Java backend split into multiple modules:
– crmeb-admin (admin REST API)
– crmeb-front (customer-facing REST API)
– crmeb-service (business-logic & data-access services)
– crmeb-common (shared models, utils, configs)
– crmeb-image (static image repo)
- Data storage: MySQL + Redis + external services (OSS/Qiniu, SMS provider, WeChat).
- Purpose: Provide a configurable, extensible online mall with features like orders, products, marketing (bargain, seckill, coupon), role-based security, report/export, and a drag-and-drop form generator.

##### File Structure Analysis
- Top-level directories:
- admin/ — Web admin front-end project
- app/ — Mobile storefront front-end project
- crmeb/ — Backend Maven multi-module: admin/front/service/common/image
- 接口文档/ — Generated Swagger API docs
- Backend modules follow layered MVC:
- controller → service → dao (MyBatis mappers) → database
- Shared code in crmeb-common (models, constants, utils, Redis config, token)
- crmeb-service holds business services and MyBatis XML mappers under resources/mapper
- Config files & scripts: Spring Boot YAMLs, Maven POMs, shell start/stop scripts.

##### Key Insights from README
- Tech stack: Spring Boot 2.2.6, MyBatis-Plus, Redis, Vue2, ElementUI, Uni-app
- Clear separation: “admin” (PC), “app” (mobile), “crmeb” (API)
- Features: RESTful APIs, Redis queues, Spring Security with role/permission control, ECharts for analytics, drag-drop form generator.

a. Main Components
- Frontends:
- Admin UI (Vue+Element)
- Mobile UI (Uni-app)
- Backend Services:
- Admin API (crmeb-admin module)
- Front API (crmeb-front module)
- Business Layer:
- Service layer (crmeb-service)
- Data Access layer (MyBatis DAOs & mappers)
- Shared Module:
- Common models/configs (crmeb-common)
- Persistence:
- MySQL
- Redis (cache, queues, session, rate-limit)
- External Services:
- Object Storage (OSS/Qiniu)
- SMS gateway
- WeChat API (push messages, OAuth)
- Static Resources:
- crmeb-image repository
b. Relationships & Interactions
- Admin UI & Mobile UI → via HTTP(S) → Admin API & Front API
- APIs delegate to Service layer → DAOs → MySQL
- Services push tasks to Redis queues → background TaskExecutor
- Common utilities (authentication, JWT filter, CORS, Swagger) applied across API modules
- External calls for file uploads, SMS, payment, WeChat through REST templates
c. Architectural Patterns & Principles
- Layered MVC: Controllers → Services → DAOs
- Modularization: separate API for admin vs. front
- Shared library for cross-cutting concerns (crmeb-common)
- Asynchronous tasks (Spring @Scheduled & Redis queue)
- Role-based access control (Spring Security)
d. Key Technologies
- Java: Spring Boot, MyBatis-Plus, Redis, Maven
- Frontend: Vue2, Element UI, Uni-app
- Build/Deploy: NPM, Node, shell scripts
- Data: MySQL, Redis
- Cloud: OSS/Qiniu, WeChat SDK

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        AdminUI["Admin UI (Vue2 + Element)"]:::frontend
        MobileUI["Mobile UI (Uni-app)"]:::frontend
    end

    subgraph "API Layer"
        AdminAPI["Admin API Service\n(Spring Boot crmeb-admin)"]:::api
        FrontAPI["Front API Service\n(Spring Boot crmeb-front)"]:::api
    end

    subgraph "Business Layer"
        Service["Service Layer\n(crmeb-service)"]:::service
        DAOs["MyBatis DAOs & Mappers"]:::service
    end

    Common["Shared Common\n(crmeb-common)"]:::common

    subgraph "Data Stores"
        MySQL["MySQL Database"]:::db
        Redis["Redis\n(Cache & Queue)"]:::db
        ImageRepo["Static Image Repo\n(crmeb-image)"]:::db
    end

    subgraph "External Services"
        OSS["Object Storage\n(OSS/Qiniu)"]:::external
        SMS["SMS Gateway"]:::external
        WeChat["WeChat API"]:::external
    end

    %% Data Flows
    AdminUI -->|"REST API calls"| AdminAPI
    MobileUI -->|"REST API calls"| FrontAPI
    AdminAPI -->|"uses services"| Service
    FrontAPI -->|"uses services"| Service
    Service -->|"calls DAOs"| DAOs
    DAOs -->|"CRUD operations"| MySQL
    Service -->|"cache & queue"| Redis
    AdminAPI -->|"file upload"| OSS
    AdminAPI -->|"send SMS"| SMS
    AdminAPI -->|"WeChat integration"| WeChat
    FrontAPI -->|"file upload"| OSS
    FrontAPI -->|"send SMS"| SMS
    FrontAPI -->|"WeChat integration"| WeChat
    Common --> AdminAPI
    Common --> FrontAPI
    Common --> Service

    %% Click Events
    click AdminUI "https://github.com/crmeb/crmeb_java/tree/master/admin/"
    click MobileUI "https://github.com/crmeb/crmeb_java/tree/master/app/"
    click AdminAPI "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmeb-admin/src/main/java/com/zbkj/admin/"
    click FrontAPI "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmeb-front/src/main/java/com/zbkj/front/"
    click Service "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmeb-service/src/main/java/com/zbkj/service/"
    click DAOs "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmeb-service/src/main/resources/mapper/"
    click Common "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmeb-common/src/main/java/com/zbkj/common/"
    click ImageRepo "https://github.com/crmeb/crmeb_java/tree/master/crmeb/crmebimage/crmebimage/"
    click ParentPOM "https://github.com/crmeb/crmeb_java/blob/master/crmeb/pom.xml"
    click StartAdmin "https://github.com/crmeb/crmeb_java/blob/master/crmeb/shell/startAdmin.sh"
    click StartFront "https://github.com/crmeb/crmeb_java/blob/master/crmeb/shell/startFront.sh"
    click SwaggerAdmin "https://github.com/crmeb/crmeb_java/tree/master/接口文档/admin/"
    click SwaggerApp "https://github.com/crmeb/crmeb_java/tree/master/接口文档/app/"
    click SwaggerCommon "https://github.com/crmeb/crmeb_java/tree/master/接口文档/公共接口/"

    %% Styles
    classDef frontend fill:#DDEEFF,stroke:#000,stroke-width:1px
    classDef api fill:#DDFFDD,stroke:#000,stroke-width:1px
    classDef service fill:#F0F0F0,stroke:#000,stroke-width:1px
    classDef common fill:#CCCCCC,stroke:#000,stroke-width:1px
    classDef db fill:#FFDDAA,stroke:#000,stroke-width:1px
    classDef external fill:#EEDDFF,stroke:#000,stroke-width:1px
```
