Skip to content

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.

License

Notifications You must be signed in to change notification settings

go-dev-frame/sponge

Repository files navigation

English | 简体中文

Go Report codecov Go Reference Go Awesome Go License: MIT


Introduction

Sponge is a powerful and easy-to-use Go development framework. It integrates automatic code generation, Web frameworks (Gin), and microservice frameworks (gRPC), covering the full lifecycle from project generation, development, and testing to API documentation and deployment.

Sponge's core philosophy is "Definition is Code". By parsing SQL, Protobuf, and JSON configuration files, it generates modular backend service code. You can flexibly combine these code modules like building blocks to quickly construct various backend systems ranging from monolithic applications to microservice clusters (including RESTful API, gRPC, HTTP+gRPC, gRPC Gateway, etc.).

Sponge aims to improve the development efficiency and code quality of backend services. Through a low-code approach, it helps developers completely eliminate tedious repetitive work (such as CRUD, routing configuration, and project structure setup), allowing them to focus on the implementation of core business logic.


Why Choose Sponge?

  • Extreme Development Efficiency: Automatically generates CRUD APIs, project scaffolding, and extensive boilerplate code, letting developers say goodbye to repetitive labor.
  • Out of the Box: Provides a complete development toolchain (Generate → Develop → Test → Deploy → Monitor), eliminating the need to piece together fragmented tools.
  • Industry Best Practices: Built on the mainstream Go community tech stack (Gin/GORM/gRPC/Protobuf, etc.), with a standardized architecture to reduce technology selection risks.
  • Flexible and Extensible: Supports custom templates, not limited to Go; can extend to generate frontend code, test scripts, and arbitrary code.
  • Gentle Learning Curve: Low entry barrier and easy to get started.
  • Suitable for Team Collaboration: Unified project structure improves team collaboration efficiency and code maintainability.
  • Fusion of Low-Code and AI:
    • Sponge handles the generation of standardized infrastructure code (APIs, data layer, service frameworks).
    • AI Models perceive the project context and assist in generating core business logic, achieving "Automated Infrastructure, Intelligent Business".

Key Features

One-click Generation of Complete Backend Services (Zero-Code).

For scenarios requiring only basic CRUD capabilities (Web, gRPC, or HTTP+gRPC), no Go code needs to be written. simply connect to a database (MySQL, MongoDB, PostgreSQL, SQLite) to generate a complete backend service with one click, supporting direct deployment to Linux, Docker, or Kubernetes.

Protocol-Driven Development for General Backend Services, from Definition to Implementation in One Step.

For general Web, gRPC, HTTP+gRPC, or gRPC Gateway services, a standardized development process is adopted:

  1. Define Data: Design SQL DDL.
  2. Define Interface: Write Protobuf IDL.
  3. Generate Code: Sponge automatically generates CRUD, routing, documentation, and glue code.
  4. Fill Business: Use Sponge's built-in AI model or manually complete the core logic.
Visual Code Generation, Simple and Easy to Use.

Say goodbye to complex command-line arguments. Sponge provides an intuitive Web UI, allowing you to complete code generation through simple form configurations, lowering the barrier to entry.

AI Collaborative Development.

Sponge integrates with AI models like DeepSeek, ChatGPT, and Gemini. Sponge handles the tedious engineering structure and standardized code, while the AI model focuses on understanding requirements and generating specific business logic code, significantly improving code consistency and R&D speed.

Support for Custom Templates, Flexible Extension.

Not limited to the Go language, you can generate frontend code, test scripts, CI/CD configurations, and any text file through custom templates to meet specific team engineering needs.


Applicable Scenarios

Sponge is suitable for building high-performance, maintainable backend systems, specifically for:

  • Rapid development of RESTful API services
  • Building large-scale microservice architectures
  • Cloud-native application development
  • Rapid refactoring and migration of legacy projects
  • Standardized engineering templates for Go beginners or teams

Online Demo

No installation required, experience the code generation feature directly in your browser: Code Generation

Note: If you need to run the downloaded service code locally, you must first complete the local installation of Sponge.


