English | 简体中文
Sponge is a powerful and easy-to-use Go development framework. Its core philosophy is "Definition is Code". It generates modular Go code by parsing SQL
, Protobuf
, and JSON
files. These code modules can be flexibly combined to build various types of complete backend services.
Sponge provides a one-stop project development solution, covering code generation, development, testing, API documentation, and deployment. It helps developers easily build stable and reliable high-performance backend services (including RESTful API, gRPC, HTTP+gRPC, gRPC Gateway, etc.) in a "low-code" manner, significantly improving the efficiency and quality of project development.
- Extremely High Development Efficiency: Automatically generates CRUD APIs, project scaffolding, and glue code (non-business code), completely solving the problem of extensive repetitive work in traditional development processes.
- Out-of-the-Box: Covers the entire development lifecycle (generate → develop → test → deploy → monitor), avoiding a fragmented toolchain.
- Standardized Best Practices: Based on mature solutions from the Go community (Gin/gRPC/Protobuf, etc.), eliminating the hassle of technology selection.
- Minimal Learning Curve: Get started quickly and focus on business logic through code generation and clear examples.
- Ideal for Team Collaboration: Unified project structure improves code maintainability.
- AI Collaboration: Based on Sponge's standardized directory and file structure, it intelligently generates business logic code, significantly reducing manual coding and improving development efficiency and code consistency.
One-Click Generation of Complete Backend Service Code.
For
Web
,gRPC
, orHTTP+gRPC
services that only requireCRUD APIs
, there is no need to write anyGo
code. Simply connect to a database (such asMySQL
,MongoDB
,PostgreSQL
,SQLite
), and you can generate the complete backend service code with one click and easily deploy it to a Linux server, Docker, or Kubernetes.
Efficiently Develop General-Purpose Services, from Definition to Implementation in One Step.
To build general-purpose
Web
,gRPC
,HTTP+gRPC
, orgRPC Gateway
services, you only need to focus on these three steps:
- Define database tables (SQL DDL);
- Describe the API in a Protobuf file (Protobuf IDL);
- Implement the business logic (supports a built-in AI assistant to automatically generate and merge business logic code).
All basic code, including CRUD APIs, service framework, and glue code, is automatically generated by Sponge, allowing developers to focus on core business and comprehensively improve development efficiency.
Supports Custom Templates for Flexible Expansion.
Sponge supports generating various types of code required for a project through custom templates, not limited to the
Go
language. Examples includebackend code
,frontend code
,test code
,build and deployment scripts
, etc.
Generate Code on a Web Page, Simple and Easy to Use.
Sponge provides code generation on a web page, avoiding complex command-line operations. Simply fill in the parameters on the page to generate code with one click.
Sponge and AI Assistant Collaborative Development for Infrastructure Automation and Business Logic Intelligence.
Sponge, combined with its built-in AI assistants (DeepSeek, ChatGPT, Gemini), creates a complete, efficient, and intelligent development solution:
- Sponge: Responsible for the automatic generation of infrastructure code, including
service framework
,CRUD APIs
,custom APIs (without business logic)
, etc., ensuring a unified and standardized architecture.- AI Assistant: Focuses on business logic implementation, assisting with tasks such as
database table design
,Protobuf API definition
, andbusiness logic writing
, reducing repetitive work and improving R&D efficiency.
Sponge is suitable for rapidly building various types of high-performance backend services, including the following scenarios:
- Developing RESTful API services
- Building microservice projects
- Cloud-native project development
- Rapidly refactoring legacy projects
- As a starting point for Go beginners or as a best practice for teams
Additionally, developers can generate various types of code to meet business needs through custom templates.
Sponge provides an online experience for code generation: Code Generation.
Note: If you need to run the downloaded service code locally, you must first complete the local installation of Sponge.
-
Install Sponge: Supports Windows/macOS/Linux/Docker, see the Sponge Installation Guide.
-
Open the Code Generation UI Page
sponge run
Access
http://localhost:24631
in your local browser to generate code. -
Example: One-Click Generation of Complete Web Service Backend Code
-
Connect to the database, select table names.
-
Download Code: Get the complete code.
-
Generate Swagger Docs:
make docs
. -
Run:
make run
. -
Test: Access the Swagger documentation at
http://localhost:8080/swagger/index.html
in your browser to test the API.
Sponge has built-in support for over 30 common components in the Go ecosystem (used on demand), including mainstream technology stacks such as Gin, gRPC, GORM, MongoDB, Redis, Kafka, DTM, WebSocket, Prometheus, etc. View all components.
Sponge provides 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:
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.
The project code directory structure created by sponge follows the project-layout.
Sponge supports creating project code structures for monolithic application in a single repository (monolith)
, microservices in multiple repositories (multi-repo)
, and microservices in a single repository (mono-repo)
.
1. Directory structure for monolithic applications (monolith) or multi-repo microservices.
.
├── 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.
2. Directory structure for mono-repo microservices (large repository).
.
├── 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.
Click to view the Sponge Official Documentation, which completely covers core content such as development guides, components, service configuration, and deployment solutions.
- 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
Issues/PRs are welcome! Contribution Guide.
If Sponge is helpful to you, please give it a ⭐ Star! This will motivate us to keep iterating.