The secret to boost the efficiency of your development projects, support for database mysql, mongodb, postgresql, tidb, sqlite
Tags: go, webdev, microservices
Published: 2024-03-05 10:41:57

In today's fast-paced software development landscape, boosting efficiency is of paramount importance. Developers are constantly on the lookout for tools and technologies that can shorten development cycles and produce higher-quality applications. This article introduces a groundbreaking development tool that can increase development project efficiency by more than 5 times and supports multiple databases, even enabling low-code development using the Go language.

If you are develop RESTful web service or microservice with a simple CRUD API interface, you don't need to write any Go code can be compiled and deployed to the linux server, docker, k8s, just need to connect to the database (mysql、mongodb、postgresql、tidb、sqlite) to generate a complete service code.

If you develop generic web or microservices, just focus on the three core parts of `define database tables`, `define api interfaces in proto files`, `fill in business logic code in the generated template files`, and the rest of the go code is automatically generated.

<br>

### Introducing Sponge

**Sponge** is a basic development framework that integrates `code auto generation`, `Gin and GRPC`, sponge has a rich set of code generation commands, generating different functional code can be combined into a complete service (similar to the way that artificially broken sponge cells can automatically recombine into a new sponge). The code is decoupled and modularly designed, it is easy to build a complete project from development to deployment, just fill in the business logic code on the generated template code, greatly improved development efficiency and reduced development difficulty.

Github address: [https://github.com/zhufuyi/sponge](https://github.com/zhufuyi/sponge) 

**Code Generation Framework**

Sponge mainly generates code based on `SQL` and `Protobuf` in two ways, each of which generates code for different purposes. Among them, `SQL` supports the databases **MySQL**, **MongoDB**, **PostgreSQL**, **TiDB**, and **SQLite**.

**Code Generation Framework Diagram**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgeuo74rasy8yyuka1f0.png)

<br>

**UI Interface Corresponding to the Code Generation Framework**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8twg7is1sgqf7j1o9p35.png)

<br>

**Egg Model for Generating Service Code**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5f6wafqw7fbggjofxzpm.png)

<br>

**Framework Diagram Corresponding to the Generated Service Code**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wtzb4kyb5jfiv7n5y3i.png)

<br>

### Key Features

Sponge is a relatively comprehensive development framework that aims to simplify and accelerate the development process. It provides a range of powerful features and functionalities to help developers overcome common bottlenecks and significantly improve efficiency.

|Feature|Description|
|:---|:---|
|**GUI Operation**|The code generation command comes with a user-friendly GUI interface.|
|**Database Support**|Supports mainstream databases such as MySQL, MongoDB, PostgreSQL, TiDB, and SQLite.|
|**Automatic Code Generation**|Automatically generate and merge code based on database tables, saving significant time and effort.|
|**Rich Service Types**|Supports the development of web services, grpc services, and grpc gateway services.|
|**High Reliability and Performance**|Service code is decoupled and modularized, with rigorous testing and adherence to good coding practices. Built-in caching easily handles high concurrency.|
|**Automated Deployment**|Provides one-stop automated deployment of binaries, docker, and kubernetes, quickly deploying applications to production environments.|
|**Team Collaboration**|Unified code specifications for more efficient team collaboration.|

<br>

### Advantages

Sponge offers the following advantages:

|Advantage|Description|
|:---|:---|
|**Improved Development Efficiency**|Automatic code generation, code merging, and other features significantly improve development speed.|
|**Reduced Development Difficulty**|Low-code development allows developers to create applications without writing large amounts of code.|
|**Shortened Time to Market**|Deployment automation reduces deployment time, enabling applications to be put into production faster.|
|**Improved Code Quality**|Automatically generated unit tests ensure high quality and maintainability of applications.|
|**Reduced Development Cost**|By significantly improving efficiency and reducing developer involvement, the overall development cost of applications is reduced.|

<br>

### Application Scenarios

Sponge is suitable for backend service development scenarios in various businesses, including:

- **High-performance Web services**
- **Microservices**
- **GRPC gateway services**

<br>

### Quick Start

The first step is to install Sponge. It supports installation on Windows, Mac, Linux, and Docker environments. Click to view the [Sponge installation instructions](https://github.com/zhufuyi/sponge/blob/main/assets/install-en.md).

After the installation is complete, start the Sponge UI service:

```bash
sponge run
```

You can generate the services and related code you need on the UI interface. For detailed tutorials, click here to view:

- [Web Service Development](https://go-sponge.com/web-development-sql)
- [Microservice Development](https://go-sponge.com/microservice-development-sql)
- [gRPC Gateway Service Development](https://go-sponge.com/rpc-gateway-development-protobuf)

<br>

### Examples of sponge development

|                                                                                                                                              |                                                                                                                                                                                                                                                        |
|:-------------------------------------------------------------------------------------------------------------------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [**Develop a simple community web backend service in one day**](https://github.com/zhufuyi/sponge_examples/tree/main/7_community-single)     | This example demonstrates how to use Sponge to quickly develop a simple web backend service for a community. The service includes basic functions such as user registration, login, and posting.                                                       |
| [**Seamlessly migrate a monolithic web service to microservices**](https://github.com/zhufuyi/sponge_examples/tree/main/8_community-cluster) | This example shows how to use Sponge to migrate a monolithic web service to microservices with minimal effort. The example covers the process of splitting the service into multiple independent services and implementing communication between them. |
| [**Quickly build a simple order system with distributed transactions from scratch**](https://github.com/zhufuyi/sponge_examples/tree/main/9_order-grpc-distributed-transaction) | This example demonstrates how to use Sponge to build a simple order system with distributed transactions. The system includes features such as order creation, coupon, payment, and inventory management. |

<br>

### Conclusion

Sponge is a development framework that helps you dramatically increase development efficiency and reduce development costs. Through its support for major databases, low-code development, and automation features, sponge provides unparalleled value for a variety of back-end service development scenarios. If you're looking for a way to dramatically improve development efficiency and shorten time-to-market, then sponge is definitely worth a try.