Quick Start

  1. Install Sponge: Supports Windows, macOS, Linux, and Docker environments. View the Sponge Installation Guide.

  2. Open the Code Generation UI Page

    sponge run

    Access http://localhost:24631 in your local browser to generate code.

  3. Example: One-click Generation of Web Service Backend Code Based on SQL

    • Operation Process:
      • Fill Parameters: Connect to the database and select tables in the UI.
      • Download Code: Click generate and download the complete project package.
      • Generate Swagger Documentation: Execute make docs in the project root directory.
      • Start Service: Execute make run.
      • Test Interface: Access http://localhost:8080/swagger/index.html in the browser to test APIs via the Swagger interface.

Tech Stack & Components

Sponge follows the "batteries included" principle, integrating 30+ mainstream Go ecosystem components, loaded on demand:

Category Component
Frameworks Gin, gRPC
Database GORM (MySQL, PostgreSQL, SQLite, etc.), MongoDB
Cache/Messaging Redis, Kafka, RabbitMQ
Service Governance Etcd, Consul, Nacos, Jaeger, Prometheus, OpenTelemetry
Others DTM (Distributed Transaction), WebSocket, Swagger, PProf

👉 View the complete list of tech stacks and components.


Architecture & Principles

Code Generation Engine

Sponge provides multiple code generation engines, supporting built-in templates, custom templates, and AI-assisted generation.

  1. Code generation engine based on built-in templates, as shown below:


  1. Code generation engine based on custom templates, as shown below:


  1. Code generation engine based on AI-assisted business logic, as shown below:


Microservice Architecture

The code generated by Sponge follows a typical layered architecture with built-in service governance capabilities. The structure is clear and easy to maintain. A modern microservice framework structure is shown below:


Performance Benchmarks

Based on tests with 50 concurrency and 1 million requests, services generated by Sponge demonstrate excellent performance:

  1. HTTP Service http-server

  2. gRPC Service grpc-server

👉 View detailed test code and environment.


Directory Structure

The service code directory structure created by Sponge follows the project-layout, supporting Monolith, Multi-Repo, and Mono-Repo patterns.

1. Monolith / Multi-Repo Structure Details.
   .
   ├── api            # Directory for protobuf files and generated *pb.go files
   ├── assets         # Directory for other assets used with the repository (images, logos, etc.)
   ├── cmd            # Main application entry directory
   ├── configs        # Directory for configuration files
   ├── deployments    # Deployment scripts directory for bare metal, docker, k8s
   ├── docs           # Directory for design documents and interface documentation
   ├── internal       # Private application and library code directory
   │    ├── cache        # Cache directory wrapped based on business logic
   │    ├── config       # Go structure configuration file directory
   │    ├── dao          # Data access directory
   │    ├── database     # Database directory
   │    ├── ecode        # Custom business error code directory
   │    ├── handler      # HTTP business functionality implementation directory
   │    ├── model        # Database model directory
   │    ├── routers      # HTTP routing directory
   │    ├── rpcclient    # Client directory for connecting to gRPC services
   │    ├── server       # Service entry, including http, grpc, etc.
   │    ├── service      # gRPC business functionality implementation directory
   │    └── types        # HTTP request and response types directory
   ├── pkg            # Library directory that can be used by external applications
   ├── scripts        # Execution scripts directory
   ├── test           # Additional external test applications and test data
   ├── third_party    # Directory for dependent third-party protobuf files or other tools
   ├── Makefile       # Collection of commands related to development, testing, and deployment
   ├── go.mod         # Go module dependency and version control file
   └── go.sum         # Go module dependency checksum file
2. Mono-Repo Structure Details.
   .
   ├── 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, basically same structure as multi-repo
   ├── server2        # Code directory for Service 2, basically same structure as multi-repo
   ├── server3        # Code directory for Service 3, basically same structure as multi-repo
   ├── ...
   ├── third_party    # Dependent third-party protobuf files
   ├── go.mod         # Go module dependency and version control file
   └── go.sum         # Go module dependency checksum file

Documentation

Click to view the Official Sponge Documentation, covering core content such as development guides, components, service configuration, and deployment solutions.


Example Projects

Basic Examples

Advanced Projects


Contribution

Issues and PRs are welcome! Contribution Guide.


If Sponge is helpful to you, please give it a ⭐ Star! This will be our motivation for continuous updates.