Skip to content

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
Step-by-step guide: how to use go-zeroInstall, first run, examples, tips and FAQs

How to get it

  1. 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-zero

    Install the goctl code generator

    go install github.com/zeromicro/go-zero/tools/goctl@latest
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
go-zero (this)33.4kLibraryintermediate5 days agoGo developers building REST APIs or microservices
gin89.5kLibraryintermediate27 days agoGo developers building REST APIs
echo32.8kLibraryintermediate6 days agoGo developers building REST APIs or backend services
kratos26kLibraryintermediate4 days agoGo developers building a set of backend services that talk over HTTP or gRPC
kit27.4kLibraryadvanced2.3 years agoGo developers building service-oriented or microservice backends
chi23kLibraryintermediate18 days agoGo 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.