Skip to content

Commit 6a85d4b

Browse files
committed
docs: update reademe
1 parent 1c96742 commit 6a85d4b

14 files changed

+59
-33
lines changed

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,44 @@
1515

1616
</div>
1717

18-
**Sponge** is a powerful development framework that integrates `automatic code generation`, `Gin and GRPC`. Sponge has a rich set of code generation commands, and the generated different functional codes can be combined into a complete service (similar to how artificially broken sponge cells can automatically reassemble into a new complete sponge). Sponge provides one-stop project development (code generation, development, testing, api documentation, deployment), it greatly improves development efficiency and reduces development difficulty, develop high-quality projects with a "low code approach".
18+
**Sponge** is a powerful development framework that integrates `code generation`, `Gin`, and `gRPC`. It offers a rich set of code generation commands, allowing flexible creation of various functional modules that can be combined into complete services (similar to how scattered sponge cells can reorganize into a new sponge). Sponge provides an all-in-one solution for project development, covering code generation, development, testing, API documentation, and deployment, significantly enhancing development efficiency, reducing complexity, and enabling high-quality projects with a "low-code approach".
1919

2020
Sponge is used to quickly and efficiently develop high-performance back-end services for various application scenarios and requirements, including `web` services, `gRPC` services, `http+gRPC` hybrid services, `gRPC gateway API` services.
2121

22+
Sponge not only supports code generation based on Sponge's built-in templates but also allows generating code using custom templates and relevant parameters (e.g., JSON, SQL, Protobuf). Through custom templates, users can generate code required for various projects, without being limited to the Go language.
23+
2224
<br>
2325

2426
### Sponge Core Design Philosophy
2527

26-
Sponge's core design concept is to reversely generate modular code through `SQL` or `Protobuf` files. These codes can be flexibly and seamlessly combined into various types of backend services, thus greatly improving development efficiency and simplifying backend service development. Sponge's main goals are as follows:
28+
Sponge's core design concept is to reversely generate modular code through `SQL` or `Protobuf` files. These codes can be flexibly and seamlessly combined into various types of backend services, thus greatly improving development efficiency and simplifying backend service development. Sponge has implemented three core functions:
2729

28-
- If you develop a web or gRPC service with only CRUD API, you don't need to write any go code to compile and deploy it to Linux servers, dockers, k8s, and you just need to connect to the database to automatically generate the complete backend service go code by sponge.
29-
- If you develop general web, gRPC, http+gRPC, gRPC gateway services, you only need to focus on the three core parts of `define tables in the database`, `define API description information in the protobuf file`, and `fill in business logic code in the generated template file`, and other go codes (including CRUD api) are generated by sponge.
30+
- If you develop a web or gRPC service with only CRUD API, you don't need to write any go code to compile and deploy it to Linux servers, dockers, k8s, and you just need to connect to the database (e.g., `mysql`, `mongodb`,`postgresql`,`sqlite`) to automatically generate the complete backend service go code by sponge.
31+
- If you develop general web, gRPC, http+gRPC, gRPC gateway services, you only need to focus on the three parts of `define tables in the database`, `define API description information in the protobuf file`, and `fill in business logic code in the generated template file`, and other go codes (including CRUD api) are generated by sponge.
32+
- Sponge generates the necessary code for various projects through custom templates and parameters, such as frontend code, backend code, test code, deployment scripts, etc.
3033

3134
<br>
3235

3336
### Sponge Generates the Code Framework
3437

35-
Sponge generation code is mainly based on `SQL` and `Protobuf` files, where `SQL` supports database **mysql** , **mongodb**, **postgresql**, **tidb**, **sqlite**.
36-
3738
#### Generate Code Framework
3839

40+
The code generation framework based on Sponge's built-in templates is shown below. There are two approaches: SQL and Protobuf.
41+
3942
<p align="center">
4043
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-framework.png">
4144
</p>
4245

4346
<br>
4447

48+
The code generation framework based on custom templates is shown below. There are three approaches: JSON, SQL, and Protobuf.
49+
50+
<p align="center">
51+
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/template-framework.png">
52+
</p>
53+
54+
<br>
55+
4556
#### Generate Code Framework Corresponding UI Interface
4657

