AI prompts
base on A powerful and easy-to-use Go development framework that enables you to effortlessly build stable, reliable, and high-performance backend services with a "low-code" approach. ## English | [简体中文](assets/readme-cn.md)
<p align="center">
<img width="500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/logo.png">
</p>
<div align=center>
[](https://goreportcard.com/report/github.com/go-dev-frame/sponge)
[](https://codecov.io/gh/go-dev-frame/sponge)
[](https://pkg.go.dev/github.com/go-dev-frame/sponge)
[](https://github.com/go-dev-frame/sponge/actions)
[](https://github.com/avelino/awesome-go)
[](https://img.shields.io/github/license/go-dev-frame/sponge)
</div>
**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.
<br>
### Why Choose Sponge?
- **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 Collaborative Development**: Sponge’s built-in AI assistant understands directory and file structures, intelligently generates business logic code based on context, significantly reduces manual coding, and improves development efficiency and code consistency.
<br>
### Key Features
<details>
<summary> <b>One-Click Generation of Complete Backend Service Code.</b> </summary>
> For `Web`, `gRPC`, or `HTTP+gRPC` services that only require `CRUD APIs`, there is no need to write any `Go` code. Simply connect to a database (such as `MySQL`, `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.
</details>
<details>
<summary> <b>Efficiently Develop General-Purpose Services, from Definition to Implementation in One Step.</b> </summary>
> To build general-purpose `Web`, `gRPC`, `HTTP+gRPC`, or `gRPC 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.
</details>
<details>
<summary> <b>Supports Custom Templates for Flexible Expansion.</b> </summary>
> Sponge supports generating various types of code required for a project through custom templates, not limited to the `Go` language. Examples include `backend code`, `frontend code`, `test code`, `build and deployment scripts`, etc.
</details>
<details>
<summary> <b>Generate Code on a Web Page, Simple and Easy to Use.</b> </summary>
> 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.
</details>
<details>
<summary> <b>Sponge and AI Assistant Collaborative Development for Infrastructure Automation and Business Logic Intelligence.</b> </summary>
> 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`, and `business logic writing`, reducing repetitive work and improving R&D efficiency.
</details>
<br>
### Applicable Scenarios
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.
<br>
### Online Experience
Sponge provides an online experience for code generation: [**Code Generation**](https://go-sponge.com/en/ui).
> Note: If you need to run the downloaded service code locally, you must first complete the local installation of Sponge.
<br>
### Getting Started
1. **Install Sponge**: Supports Windows/macOS/Linux/Docker, see the [**Sponge Installation Guide**](https://github.com/go-dev-frame/sponge/blob/main/assets/install-en.md).
2. **Open the Code Generation UI Page**
```bash
sponge run
```
Access `http://localhost:24631` in your local browser to generate code.
3. **Example: One-Click Generation of Complete Web Service Backend Code**
<p align="center">
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/en_sponge-ui.png">
</p>
- Steps for running and testing the project locally:
- **Fill in parameters**: Connect to the database and select the table name.
- **Download code**: Obtain the complete project code.
- **Generate Swagger documentation**: Run the command `make docs`.
- **Start the service**: Run the command `make run`.
- **API testing**: Open `http://localhost:8080/swagger/index.html` in the browser and use the Swagger UI to test APIs.
<br>
### Components
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**](https://go-sponge.com/component/).
<br>
### Code Generation Engine
**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.
1. Sponge generates a code framework based on built-in templates, as shown in the diagram below:
<p align="center">
<img width="1500px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/sponge-framework.png">
</p>
<br>
2. Sponge generates a code framework based on custom templates, as shown in the diagram below:
<p align="center">
<img width="1200px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/template-framework.png">
</p>
<br>
3. Sponge generates a business logic code framework based on functions and comments, as shown in the diagram below:
<p align="center">
<img width="1200px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/ai-assistant-framework.png">
</p>
<br>
### 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:
<p align="center">
<img width="1000px" src="https://raw.githubusercontent.com/go-dev-frame/sponge/main/assets/en_microservices-framework.png">
</p>
<br>
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**](https://github.com/zhufuyi/microservices_framework_benchmark).
<br>
### Project Code Directory Structure
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/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)`.
<details>
<summary> <b>1. Directory structure for monolithic applications (monolith) or multi-repo microservices.</b> </summary>
```bash
.
├── 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.
```
</details>
<details>
<summary> <b>2. Directory structure for mono-repo microservices (large repository).</b> </summary>
```bash
.
├── 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.
```
</details>
<br>
### Documentation
Click to view the [Sponge Official Documentation](https://go-sponge.com/en/), which completely covers core content such as development guides, components, service configuration, and deployment solutions.
<br>
### Examples
#### Sponge Create Server Code Examples
- [Create **web** service based on **sql** (including CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/1_web-gin-CRUD)
- [Create **grpc** service based on **sql** (including CRUD)](https://github.com/go-dev-frame/sponge_examples/tree/main/2_micro-grpc-CRUD)
- [Create **web** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/3_web-gin-protobuf)
- [Create **grpc** service based on **protobuf** ](https://github.com/go-dev-frame/sponge_examples/tree/main/4_micro-grpc-protobuf)
- [Create **grpc gateway** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/5_micro-gin-rpc-gateway)
- [Create **grpc+http** service based on **protobuf**](https://github.com/go-dev-frame/sponge_examples/tree/main/_10_micro-grpc-http-protobuf)
#### Sponge+DTM Distributed Transaction Examples
- [Simple distributed order system](https://github.com/go-dev-frame/sponge_examples/tree/main/9_order-grpc-distributed-transaction)
- [Flash sale](https://github.com/go-dev-frame/sponge_examples/tree/main/_12_sponge-dtm-flashSale)
- [E-Commerce system](https://github.com/go-dev-frame/sponge_examples/tree/main/_14_eshop)
#### Sponge+AI Assistant Collaborative Development Examples
- [Home appliance retail management](https://github.com/go-dev-frame/sponge_examples/tree/main/_15_appliance_store)
#### Sponge Development Project Examples
- [Community backend services](https://github.com/go-dev-frame/sponge_examples/tree/main/7_community-single)
- [Monolithic service split into microservices](https://github.com/go-dev-frame/sponge_examples/tree/main/8_community-cluster)
<br>
### Contributing
Issues/PRs are welcome! [Contribution Guide](https://go-sponge.com/en/community/contribution.html).
If Sponge is helpful to you, please give it a ⭐ Star! This will motivate us to keep iterating.
<br>
", Assign "at most 3 tags" to the expected json: {"id":"14171","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"