Skip to content
forked from zhufuyi/sponge

sponge is a powerful code generation tool, a microservices framework based on gin and gRPC.

License

Notifications You must be signed in to change notification settings

goldpasser/sponge

 
 

Repository files navigation

sponge 中文

Go Report codecov Go Reference Go License: MIT

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.


sponge generates the code framework

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:


Components of the generated service 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:


Services framework

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


Installation


Quick start

After installing the sponge, start the UI service:

sponge run

Visit http:https://localhost:24631 in your browser, generate code by manipulating it on the page.


Examples of use

The following sample code , in addition to the core business logic code , the other code is generated by the tool sponge .

Basic Services examples

Examples of a complete project


Documentation

sponge documentation


If it's help to you, give it a star ⭐.


License

See the LICENSE file for licensing information.


How to contribute

You are more than welcome to join us, raise an Issue or Pull Request.

Pull Request instructions.

  1. Fork the code
  2. Create your own branch: git checkout -b feat/xxxx
  3. Commit your changes: git commit -am 'feat: add xxxxx'
  4. Push your branch: git push origin feat/xxxx
  5. Commit your pull request

About

sponge is a powerful code generation tool, a microservices framework based on gin and gRPC.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.0%
  • Shell 2.0%
  • Other 1.0%