46 Star 4.5K Fork 267

nageoffer / congomall

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

🎉 刚果商城,不一样的C端商城系统


官网地址:magestack.cn

体验地址:cmall.magestack.cn

刚果商城是个从零到一的C端商城项目,包含商城核心业务和基础架构两大模块。

参照商城系统原型,推出用户、消息、商品、订单、优惠券、支付、网关、购物车等业务模块,通过商城系统中复杂场景,给出对应解决方案。使用 DDD 模型开发系统功能,帮助对 DDD 一知半解的开发者树立正确地开发思路。

如果对开源感兴趣,可以关注马哥的中间件项目:动态线程池框架 Hippo4j。6.2kStar,43家企业使用。

有几位同学参与 Hippo4j 的贡献后,将这段经历写到了简历上,都拿了不错的大厂offer。

📚 能学到什么


刚果商城系统是我从事开发以来,在实际工作中遇到各种场景问题的“疑难杂症”汇总。

这些问题有些是自己遇到的,有些是其他人遇到帮忙解决的,最终把解决方案和代码实战放在刚果商城这个系统里。

这个系统没有很完整的商城业务,但是提供了偏架构层面有用的工具和参考,能帮助大家在实际项目中更好地解决问题。

如果你能够认真且坚持把项目看完,我相信你会收获包括不限于下面这些知识点:

  • 基于 DDD 领域驱动模型设计实现的商品、购物车、订单、用户、消息以及支付服务。

  • 掌握分布式锁、分布式事务、分布式搜索、分布式缓存、分布式限流以及分库分表等核心技术。

  • 完成基础组件抽象,规约、缓存、幂等、分布式 ID、数据持久层、脱敏以及日志等底层组件库。

  • 基于 Agent 开发字节码流量监控,监控项目接口 QPS、响应时间和异常请求等核心指标。

  • 掌握常用设计模式实战场景,策略、责任链、装饰器、观察者以及适配器等设计模式。

🛒 大话面试


屏幕前的你是否遇到过网上面经杂乱,不知道如何筛选?八股文内容太多太杂,无法总结有效回答 Battle 面试官?

大话面试小程序提供八股回答、实战项目以及面试真题,助力你在面试中脱颖而出。面对任何面试官都信心十足!

🤩 联系我


开源不易,右上角点个 Star 鼓励一下吧!

如果大家想要实时关注 CongoMall 更新的文章以及分享的干货的话,可以关注我的公众号。

使用过程中有任何问题,或者对项目有什么建议,关注公众号回复:加群,和 1000+ 志同道合的朋友交流讨论。

image

🔨 如何开始


刚果商城核心有两块,分别是商城业务和基础架构,通过认真学习分别可以收获以下两种能力提升。

  • 商城业务:通过学习刚果商城中复杂业务处理场景,增加自己的复杂业务处理能力。

  • 基础架构:尝试跟着基础架构部分自己把轮子都造一遍,以此提高自己方案设计和公共代码开发能力。

1)商城核心业务

目前 前端页面 正在开发中,暂时没有开源出来,所以大家需要通过接口请求访问。接口如何访问详细看下文。

  1. 初始化数据库,比如商品库、订单库、用户库、支付库、购物车库等;
  2. 通过 Docker 安装项目中依赖的中间件,比如 Nacos2、MySQL、Seata、RocketMQ 等;
  3. 学习接口调用流程,项目接口目前全量放入 Apifox 软件中,可通过在线访问;
  4. 查看不同微服务之间的依赖关系,并根据文档中的描述进行修改指定参数;
  5. 找到自己感兴趣的模块功能 Debug 源代码,参考代码设计。
image

2)基础架构

基础架构相关的代码都在 congomall-framework-all 模块中,可以通过官网查看如何实现,或者通过 视频教学 来学习如何开发基础架构代码。

image

👍 服务列表


刚果商城项目是马哥从零到一写出来的,当前已开发模块如下所述,没有完成的请耐心等待。

模块名称 服务名称 访问地址
1 congomall-message 消息发送 eg:邮件、公众号、短信等 http://localhost:8001
2 congomall-customer-user 用户服务 http://localhost:8002
3 congomall-gateway 外部网关 http://localhost:8003
4 congomall-product 商品服务 http://localhost:8004
5 congomall-product-job 商品 Job 服务 http://localhost:9001
6 congomall-cart 购物车服务 http://localhost:8005
7 congomall-order 订单服务 http://localhost:8006
8 congomall-pay 支付服务 http://localhost:8007
9 congomall-basic-data 基础数据服务 http://localhost:8008
10 congomall-bff 商城聚合层(BFF) http://localhost:8009

🚅 接口请求


目前刚果商城已开发的接口已汇总至下述接口文档中,本地启动对应项目,通过接口文档访问查看效果。

https://www.apifox.cn/web/project/1038592/apis/api-50106328-run

如果需要通过 Apifox 直接调用,需要安装对应浏览器内网插件,这里把插件安装包装上,跟着教程安装即可使用。

安装文档:https://www.apifox.cn/help/app/web/browser-extension

🛡 模块介绍


刚果商城后端系统模块介绍如下所示。

