Installing Sponge
Before installing sponge, you need to install the dependencies go
and protoc
. You can skip this step if they are already installed.
Install Go
Requires go 1.23+
version, download from: https://studygolang.com/dl
Install protoc
Download protoc from: https://github.com/protocolbuffers/protobuf/releases/tag/v25.2
Download the appropriate protoc executable based on your system type. Move the protoc executable to a directory included in your PATH environment variable.
Install sponge
After installing go and protoc, next install sponge and its plugins. Installation is supported on Windows, Linux, Mac, and Docker environments.
In the Windows environment, there are two ways to install sponge.
Method 1: Directly download the installation package (recommended)
Click to view the installation instructions.
Method 2: Manual installation
Because sponge depends on some Linux commands, you need to install git bash and make in Windows to support a Linux command environment.
✅ Install git for windows
If you have already installed git, you can skip this step.
Download git from: Git-2.44.0-64-bit.exe
After downloading, install git. Accept the default options during the installation process. After installing git, right-click in any folder (show more options). If you see the option Open Git Bash here to open a git bash terminal, it means git has been successfully installed.
To resolve garbled Chinese characters in git bash, right-click the git bash terminal, select the menu options → Text, find "character set", select UTF-8, and save.
✅ Install make
Download mingw64 from: x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z
Extract the file. In the bin directory, find the mingw32-make.exe
executable, copy and rename it to make.exe
. Move the make.exe
executable to the GOBIN
directory (check go env GOBIN
; if it's empty, see the GOBIN
setup instructions below).
Check the make version: make -v
✅ Install sponge and its plugins
Open a git bash terminal (not the default Windows cmd).
Add
GOBIN
to the system environment variable PATH. You can skip this step if you have already set it up.# Set the directory for go get command to download third-party packages setx GOPATH "D:\YourDirectory" # Set the directory where go install command saves compiled executables setx GOBIN "D:\YourDirectory\bin" # Close the current terminal and open a new one to check the GOBIN directory go env GOBIN
Install sponge and its dependency plugins into the
GOBIN
directory.# Install sponge go install github.com/go-dev-frame/sponge/cmd/sponge@latest # Initialize sponge, automatically installing sponge dependency plugins sponge init # Check if all plugins are installed successfully. If some plugins failed to install, retry with command: sponge plugins --install sponge plugins # Check sponge version sponge -v
Install sponge in a Linux environment.
Add
$GOBIN
to the system environment variable PATH. You can skip this step if you have already set it up.# Open the .bashrc file vim ~/.bashrc # Copy the following commands into .bashrc export GOROOT="/opt/go" # Your go installation directory export GOPATH=$HOME/go # Set the directory for go get command to download third-party packages export GOBIN=$GOPATH/bin # Set the directory where go install command saves compiled executables export PATH=$PATH:$GOBIN:$GOROOT/bin # Add the $GOBIN directory to the system environment variable path # After saving the .bashrc file, apply the settings source ~/.bashrc # Check the GOBIN directory go env GOBIN
Execute commands to install sponge. Sponge and dependency plugins will be installed into the
$GOBIN
directory.# Install sponge go install github.com/go-dev-frame/sponge/cmd/sponge@latest # Initialize sponge, automatically installing sponge dependency plugins sponge init # Check if all plugins are installed successfully. If some plugins failed to install, retry with command: sponge plugins --install sponge plugins # Check sponge version sponge -v
Install sponge in a Mac environment.
Add
$GOBIN
to the system environment variable PATH. You can skip this step if you have already set it up.# Open the .bashrc file vim ~/.bashrc # Copy the following commands into .bashrc export GOROOT="/opt/go" # Your go installation directory export GOPATH=$HOME/go # Set the directory for go get command to download third-party packages export GOBIN=$GOPATH/bin # Set the directory where go install command saves compiled executables export PATH=$PATH:$GOBIN:$GOROOT/bin # Add the $GOBIN directory to the system environment variable path # After saving the .bashrc file, apply the settings source ~/.bashrc # Check the GOBIN directory go env GOBIN
Execute commands to install sponge. Sponge and dependency plugins will be installed into the
$GOBIN
directory.# Install sponge go install github.com/go-dev-frame/sponge/cmd/sponge@latest # Initialize sponge, automatically installing sponge dependency plugins sponge init # Check if all plugins are installed successfully. If some plugins failed to install, retry with command: sponge plugins --install sponge plugins # Check sponge version sponge -v
Using Docker to install sponge only installs the sponge UI interface service. If you need to develop based on the generated service code, you still need to install sponge and dependency plugins locally.
Method 1: Docker start
docker run -d --name sponge -p 24631:24631 zhufuyi/sponge:latest -a http://<your_host_ip>:24631
Method 2: docker-compose start
The content of the docker-compose.yaml file is as follows:
version: "3.7"
services:
sponge:
image: zhufuyi/sponge:latest
container_name: sponge
restart: always
command: ["-a","http://<your_host_ip>:24631"]
ports:
- "24631:24631"
Start the service:
docker-compose up -d
After successful deployment with Docker, access http://<your_host_ip>:24631
in your browser.
Open sponge code generation page
Sponge provides rich code generation features, and common commands are equipped with intuitive UI interfaces. This interface has the following advantages:
- Memory Function: Automatically saves historical operation records
- Detailed Explanation: Each parameter comes with an explanation
- Operation Guidance: Provides complete usage steps after generating code
Operation Steps:
Open a terminal and execute the following command:
sponge run
Visit http://localhost:24631 in your browser to access the code generation page.
Upgrade sponge
To upgrade to the latest sponge version, execute the command:
sponge upgrade