# coderayzhang/e3mall architecture

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

- Interactive diagram: https://gitdiagram.com/coderayzhang/e3mall
- Repository: https://github.com/coderayzhang/e3mall

## Overview

1. This is a multi-module Maven monorepo for a distributed B2C e-commerce platform (“宜立方商城”). The system is split into multiple deployable web apps and backend services rather than a single application.

2. The main architectural pattern is: browser-facing SpringMVC web modules on the edge, and service modules behind them that encapsulate business logic, persistence, cache, and async integration. The README says subsystems communicate by service calls over HTTP/JSON to reduce coupling.

3. Shared infrastructure lives in `e3-common`. It contains cross-cutting utilities and DTOs used by many modules: Redis/Jedis clients, FastDFS client, cookie helpers, JSON helpers, ID generation, and common result/grid/tree/search payload classes. This is the main shared dependency boundary.

4. The `e3-manager` area is the backend admin domain. It is split into DAO, interface, pojo, and service modules. The DAO module holds MyBatis mappers for core tables such as items, categories, content, orders, and users. The service module implements item/category management and is configured with MyBatis, Redis, and ActiveMQ.

5. `e3-manager-web` is the admin UI. Its controllers handle item/category/content/search/admin navigation pages, while the JSPs and EasyUI assets render management screens. This web app is the primary producer of catalog/content changes into the backend systems.

6. Catalog and content publishing are separate business capabilities. `e3-content` has interface and service modules for content category and content management, backed by MyBatis and Redis. Admin content pages likely write into this service, and portal pages consume the resulting content for homepage and promotional areas.

7. Product browsing is split across item and portal modules. `e3-item-web` renders item detail pages and includes a FreeMarker-based static page generation flow; it also has an HTML generation listener and an `out/` directory, indicating pre-rendered item pages. `e3-portal-web` is the storefront homepage and entry point for browsing, login links, and featured content.

8. Search is isolated in `e3-search`. The search service contains a Solr-backed search implementation plus an `ItemAddMessageListener`, showing that product additions are propagated asynchronously via ActiveMQ into the search index. `e3-search-web` exposes the search UI and has a global exception resolver for user-facing error handling.

9. Authentication is centralized in `e3-sso`. The SSO web app exposes login, registration, and token endpoints; the SSO service layer handles credential validation and token/session management. Redis is part of this subsystem, which matches the README’s note that Redis is used for shared session state across apps.

10. Cart and order are separate user-flow systems. `e3-cart-web` and `e3-order-web` both have login interceptors, showing they rely on SSO/session state before allowing checkout actions. The cart service likely stores per-user cart state in Redis, while the order service persists order data through MyBatis and the order tables in the shared schema.

11. Asynchronous integration is important in two places: ActiveMQ for product synchronization into search, and HTML/page generation listeners in the item module. This means data changes are not purely synchronous; some derived views and indexes are updated by background consumers.

12. External systems materially shaping the architecture are MySQL, Redis Cluster, SolrCloud, ActiveMQ, and FastDFS. MySQL is the system of record; Redis is used for cache and shared session/cart-like state; SolrCloud powers search; ActiveMQ decouples product update propagation; FastDFS is the image/file store. The README also mentions Dubbo and MyCAT as part of the broader architecture, but the code tree here is primarily organized around SpringMVC + MyBatis + Redis + Solr + MQ.

13. The UI stack is classic server-rendered Java web apps: JSP pages for most modules, with FreeMarker used in the item module for static/dynamic detail-page generation. Frontend assets are bundled per module, so each web app owns its own presentation layer and web.xml/SpringMVC configuration.

14. For an architecture diagram, the clearest boundaries are: browser clients; web frontends (`portal`, `manager`, `item`, `search`, `cart`, `order`, `sso`); shared service/back-end modules (`manager`, `content`, `search`, `order`, `cart`, `sso` service layers); and shared infrastructure (`MySQL`, `Redis`, `SolrCloud`, `ActiveMQ`, `FastDFS`). The key flows are admin-driven content/item changes, async index synchronization, storefront browsing/search, SSO login/token flow, and cart-to-order checkout.