├── congomall-basic-data  || -- # 基础数据服务
│   ├── congomall-basic-data-application
│   ├── congomall-basic-data-domain
│   ├── congomall-basic-data-infrastructure
│   ├── congomall-basic-data-interface
├── congomall-bff  || -- # 商城 BFF 聚合层
│   ├── congomall-bff-biz
│   ├── congomall-bff-remote
│   ├── congomall-bff-web
├── congomall-cart  || -- # 购物车服务
│   ├── congomall-cart-application
│   ├── congomall-cart-domain
│   ├── congomall-cart-infrastructure
│   ├── congomall-cart-interface
├── congomall-coupon  || -- # 优惠券服务
├── congomall-customer-user  || -- # C端用户服务
│   ├── congomall-customer-user-application
│   ├── congomall-customer-user-domain
│   ├── congomall-customer-user-infrastructure
│   ├── congomall-customer-user-interface
│   ├── congomall-customer-user-mock
├── congomall-framework-all  || -- # 基础组件
│   ├── congomall-base-spring-boot-starter  || -- # 顶层抽象基础组件
│   ├── congomall-cache-spring-boot-starter  || -- # 缓存组件
│   ├── congomall-common-spring-boot-starter  || -- # 公共工具包组件
│   ├── congomall-convention-spring-boot-starter  || -- # 项目规约组件
│   ├── congomall-database-spring-boot-starter  || -- # 数据库持久层组件
│   ├── congomall-ddd-framework-core  || -- # DDD抽象接口组件
│   ├── congomall-designpattern-spring-boot-starter  || -- # 设计模式抽象组件
│   ├── congomall-distributedid-spring-boot-starter  || -- # 分布式ID组件
│   ├── congomall-flow-monitor-agent  || -- # 微服务流量监控组件
│   ├── congomall-httputil-spring-boot-starter  || -- # Http网络调用组件
│   ├── congomall-idempotent-spring-boot-starter  || -- # 分布式幂等组件
│   ├── congomall-log-spring-boot-starter  || -- # 日志打印组件
│   ├── congomall-minio-spring-boot-starter  || -- # 文件存储组件
│   ├── congomall-openfeign-spring-boot-starter  || -- # 微服务调用组件
│   ├── congomall-rocketmq-spring-boot-starter  || -- # 分布式消息队列组件
│   ├── congomall-sensitive-spring-boot-starter  || -- # 前端返回数据脱敏组件
│   ├── congomall-swagger-spring-boot-starter  || -- # 文档API组件
│   ├── congomall-web-spring-boot-starter  || -- # Web组件
│   ├── congomall-xxljob-spring-boot-starter  || -- # 定时任务组件
├── congomall-gateway  || -- # 网关服务
├── congomall-message  || -- # 消息服务
│   ├── congomall-message-application
│   ├── congomall-message-domain
│   ├── congomall-message-infrastructure
│   ├── congomall-message-interface
├── congomall-order  || -- # 订单服务
│   ├── congomall-order-application
│   ├── congomall-order-domain
│   ├── congomall-order-infrastructure
│   ├── congomall-order-interface
├── congomall-pay  || -- # 支付服务
│   ├── congomall-pay-application
│   ├── congomall-pay-domain
│   ├── congomall-pay-infrastructure
│   ├── congomall-pay-interface
├── congomall-product  || -- # 商品服务
│   ├── congomall-product-application
│   ├── congomall-product-domain
│   ├── congomall-product-infrastructure
│   ├── congomall-product-interface
│   ├── congomall-product-job
├── congomall-test-all  || -- # 测试用例
│   ├── congomall-flow-monitor-agent-test
│   ├── congomall-h2-test
│   ├── congomall-oom-test
│   ├── congomall-smooth-sharding-test
│   ├── congomall-yaml-test
├── dev-support  || -- # 开发工具包

📈 技术选型


当前暂时先梳理后端技术,前端开发后再行梳理。

技术 名称 官网
1 Spring Boot 基础框架 https://spring.io/projects/spring-boot
2 MyBatis-Plus 持久层框架 https://baomidou.com
3 HikariCP 数据库连接池 https://github.com/brettwooldridge/HikariCP
4 Redis 分布式缓存数据库 https://redis.io
5 RocketMQ 消息队列 https://rocketmq.apache.org
6 ShardingSphere 数据库生态系统 https://shardingsphere.apache.org
7 SpringCloud Alibaba 分布式框架 https://github.com/alibaba/spring-cloud-alibaba
8 SpringCloud Gateway 网关框架 https://spring.io/projects/spring-cloud-gateway
9 Seata 分布式事务框架 http://seata.io/zh-cn/index.html
10 Canal MySQL 订阅 BinLog 组件 https://github.com/alibaba/canal
11 MinIO 文件存储框架 https://min.io
12 Swagger3 项目 API 文档框架 http://swagger.io
13 Knife4j Swagger 增强框架 https://doc.xiaominfo.com
14 Maven 项目构建管理 http://maven.apache.org
15 Redisson Redis Java 客户端 https://redisson.org
16 Sentinel 流控防护框架 https://github.com/alibaba/Sentinel
17 Hippo4j 动态线程池框架 https://hippo4j.cn
18 XXL-Job 分布式定时任务框架 http://www.xuxueli.com/xxl-job
19 SkyWalking 分布式链路追踪框架 https://skywalking.apache.org
20 JetCache Java 缓存框架 https://github.com/alibaba/jetcache
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

🔥🔥🔥 CongoMall(刚果商城)不一样的TOC商城系统,SpringCloud-Alibaba微服务架构设计,基于DDD领域驱动模型开发,代码设计优雅,涵盖商城核心业务。系统集成分布式锁、分布式事务、分库分表、消息队列、数据搜索、服务监控等功能,区别于八股文问答,真正企业级实战系统。 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/nageoffer/congomall.git
git@gitee.com:nageoffer/congomall.git
nageoffer
congomall
congomall
main

搜索帮助