Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhufuyi committed Mar 30, 2024
1 parent c5781b3 commit aa19227
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 89 deletions.
10 changes: 2 additions & 8 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
## Change log

- Code generation supports multiple types of code repositories, you can choose to use `monolithic application single repository (monolith)`, `microservice multi-repository (multi-repo)`, or `microservice single repository (mono-repo)` according to your project needs.
- Added automated testing scripts for code generation commands.
- Based on protobuf to generate web services, the generated template code and documentation must meet the following conditions:
- rpc cannot be set as stream type.
- rpc must set http related information (router and method).
- RPC stream based on protobuf supports generating corresponding template code and client testing code.
- The generated code based on protobuf supports some common special types, such as Empty, Any, Timestamp, etc.
- Fixed known bugs.
- Add generate grpc+http service code
- Add generate service+handler CRUD code
48 changes: 13 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

</div>

**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). From development, testing, API documentation to deployment, one-stop project development greatly improves development efficiency and reduces development difficulty, you can also use the go language to develop projects using the "low-code way".
**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). From development, testing, API documentation to deployment, one-stop project development greatly improves development efficiency and reduces development difficulty, implementation of "low-code way" development projects.

<br>

Expand All @@ -27,14 +27,6 @@ If you develop generic web or microservices, just focus on the three core parts

### Sponge Generates the Code Framework

Sponge generated service code supports two types of code repositories:

1. **Monolithic application single repository (monolith) or microservice multi-repository (multi-repo)**: Each service code has its own Git repository. Even if all services are placed in the same Git repository, the code between services cannot be reused. This is the default type generated.

2. **Microservice single repository (mono-repo)**: All services are in the same Git repository, and the code between different services can be reused.

<br>

Sponge is mainly based on `SQL` and `Protobuf` two ways to generate code, each way has to generate code for different functions. `SQL` supports databases **mysql**, **mongodb**, **postgresql**, **tidb**, **sqlite**.

#### Generate Code Framework
Expand All @@ -53,19 +45,7 @@ Sponge is mainly based on `SQL` and `Protobuf` two ways to generate code, each w

<br>

#### Generate Service Code for Egg Model

The sponge code generation process strips away the business logic and non-business logic of the two major parts of the code. The code generation function of Sponge can be seen as a hen, and the service code generated by sponge can be seen as eggs. Currently, it supports the generation of 5 common types of service code, Take the generated web service backend code as an example, egg model profiling diagram:

<p align="center">
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/en_web-http-pb-anatomy.png">
</p>

