sponge 中文
sponge is a powerful tool for generating web and microservice code, a microservice framework based on gin and grpc encapsulation, and an open source framework for rapid application development. Sponge has a wealth of code generation commands, and different functional codes can be combined to form a complete service (similar to artificially scattered sponge cells that can automatically recombine into a new sponge). Microservice code functions include logging, service registration and discovery, registration center, flow control, fuse, link tracking, metric monitoring, pprof performance analysis, statistics, cache, CICD and other functions. Generate code unified in the UI interface operation, it is easy to build a complete project engineering code, allowing developers to focus on the implementation of the business logic code, without spending time and energy on the project configuration and integration.
The generated code is based on three approaches Yaml, SQL and Protobuf, each possessing different functional code generation, and the framework diagram of the generated code is shown in Figure 1-1.
Figure 1-1 sponge generation code framework diagram
UI interface for generating code:
The sponge separates the two major parts of code during the process of generating web service code. It isolates the business logic from the non-business logic. For example, consider the entire web service code as an egg. The eggshell represents the web service framework code, while both the albumen and yolk represent the business logic code. The yolk is the core of the business logic (manually written code). It includes defining MySQL tables, defining API interfaces, and writing specific logic code.On the other hand, the albumen acts as a bridge connecting the core business logic code to the web framework code (automatically generated, no manual writing needed). This includes the registration of route codes generated from proto files, handler method function codes, parameter validation codes, error codes, Swagger documentation, and more.
The web service egg model dissection diagram is shown in the following figure:
The gRPC service egg model dissection is shown in the following figure:
The rpc gateway service egg model dissection is shown in the following figure:
The microservice code framework created by sponge is shown in Figure 1-2, this is a typical microservice hierarchy with high performance, high scalability, and includes common service governance features.
Figure 1-2 Microservices framework diagram
After installing the sponge, start the UI service:
sponge run
Visit http://localhost:24631
in your browser, generate code by manipulating it on the page.
The following sample code , in addition to the core business logic code , the other code is generated by the tool sponge .
- 1_web-gin-CRUD
- 2_web-gin-protobuf
- 3_micro-grpc-CRUD
- 4_micro-grpc-protobuf
- 5_micro-gin-rpc-gateway
- 6_micro-cluster
If it's help to you, give it a star ⭐.
See the LICENSE file for licensing information.
You are more than welcome to join us, raise an Issue or Pull Request.
Pull Request instructions.
- Fork the code
- Create your own branch: git checkout -b feat/xxxx
- Commit your changes: git commit -am 'feat: add xxxxx'
- Push your branch: git push origin feat/xxxx
- Commit your pull request