How coderayzhang/e3mall works
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-service Manager Core · e3-common Common Lib · e3-search-service Search Core · e3-content-service Content Core
Components 20
Clients
Human-facing entry points and browsers.
- Browser · End-user and admin browser access.
Web frontends
SpringMVC edge apps for storefront, admin, and user flows.
- Portal · Homepage and storefront entry point.
e3-portal-web - Manager UI · Back-office UI for catalog, content, and media management.
e3-manager-web - Item Pages · Item detail rendering and static page generation flow.
e3-item-web - Search UI · Search results UI and user-facing error handling.
e3-search-web - Cart UI · Shopping cart endpoints and login-gated cart actions.
e3-cart-web - Order UI · Checkout and order submission entry point.
e3-order-web - SSO UI · Login, registration, and token endpoints.
e3-sso-web
Service modules
Business logic and persistence-backed backend services.
- Manager Core · Item and category management with MyBatis, Redis, and MQ integration.
e3-manager/e3-manager-service - Content Core · Content category and content management with Redis cache.
e3-content/e3-content-service - Search Core · Solr-backed item indexing and query service.
e3-search/e3-search-service - Cart Core · Per-user cart state and cart operations.
e3-cart/e3-cart-service - Order Core · Order creation and persistence logic.
e3-order/e3-order-service - SSO Core · Credential validation and token/session management.
e3-sso/e3-sso-service
Shared foundation
Common DTOs and utilities used across modules.
- Common Lib · Redis/Jedis helpers, FastDFS client, JSON/cookie utilities, and shared payloads.
e3-common
Infrastructure
External systems and datastores shaping runtime behavior.
- MySQL · Relational persistence for core business tables.
- Redis Cluster · Caching plus shared session/cart-like state.
- SolrCloud · Full-text search index and query backend.
- ActiveMQ · Async propagation for product/index and derived-view updates.
- FastDFS · Shared image and file storage.
Connections 36
- 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.