In addition to the egg model of web service backend code, there are egg models of grpc service code and grpc gateway service code, [click here to view](https://go-sponge.com/learn-about-sponge?id=%f0%9f%8f%b7egg-model-for-generate-service-code).

<br>

### Services framework
### Microservice framework

Sponge is essentially a microservice framework that includes code generation capabilities. The microservice framework is shown in the following figure, 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.

Expand Down Expand Up @@ -164,25 +144,23 @@ Detailed instructions for operating, configuring, and deploying a project using

### Examples of use

#### Simple examples

No specific business logic code is included.
#### Examples of creating a service using sponge

- [1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
- [2_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
- [3_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
- [4_micro-grpc-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
- [5_micro-gin-rpc-gateway](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
- [6_micro-cluster-demo](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
- [Create **web** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
- [Create **grpc** service based on **sql** (including CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
- [Create **web** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
- [Create **grpc** service based on **protobuf** ](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
- [Create **grpc gateway** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
- [Create **grpc+http** service based on **protobuf**](https://github.com/zhufuyi/sponge_examples/tree/main/a_micro-grpc-http-protobuf)

#### Complete project examples
#### Examples of developing a complete project using sponge

- [7_community-single](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
- [8_community-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)
- [Simple community web backend service](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)
- [Simple community web service broken down into microservice](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster)

#### Distributed transaction examples

- [9_order-system](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
- [Simple distributed order system](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)

<br>

Expand Down
Binary file modified assets/en_sponge-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 23 additions & 46 deletions assets/readme-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<br>

[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。从开发、测试、api文档到部署一站式项目开发,大幅提高了开发效率和降低了开发难度,使用go也可以使用"低代码方式"开发项目。
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``Gin和GRPC` 的强大的开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。从开发、测试、api文档到部署一站式项目开发,大幅提高了开发效率和降低了开发难度,实现"低代码方式"开发项目。

<br>

Expand All @@ -14,13 +14,6 @@

### 生成代码框架

sponge生成的服务代码支持两种类型代码仓库:

1. **单体应用单体仓库(monolith)或微服务多仓库(multi-repo)**:每个服务代码都有自己的git仓库,即使把所有服务放在同一个git仓库下,服务之间代码不可以复用,默认是生成这种类型。
2. **微服务单体仓库(mono-repo)**:所有服务都在同一个git仓库下,不同服务之间的代码可以复用,这种类型代码仓库也叫大仓库类型。

<br>

sponge主要基于`SQL``Protobuf`两种方式生成代码,每种方式拥有生成不同用途的代码。其中`SQL`支持数据库**mysql****mongodb****postgresql****tidb****sqlite**

#### 生成代码的框架图
Expand All @@ -39,21 +32,9 @@ sponge主要基于`SQL`和`Protobuf`两种方式生成代码,每种方式拥

<br>

#### 生成服务代码的鸡蛋模型

sponge生成代码过程中剥离了业务逻辑与非业务逻辑两大部分代码,把sponge的生成代码功能看作是一个母鸡,sponge生成的服务代码看作是鸡蛋,目前支持生成常见的5种类型服务代码,以生成的一个web服务后端代码为例,鸡蛋模型剖析图:

<p align="center">
<img width="1200px" src="https://raw.githubusercontent.com/zhufuyi/sponge_examples/main/assets/web-http-pb-anatomy.png">
</p>

除了web服务后端代码鸡蛋模型,还有grpc服务代码和grpc网关服务代码的鸡蛋模型,点击[这里查看](https://go-sponge.com/zh-cn/learn-about-sponge?id=%f0%9f%8f%b7%e7%94%9f%e6%88%90%e6%9c%8d%e5%8a%a1%e4%bb%a3%e7%a0%81%e7%9a%84%e9%b8%a1%e8%9b%8b%e6%a8%a1%e5%9e%8b)

<br>

### 微服务框架

sponge本质是一个包含了生成代码功能的微服务框架,微服务框架如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。
sponge本质是一个包含了自动生成代码功能的微服务框架,微服务框架如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。

<p align="center">
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">
Expand Down Expand Up @@ -149,46 +130,42 @@ sponge run

### 使用示例

#### 简单示例

不包含具体业务逻辑代码。

- [1_web-gin-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
- [2_micro-grpc-CRUD](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
- [3_web-gin-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
- [4_micro-grpc-protobuf](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
- [5_micro-gin-rpc-gateway](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
- [6_micro-cluster](https://github.com/zhufuyi/sponge_examples/tree/main/6_micro-cluster)
#### 使用sponge创建服务示例

#### 完整项目示例
- [基于sql创建web服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/1_web-gin-CRUD)
- [基于sql创建grpc服务(包括CRUD)](https://github.com/zhufuyi/sponge_examples/tree/main/2_micro-grpc-CRUD)
- [基于protobuf创建web服务](https://github.com/zhufuyi/sponge_examples/tree/main/3_web-gin-protobuf)
- [基于protobuf创建grpc服务](https://github.com/zhufuyi/sponge_examples/tree/main/4_micro-grpc-protobuf)
- [基于protobuf创建grpc网关服务](https://github.com/zhufuyi/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
- [基于protobuf创建grpc+http服务](https://github.com/zhufuyi/sponge_examples/tree/main/a_micro-grpc-http-protobuf)

包括具体业务逻辑代码。
#### 使用sponge开发完整项目示例

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

#### 分布式事务示例

- [9_order-system](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
- [简单的分布式订单系统](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction)

<br>

### 视频介绍

> 视频教程演示使用sponge v1.3.12版本,新版本增加了一些自动化功能、调整了一些UI界面和菜单,建议结合[文档教程](https://go-sponge.com/zh-cn/)使用。
> 视频教程演示使用sponge v1.3.12版本,后续的版本增加了一些自动化功能、调整了一些UI界面和菜单,建议结合[文档教程](https://go-sponge.com/zh-cn/)使用。
- [01 sponge的形成过程](https://www.bilibili.com/video/BV1s14y1F7Fz/)
- [02 sponge的框架介绍](https://www.bilibili.com/video/BV13u4y1F7EU/)
- [03 一键生成web服务完整项目代码](https://www.bilibili.com/video/BV1RY411k7SE/)
- [04 批量生成CRUD接口代码到web服务](https://www.bilibili.com/video/BV1AY411C7J7/)
- [05 一键生成通用的web服务项目代码](https://www.bilibili.com/video/BV1CX4y1D7xj/)
- [06 批量生成任意API接口代码到web服务](https://www.bilibili.com/video/BV1P54y1g7J9/)
- [07 一键生成微服务(grpc)完整项目代码](https://www.bilibili.com/video/BV1Tg4y1b79U/)
- [08 批量生成CRUD代码到微服务项目代码](https://www.bilibili.com/video/BV1TY411z7rY/)
- [09 一键生成通用的微服务(grpc)项目代码](https://www.bilibili.com/video/BV1WY4y1X7zH/)
- [10 批量生成grpc方法代码到微服务](https://www.bilibili.com/video/BV1Yo4y1q76o/)
- [03 一键生成完整的web服务代码](https://www.bilibili.com/video/BV1RY411k7SE/)
- [04 批量生成CRUD api代码到web服务](https://www.bilibili.com/video/BV1AY411C7J7/)
- [05 一键生成通用的web服务代码](https://www.bilibili.com/video/BV1CX4y1D7xj/)
- [06 批量生成任意api模板代码到web服务](https://www.bilibili.com/video/BV1P54y1g7J9/)
- [07 一键生成完整的grpc服务代码](https://www.bilibili.com/video/BV1Tg4y1b79U/)
- [08 批量生成CRUD api代码到grpc服务](https://www.bilibili.com/video/BV1TY411z7rY/)
- [09 一键生成通用的grpc微服务代码](https://www.bilibili.com/video/BV1WY4y1X7zH/)
- [10 批量生成grpc api代码到grpc服务](https://www.bilibili.com/video/BV1Yo4y1q76o/)
- [11 grpc测试神器,简单便捷](https://www.bilibili.com/video/BV1VT411z7oj/)
- [12 一键生成grpc网关服务项目代码](https://www.bilibili.com/video/BV1mV4y1D7k9/)
- [12 一键生成grpc网关服务代码](https://www.bilibili.com/video/BV1mV4y1D7k9/)
- [13 十分钟搭建一个微服务集群示例](https://www.bilibili.com/video/BV1YM4y127YK/)

<br>
Expand Down
Binary file modified assets/sponge-framework.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/sponge-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit aa19227

Please sign in to comment.