4758
<p align="center">
@@ -52,7 +63,7 @@ Sponge generation code is mainly based on `SQL` and `Protobuf` files, where `SQL
5263

5364
### Microservice framework
5465

55-
Sponge is also a microservices framework, the framework diagram is shown below, which is a typical microservice hierarchical structure, with high performance, high scalability, contains commonly used service governance features, you can easily replace or add their own service governance features.
66+
The service code generated by sponge is itself a microservice, the framework diagram is shown below, which is a typical microservice hierarchical structure, with high performance, high scalability, contains commonly used service governance features, you can easily replace or add their own service governance features.
5667

5768
<p align="center">
5869
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
@@ -75,7 +86,6 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
7586
- Web framework [gin](https://github.com/gin-gonic/gin)
7687
- RPC framework [grpc](https://github.com/grpc/grpc-go)
7788
- Configuration parsing [viper](https://github.com/spf13/viper)
78-
- Configuration center [nacos](https://github.com/alibaba/nacos)
7989
- Logging component [zap](https://github.com/uber-go/zap)
8090
- Database ORM component [gorm](https://github.com/go-gorm/gorm), [mongo-go-driver](https://github.com/mongodb/mongo-go-driver)
8191
- Cache component [go-redis](https://github.com/go-redis/redis), [ristretto](https://github.com/dgraph-io/ristretto)
@@ -94,9 +104,11 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
94104
- Service registration and discovery [etcd](https://github.com/etcd-io/etcd), [consul](https://github.com/hashicorp/consul), [nacos](https://github.com/alibaba/nacos)
95105
- Adaptive collecting [profile](https://go.dev/blog/pprof)
96106
- Resource statistics [gopsutil](https://github.com/shirou/gopsutil)
107+
- Configuration center [nacos](https://github.com/alibaba/nacos)
97108
- Code quality checking [golangci-lint](https://github.com/golangci/golangci-lint)
98109
- Continuous integration and deployment [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
99110
- Generate project business architecture diagram [spograph](https://github.com/zhufuyi/spograph)
111+
- Custom template generation code [go template](https://pkg.go.dev/text/template@go1.23.3)
100112

101113
<br>
102114

@@ -118,6 +130,7 @@ Here is the directory structure for the generated `monolithic application single
118130
│ ├── cache # Cache directory wrapped around business logic.
119131
│ ├── config # Directory for Go structure configuration files.
120132
│ ├── dao # Data access directory.
133+
│ ├── database # database directory.
121134
│ ├── ecode # Directory for system error codes and custom business error codes.
122135
│ ├── handler # Directory for implementing HTTP business functionality (specific to web services).
123136
│ ├── model # Database model directory.
@@ -179,7 +192,7 @@ Access `http://localhost:24631` in a local browser and manipulate the generated
179192

180193
### Sponge Development Documentation
181194

