
go-zero
A Go framework for building web and RPC microservices, with a code generator called goctl.
- Stars
- 33.4k
- Forks
- 4.3k
- Licence
- MIT
- Language
- Go
- Last update
- 5 days ago
- Type
- Library
What it is
go-zero is a framework for writing web APIs and RPC services in Go. It includes built-in engineering features such as timeouts, rate limiting, circuit breaking and load shedding, meant to keep busy services stable. Its goctl tool generates Go server code and client code in other languages from a simple .api description file.
- Generate a REST API server from a .api file with goctl api go
- Build multiple RPC services that call each other
- Generate client code for iOS, Android, TypeScript or other languages from a .api file
Great for
- Go developers building REST APIs or microservices
- Teams that want built-in resilience features like rate limiting and circuit breakers without writing them by hand
- Developers who want code generated from an API description file
Not ideal for
- Developers who prefer to write everything by hand or use only the standard library, since go-zero generates a lot of boilerplate and adds its own conventions
- Non-Go teams, because the framework is written for Go
How to get it
- 1
Install with a package manager
You'll need: Go (version not specified in the README excerpt)
Add the library to your project
go get -u github.com/zeromicro/go-zeroInstall the goctl code generator
go install github.com/zeromicro/go-zero/tools/goctl@latest - 2
Run it
- Create a greet.api file describing your service
- Run goctl api go -api greet.api -dir greet to generate server code
- Enter the greet directory and run go mod tidy
- Start the service with go run greet.go -f etc/greet-api.yaml
- 3
Get the most out of it
- Use goctl to generate code from .api or .proto specs instead of writing boilerplate
- Use the built-in parameter validation via struct tags such as options=[...]
- Use the built-in middleware, which the README says can also be integrated into other frameworks
- Consult the zero-doc full examples for multi-service walkthroughs
Downloads
Strengths
- Includes resilience features such as rate limiting, circuit breaking and load shedding
- Code generation reduces repetitive setup code
- The README says it is used by sites with tens of millions of users
Trade-offs
- Heavy reliance on generated code and its own conventions can make it harder to adopt piecemeal
- The README is truncated, so detailed configuration options are not visible here
- Documentation links point to a separate zero-doc repository and a homepage I could not verify
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| go-zero (this) | 33.4k | Library | intermediate | 5 days ago | Go developers building REST APIs or microservices |
| gin | 89.5k | Library | intermediate | 27 days ago | Go developers building REST APIs |
| echo | 32.8k | Library | intermediate | 6 days ago | Go developers building REST APIs or backend services |
| kratos | 26k | Library | intermediate | 4 days ago | Go developers building a set of backend services that talk over HTTP or gRPC |
| kit | 27.4k | Library | advanced | 2.3 years ago | Go developers building service-oriented or microservice backends |
| chi | 23k | Library | intermediate | 18 days ago | Go developers building REST API services |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.