Main entry points: [`e3-manager/e3-manager-service`](https://github.com/coderayzhang/e3mall/tree/master/e3-manager/e3-manager-service) (Manager Core), [`e3-common`](https://github.com/coderayzhang/e3mall/tree/master/e3-common) (Common Lib), [`e3-search/e3-search-service`](https://github.com/coderayzhang/e3mall/tree/master/e3-search/e3-search-service) (Search Core), [`e3-content/e3-content-service`](https://github.com/coderayzhang/e3mall/tree/master/e3-content/e3-content-service) (Content Core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_browser(("Browser<br/>client"))
end

subgraph group_web["Web frontends"]
  node_portal_web["Portal<br/>storefront web"]
  node_manager_web["Manager UI<br/>admin web"]
  node_item_web["Item Pages<br/>product web"]
  node_search_web["Search UI<br/>search web"]
  node_cart_web["Cart UI<br/>cart web"]
  node_order_web["Order UI<br/>checkout web"]
  node_sso_web["SSO UI<br/>auth web"]
end

subgraph group_services["Service modules"]
  node_manager_service["Manager Core<br/>catalog service"]
  node_content_service["Content Core<br/>content service"]
  node_search_service["Search Core<br/>solr search"]
  node_cart_service["Cart Core<br/>cart service"]
  node_order_service["Order Core<br/>order service"]
  node_sso_service["SSO Core<br/>auth service"]
end

subgraph group_shared["Shared foundation"]
  node_e3_common["Common Lib<br/>shared utils/DTOs"]
end

subgraph group_infra["Infrastructure"]
  node_mysql[("MySQL<br/>system of record")]
  node_redis[("Redis Cluster<br/>cache/session store")]
  node_solr[("SolrCloud<br/>search index")]
  node_activemq["ActiveMQ<br/>message broker"]
  node_fastdfs[("FastDFS<br/>file store")]
end

node_browser -->|"browse"| node_portal_web
node_browser -->|"search"| node_search_web
node_browser -->|"view item"| node_item_web
node_browser -->|"cart"| node_cart_web
node_browser -->|"checkout"| node_order_web
node_browser -->|"login"| node_sso_web
node_browser -->|"admin"| node_manager_web
node_portal_web -->|"home content"| node_content_service
node_manager_web -->|"manage catalog"| node_manager_service
node_manager_web -->|"manage content"| node_content_service
node_manager_web -->|"upload media"| node_fastdfs
node_item_web -->|"item data"| node_manager_service
node_item_web -.->|"page events"| node_activemq
node_search_web -->|"query"| node_search_service
node_manager_service -->|"persist"| node_mysql
node_manager_service -->|"cache"| node_redis
node_manager_service -.->|"publish changes"| node_activemq
node_content_service -->|"persist"| node_mysql
node_content_service -->|"cache"| node_redis
node_search_service -->|"index/query"| node_solr
node_search_service -->|"source data"| node_mysql
node_search_service -.->|"consume updates"| node_activemq
node_cart_web -->|"cart ops"| node_cart_service
node_cart_service -->|"store cart"| node_redis
node_order_web -->|"place order"| node_order_service
node_order_service -->|"persist"| node_mysql
node_order_service -->|"session/cart"| node_redis
node_sso_web -->|"auth ops"| node_sso_service
node_sso_service -->|"users"| node_mysql
node_sso_service -->|"tokens"| node_redis
node_manager_service -->|"use shared lib"| node_e3_common
node_content_service -->|"use shared lib"| node_e3_common
node_search_service -->|"use shared lib"| node_e3_common
node_cart_service -->|"use shared lib"| node_e3_common
node_order_service -->|"use shared lib"| node_e3_common
node_sso_service -->|"use shared lib"| node_e3_common

click node_portal_web "https://github.com/coderayzhang/e3mall/tree/master/e3-portal-web"
click node_manager_web "https://github.com/coderayzhang/e3mall/tree/master/e3-manager-web"
click node_item_web "https://github.com/coderayzhang/e3mall/tree/master/e3-item-web"
click node_search_web "https://github.com/coderayzhang/e3mall/tree/master/e3-search-web"
click node_cart_web "https://github.com/coderayzhang/e3mall/tree/master/e3-cart-web"
click node_order_web "https://github.com/coderayzhang/e3mall/tree/master/e3-order-web"
click node_sso_web "https://github.com/coderayzhang/e3mall/tree/master/e3-sso-web"
click node_manager_service "https://github.com/coderayzhang/e3mall/tree/master/e3-manager/e3-manager-service"
click node_content_service "https://github.com/coderayzhang/e3mall/tree/master/e3-content/e3-content-service"
click node_search_service "https://github.com/coderayzhang/e3mall/tree/master/e3-search/e3-search-service"
click node_cart_service "https://github.com/coderayzhang/e3mall/tree/master/e3-cart/e3-cart-service"
click node_order_service "https://github.com/coderayzhang/e3mall/tree/master/e3-order/e3-order-service"
click node_sso_service "https://github.com/coderayzhang/e3mall/tree/master/e3-sso/e3-sso-service"
click node_e3_common "https://github.com/coderayzhang/e3mall/tree/master/e3-common"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser toneBlue
class node_portal_web,node_manager_web,node_item_web,node_search_web,node_cart_web,node_order_web,node_sso_web toneAmber
class node_manager_service,node_content_service,node_search_service,node_cart_service,node_order_service,node_sso_service toneMint
class node_e3_common toneRose
class node_mysql,node_redis,node_solr,node_activemq,node_fastdfs toneIndigo
```

## Components

### Clients

Human-facing entry points and browsers.

- **Browser**: client · End-user and admin browser access.

### Web frontends

SpringMVC edge apps for storefront, admin, and user flows.

- [Portal](https://github.com/coderayzhang/e3mall/tree/master/e3-portal-web): storefront web · Homepage and storefront entry point. · `e3-portal-web`
- [Manager UI](https://github.com/coderayzhang/e3mall/tree/master/e3-manager-web): admin web · Back-office UI for catalog, content, and media management. · `e3-manager-web`
- [Item Pages](https://github.com/coderayzhang/e3mall/tree/master/e3-item-web): product web · Item detail rendering and static page generation flow. · `e3-item-web`
- [Search UI](https://github.com/coderayzhang/e3mall/tree/master/e3-search-web): search web · Search results UI and user-facing error handling. · `e3-search-web`
- [Cart UI](https://github.com/coderayzhang/e3mall/tree/master/e3-cart-web): cart web · Shopping cart endpoints and login-gated cart actions. · `e3-cart-web`
- [Order UI](https://github.com/coderayzhang/e3mall/tree/master/e3-order-web): checkout web · Checkout and order submission entry point. · `e3-order-web`
- [SSO UI](https://github.com/coderayzhang/e3mall/tree/master/e3-sso-web): auth web · Login, registration, and token endpoints. · `e3-sso-web`

### Service modules

Business logic and persistence-backed backend services.

- [Manager Core](https://github.com/coderayzhang/e3mall/tree/master/e3-manager/e3-manager-service): catalog service · Item and category management with MyBatis, Redis, and MQ integration. · `e3-manager/e3-manager-service`
- [Content Core](https://github.com/coderayzhang/e3mall/tree/master/e3-content/e3-content-service): content service · Content category and content management with Redis cache. · `e3-content/e3-content-service`
- [Search Core](https://github.com/coderayzhang/e3mall/tree/master/e3-search/e3-search-service): solr search · Solr-backed item indexing and query service. · `e3-search/e3-search-service`
- [Cart Core](https://github.com/coderayzhang/e3mall/tree/master/e3-cart/e3-cart-service): cart service · Per-user cart state and cart operations. · `e3-cart/e3-cart-service`
- [Order Core](https://github.com/coderayzhang/e3mall/tree/master/e3-order/e3-order-service): order service · Order creation and persistence logic. · `e3-order/e3-order-service`
- [SSO Core](https://github.com/coderayzhang/e3mall/tree/master/e3-sso/e3-sso-service): auth service · Credential validation and token/session management. · `e3-sso/e3-sso-service`

### Shared foundation

Common DTOs and utilities used across modules.

- [Common Lib](https://github.com/coderayzhang/e3mall/tree/master/e3-common): shared utils/DTOs · Redis/Jedis helpers, FastDFS client, JSON/cookie utilities, and shared payloads. · `e3-common`

### Infrastructure

External systems and datastores shaping runtime behavior.

- **MySQL**: system of record · Relational persistence for core business tables.
- **Redis Cluster**: cache/session store · Caching plus shared session/cart-like state.
- **SolrCloud**: search index · Full-text search index and query backend.
- **ActiveMQ**: message broker · Async propagation for product/index and derived-view updates.
- **FastDFS**: file store · Shared image and file storage.

## Connections

- Browser → Portal: browse · Storefront entry and homepage navigation.
- Browser → Search UI: search · User search interaction.
- Browser → Item Pages: view item · Product detail browsing.
- Browser → Cart UI: cart · Shopping cart interaction.
- Browser → Order UI: checkout · Order placement flow.
- Browser → SSO UI: login · Authentication and registration.
- Browser → Manager UI: admin · Back-office catalog/content management.
- Portal → Content Core: home content · Homepage and promotional content retrieval.
- Manager UI → Manager Core: manage catalog · Create and edit items, categories, and parameters.
- Manager UI → Content Core: manage content · Admin content publishing and category maintenance.
- Manager UI → FastDFS: upload media · Product and content image/file uploads.
- Item Pages → Manager Core: item data · Fetch item detail and catalog data.
- Item Pages → ActiveMQ: page events · Static page generation / update events.
- Search UI → Search Core: query · Search requests and result rendering.
- Manager Core → MySQL: persist · Catalog and management data storage.
- Manager Core → Redis Cluster: cache · Cache hot catalog/content data.
- Manager Core → ActiveMQ: publish changes · Emit item update messages for downstream consumers.
- Content Core → MySQL: persist · Content and category storage.
- Content Core → Redis Cluster: cache · Content cache boundary.
- Search Core → SolrCloud: index/query · Search indexing and retrieval.
- Search Core → MySQL: source data · Load item data for indexing.
- Search Core → ActiveMQ: consume updates · Consume item-add messages to refresh index.
- Cart UI → Cart Core: cart ops · Cart mutation and retrieval.
- Cart Core → Redis Cluster: store cart · User cart state in shared cache.
- Order UI → Order Core: place order · Checkout submission and order creation.
- Order Core → MySQL: persist · Order, order item, shipping, and user data.
- Order Core → Redis Cluster: session/cart · Uses shared session state and possibly cart context.
- SSO UI → SSO Core: auth ops · Login, registration, and token lookups.
- SSO Core → MySQL: users · User credential and account persistence.
- SSO Core → Redis Cluster: tokens · Shared token/session storage.
- Manager Core → Common Lib: use shared lib · Common DTOs and utilities.
- Content Core → Common Lib: use shared lib · Common DTOs and utilities.
- Search Core → Common Lib: use shared lib · Common DTOs and utilities.
- Cart Core → Common Lib: use shared lib · Common DTOs and utilities.
- Order Core → Common Lib: use shared lib · Common DTOs and utilities.
- SSO Core → Common Lib: use shared lib · Common DTOs and utilities.
