sponge 中文
sponge is a powerful golang productivity tool that integrates automatic code generation
, web and microservices frameworks
, general basic development framework
. sponge has a wealth of code generation commands to generate different functionality of the code can be combined into a complete service (similar to artificially scattered sponge cells that can automatically recombine into a new sponge). Code decoupling modular design , it is easy to build a complete project from development to deployment, so that you develop web or microservices project easily, golang can also be "low-code development".
sponge is mainly based on SQL and Protobuf two ways to generate code, each way has to generate code for different functions.
Generate code framework:
Generate code framework corresponding UI interface:
sponge generated microservice code framework is shown in the figure 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.
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 code generated from proto files, handler method function code, parameter validation code, error codes, Swagger documentation, and more.
Egg model profiling diagram for ⓷Web services created based on protobuf
:
This is the egg model for web service code, and there are egg models for microservice (gRPC) code, and rpc gateway service code described in sponge documentation.
Installation sponge:
sponge can be installed on Windows, macOS, and Linux environments. Click here to view Installation Instructions.
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.
- 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