English | 简体中文
Sponge is a powerful and easy-to-use Go
development framework. Its core concept is to reverse-generate modular code by parsing SQL
, Protobuf
, and JSON
files. These modular components can be flexibly combined into various types of complete backend services. Featuring a modular architecture and deeply integrated AI assistant, sponge significantly improves development efficiency and lowers the technical barrier, enabling the effortless construction of high-performance, highly available backend systems through a low-code approach.
Applicable Scenarios
Sponge is ideal for rapidly building various types of high-performance backend services. Applicable scenarios include:
- Developing internal enterprise API services
- Quickly building microservices
- Creating APIs for backend management systems
- Building gRPC services for inter-service communication
- Serving as a starting point for Go beginners or teams to learn Go project structure and best practices
- Supporting teams that need to improve development efficiency and standardize coding practices
- Cloud-native development
In addition, developers can generate business-specific code by customizing templates.
Key Features
-
One-click generation of complete backend service code
ForWeb
orgRPC
services that only requireCRUD APIs
, noGo
code needs to be written. Simply connect to a database (e.g.,MySQL
,MongoDB
,PostgreSQL
,SQLite
) to one-click generate complete backend service code and easily deploy it to Linux servers, Docker, or Kubernetes. -
Efficient development of general-purpose services
When developing general-purposeWeb
,gRPC
,HTTP+gRPC
, orgRPC Gateway
services, you only need to focus on three aspects:- Defining database tables;
- Defining API descriptions in Protobuf files;
- In the generated templates, use built-in AI assistants or manually write business logic code.
The framework code and CRUD API code are all automatically generated by sponge.
-
Support for custom templates, offering flexible extensibility
Sponge supports generating various types of project-specific code using custom templates, not limited to theGo
language. For example:- Backend code;
- Frontend code;
- Configuration files;
- Test code;
- Build and deployment scripts, etc.
-
Generate code on the page, simple and easy to use
Sponge provides code generation on the page, avoiding complex command-line operations, simply filling in parameters on the page to generate code with one click. -
Sponge collaborate with the AI assistants for a closed-loop development process
Sponge deeply integrates with built-in AI assistants (DeepSeek, ChatGPT, Gemini) to form a complete and highly efficient development solution:- Sponge: Handles infrastructure code generation (service framework, CRUD API interfaces, and custom API interfaces code without business logic implementation).
- AI assistant: Focuses on business logic implementation (table structure DDL design, custom API interface definition, and business logic implementation code).
Quick Start
-
Install sponge
Sponge supports installation on Windows, macOS, Linux and Docker. Click to view the sponge installation guide.
-
Open the code generation UI
After installation, run the following command to open the sponge UI:
sponge run
Access
http://localhost:24631
in a local browser to generate code through the UI interface, as shown below:To access from a browser on a different host, specify the host IP or domain when starting the UI, e.g.,
sponge run -a http://your_host_ip:24631
.
Main Features
Sponge has built-in rich components (for on-demand use):
Code Generation Engine
Sponge offers powerful code generation capabilities, supporting both built-in templates
and custom templates
to quickly generate the code required for your project. It also integrates an AI assistant
to help generate business logic code.
- Sponge generates a code framework based on built-in templates, as shown in the diagram below:
- Sponge generates a code framework based on custom templates, as shown in the diagram below:
- Sponge generates a business logic code framework based on functions and comments, as shown in the diagram below:
Microservice framework
Sponge is a modern Go microservice framework that adopts a typical layered microservice architecture. It comes with a rich set of built-in service governance features, enabling developers to quickly build and maintain complex microservice systems. The structure of the framework is shown in the diagram below:
Performance testing of http and grpc service code created by the microservices framework: 50 concurrent, 1 million total requests.
Click to view the test code.
sponge Development Guide
You're welcome to explore the complete technical documentation for the Sponge project, which provides in-depth coverage of core topics such as code generation, development workflows, system configuration, and deployment strategies.
Project Code Directory Structure
The project code directory structure created by sponge follows the project-layout.
Sponge supports creating three types of project code structures: Monolithic application monorepo (monolith)
, Microservices multi-repo (multi-repo)
, and Microservices monorepo (mono-repo)
.
-
The code directory structure for creating a
Monolithic application monorepo (monolith)
orMicroservices multi-repo (multi-repo)
is as follows:. ├── api # Protobuf files and generated * pb.go directory ├── assets # Store various static resources, such as images, markdown files, etc. ├── cmd # Program entry directory ├── configs # Directory for configuration files ├── deployments # Bare metal, docker, k8s deployment script directory. ├── docs # Directory for API interface Swagger documentation. ├── internal # Directory for project internal code. │ ├── cache # Cache directory wrapped around business logic. │ ├── config # Directory for Go structure configuration files. │ ├── dao # Data access directory. │ ├── database # Directory for database initialization and migration. │ ├── ecode # Directory for system error codes and custom business error codes. │ ├── handler # Directory for implementing HTTP business functionality (specific to web services). │ ├── model # Database model directory. │ ├── routers # HTTP routing directory. │ ├── rpcclient # Directory for client-side code that connects to grpc services. │ ├── server # Directory for creating servers, including HTTP and grpc. │ ├── service # Directory for implementing grpc business functionality (specific to grpc services). │ └── types # Directory for defining request and response parameter structures for HTTP. ├── pkg # Directory for shared libraries. ├── scripts # Directory for scripts. ├── test # Directory for scripts required for testing services and test SQL. ├── third_party # Directory for third-party protobuf files or external helper programs. ├── Makefile # Develop, test, deploy related command sets . ├── go.mod # Go module dependencies and version control file. └── go.sum # Go module dependencies key and checksum file.
-
The code directory structure for creating a
Microservices monorepo (mono-repo)
(large repository code directory structure) is as follows:. ├── api │ ├── server1 # Protobuf files and generated *pb.go directory for service 1. │ ├── server2 # Protobuf files and generated *pb.go directory for service 2. │ ├── server3 # Protobuf files and generated *pb.go directory for service 3. │ └── ... ├── server1 # Code directory for Service 1, it has a similar structure to the microservice multi repo directory. ├── server2 # Code directory for Service 2, it has a similar structure to the microservice multi repo directory. ├── server3 # Code directory for Service 3, it has a similar structure to the microservice multi repo directory. ├── ... ├── third_party # Third-party protobuf files. ├── go.mod # Go module dependencies and version control file. └── go.sum # Go module dependencies' checksums and hash keys.
Examples
Sponge Create Server Code Examples
- Create web service based on sql (including CRUD)
- Create grpc service based on sql (including CRUD)
- Create web service based on protobuf
- Create grpc service based on protobuf
- Create grpc gateway service based on protobuf
- Create grpc+http service based on protobuf
Sponge+DTM Distributed Transaction Examples
Sponge+AI Assistant Collaborative Development Examples
Sponge Development Project Examples
If it's help to you, give it a star ⭐.