182-
Detailed step-by-step, configuration, deployment instructions for developing projects using sponge, Click here to view the [sponge development documentation](https://go-sponge.com/)
195+
Click to view [the detailed documentation](https://go-sponge.com/) for Sponge development project, including code generation, development, configuration, and deployment instructions, and more.
183196

184197
<br>
185198

assets/en_sponge-ui.png

11.8 KB
Loading

assets/readme-cn.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,42 @@
22

33
<br>
44

5-
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。sponge提供了一站式项目开发(生成代码、开发、测试、api文档、部署),大幅提高了开发效率和降低了开发难度,以"低代码方式"开发高质量项目
5+
**sponge** 是一个集成了`代码生成``Gin``gRPC` 的强大开发框架,提供丰富的代码生成命令,可灵活生成各类功能模块,并组合成完整的服务(类似打散的海绵细胞能重新组合成新的海绵)。sponge 提供一站式项目开发解决方案,涵盖代码生成、开发、测试、API 文档生成和部署,大幅提升开发效率,降低开发难度,实现以"低代码"方式构建高质量项目
66

7-
sponge 用来快速高效开发各种应用场景和需求的高性能后端服务,包括 `web` 服务、`gRPC` 服务、`http+gRPC` 混合服务、 `gRPC网关API`服务等。
7+
sponge 用来快速开发各种应用场景和需求的高性能后端服务,包括 `web` 服务、`gRPC` 服务、`http+gRPC` 混合服务、 `gRPC网关API`服务等。
8+
9+
sponge 不仅支持基于自带模板生成代码,还支持基于自定义模板和相关参数(如 json、sql、protobuf)生成代码。通过自定义模板,可以生成各类项目所需的代码(不局限于 Go 语言)。
810

911
<br>
1012

1113
### sponge 核心设计理念
1214

13-
sponge 的核心设计理念是通过 `SQL``Protobuf` 文件逆向生成模块化的代码,这些代码可以灵活、无缝地组合成多种类型的后端服务,从而大大提升开发效率,简化后端服务开发,sponge 的主要目标如下
15+
sponge 的核心设计理念是通过 `SQL``Protobuf` 文件逆向生成模块化的代码,这些代码可以灵活、无缝地组合成多种类型的后端服务,从而大幅大提升开发效率,简化后端服务开发,sponge已实现了三大核心功能
1416

15-
- 如果开发只有 CRUD api 的 web 或 gRPC 服务,不需要编写任何 go 代码就可以编译并部署到 linux 服务器、docker、k8s 上,只需要连接到数据库就可以一键自动生成完整的后端服务 go 代码。
16-
- 如果开发通用的 web、gRPC、http+gRPC、gRPC 网关等服务,只需聚焦`在数据库定义表``在protobuf文件定义api描述信息``在生成的模板文件填写业务逻辑代码`三个核心部分,其他 go 代码(包括CRUD api)都由 sponge 来生成。
17+
- 如果开发只有 CRUD api 的 web 或 gRPC 服务,不需要编写任何 go 代码就可以编译并部署到 linux 服务器、docker、k8s 上,只需要连接到数据库(例如`mysql`, `mongodb`,`postgresql`,`sqlite`)就可以一键自动生成完整的后端服务 go 代码。
18+
- 如果开发通用的 web、gRPC、http+gRPC、gRPC 网关等服务,只需聚焦`在数据库定义表``在protobuf文件定义api描述信息``在生成的模板文件填写业务逻辑代码`这三部分,其他 go 代码(包括CRUD api)都由 sponge 来生成。
19+
- 通过自定义模板和参数生成各类项目所需的代码,例如前端代码、后端代码、测试代码、部署脚本等。
1720

1821
<br>
1922

2023
#### 生成代码的框架图
2124

22-
sponge 生成代码主要基于 `SQL``Protobuf`文件,其中 `SQL` 支持数据库 **mysql****mongodb****postgresql****tidb****sqlite**
25+
sponge 基于自带模板生成代码框架如下图所示,共有 sqlprotobuf 两种方式生成代码
2326

2427
<p align="center">
2528
<img width="1500px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/sponge-framework.png">
2629
</p>
2730

2831
<br>
2932

33+
sponge 基于自定义模板生成代码框架如下图所示,共有 json、sql、protobuf 三种方式生成代码。
34+
35+
<p align="center">
36+
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/template-framework.png">
37+
</p>
38+
39+
<br>
40+
3041
#### 生成代码框架对应的UI界面
3142

3243
<p align="center">
@@ -62,7 +73,6 @@ sponge包含丰富的组件(按需使用):
6273
- Web 框架 [gin](https://github.com/gin-gonic/gin)
6374
- RPC 框架 [grpc](https://github.com/grpc/grpc-go)
6475
- 配置解析 [viper](https://github.com/spf13/viper)
65-
- 配置中心 [nacos](https://github.com/alibaba/nacos)
6676
- 日志 [zap](https://github.com/uber-go/zap)
6777
- 数据库组件 [gorm](https://github.com/go-gorm/gorm), [mongo-go-driver](https://github.com/mongodb/mongo-go-driver)
6878
- 缓存组件 [go-redis](https://github.com/go-redis/redis), [ristretto](https://github.com/dgraph-io/ristretto)
@@ -81,9 +91,11 @@ sponge包含丰富的组件(按需使用):
8191
- 服务注册与发现 [etcd](https://github.com/etcd-io/etcd), [consul](https://github.com/hashicorp/consul), [nacos](https://github.com/alibaba/nacos)
8292
- 自适应采集 [profile](https://go.dev/blog/pprof)
8393
- 资源统计 [gopsutil](https://github.com/shirou/gopsutil)
94+
- 配置中心 [nacos](https://github.com/alibaba/nacos)
8495
- 代码质量检查 [golangci-lint](https://github.com/golangci/golangci-lint)
8596
- 持续集成部署 CICD [jenkins](https://github.com/jenkinsci/jenkins), [docker](https://www.docker.com/), [kubernetes](https://github.com/kubernetes/kubernetes)
8697
- 生成项目业务架构图 [spograph](https://github.com/zhufuyi/spograph)
98+
- 自定义模板生成代码 [go template](https://pkg.go.dev/text/template@go1.23.3)
8799

88100
<br>
89101

@@ -105,6 +117,7 @@ sponge包含丰富的组件(按需使用):
105117
│ ├── cache # 基于业务包装的缓存目录
106118
│ ├── config # Go结构的配置文件目录
107119
│ ├── dao # 数据访问目录
120+
│ ├── database # 数据库目录
108121
│ ├── ecode # 自定义业务错误代码目录
109122
│ ├── handler # http的业务功能实现目录
110123
│ ├── model # 数据库模型目录
@@ -146,7 +159,7 @@ sponge包含丰富的组件(按需使用):
146159

147160
### 快速开始
148161

149-
#### 安装sponge
162+
#### 安装 sponge
150163

151164
支持在windows、mac、linux环境下安装sponge,点击查看[安装sponge说明](https://github.com/zhufuyi/sponge/blob/main/assets/install-cn.md)
152165

@@ -164,15 +177,15 @@ sponge run
164177
165178
<br>
166179

167-
### sponge开发文档
180+
### sponge 开发文档
168181

169-
使用sponge开发项目的详细的步骤、配置、部署说明,点击查看[sponge开发文档](https://go-sponge.com/zh-cn/)
182+
点击查看 [sponge 开发项目的详细文档](https://go-sponge.com/zh-cn/),包括代码生成、开发、配置、部署说明等
170183

171184
<br>
172185

173186
### 使用示例
174187

175-
#### 使用sponge创建服务示例
188+
#### 使用 sponge 创建服务示例
176189

177190
- [基于sql创建web服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
178191
- [基于sql创建grpc服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
@@ -181,7 +194,7 @@ sponge run
181194
- [基于protobuf创建grpc网关服务](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
182195
- [基于protobuf创建grpc+http服务](https://github.com/zhufuyi/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
183196

184-
#### 使用sponge开发完整项目示例
197+
#### 使用 sponge 开发完整项目示例
185198

186199
- [简单的社区web后端服务](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
187200
- [简单的社区web后端服务拆分为微服务](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)

assets/sponge-ui.png

-29.8 KB
Loading

assets/template-framework.png

60.4 KB
Loading

cmd/sponge/server/static/css/app.d86d99ed9313579ae97df6cbaf372030.css renamed to cmd/sponge/server/static/css/app.2fadb537257f44b2192f8ffe1ce19370.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/sponge/server/static/css/app.d86d99ed9313579ae97df6cbaf372030.css.map renamed to cmd/sponge/server/static/css/app.2fadb537257f44b2192f8ffe1ce19370.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/sponge/server/static/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Sponge Generate Code</title><link rel=icon type=image/png sizes=32x32 href="/static/favicon.png?v=1.0"><script type=text/javascript src=/static/appConfig.js async></script><link href=/static/css/app.d86d99ed9313579ae97df6cbaf372030.css rel=stylesheet></head><body style="margin: 0px; padding: 0px;"><style>.el-tooltip__popper {box-shadow: 3px 3px 10px 5px #d3d3d6;border-width: 0px !important;}
2-
.el-tooltip__popper[x-placement^="top"] .popper__arrow:after {border-top-color: #dcdfe6 !important;}</style><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.d8cdb3748af43d2ae51a.js></script><script type=text/javascript src=/static/js/app.eb5d32169a92e7e955d4.js></script></body></html>
1+
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Sponge Generate Code</title><link rel=icon type=image/png sizes=32x32 href="/static/favicon.png?v=1.0"><script type=text/javascript src=/static/appConfig.js async></script><link href=/static/css/app.2fadb537257f44b2192f8ffe1ce19370.css rel=stylesheet></head><body style="margin: 0px; padding: 0px;"><style>.el-tooltip__popper {box-shadow: 3px 3px 10px 5px #d3d3d6;border-width: 0px !important;}
2+
.el-tooltip__popper[x-placement^="top"] .popper__arrow:after {border-top-color: #dcdfe6 !important;}</style><div id=app></div><script type=text/javascript src=/static/js/manifest.2ae2e69a05c33dfc65f8.js></script><script type=text/javascript src=/static/js/vendor.d8cdb3748af43d2ae51a.js></script><script type=text/javascript src=/static/js/app.673ef5316b942a28ecac.js></script></body></html>

cmd/sponge/server/static/js/app.eb5d32169a92e7e955d4.js renamed to cmd/sponge/server/static/js/app.673ef5316b942a28ecac.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/sponge/server/static/js/app.673ef5316b942a28ecac.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)