A lightweight Go framework for building cloud-native microservices with unified HTTP and gRPC transports, middleware, and Protobuf-based code generation.
zeromicro/go-zero
A Go web and RPC microservices framework with built-in resilience features and a goctl code generator driven by .api specs.
- Stars
- 33,398
- Forks
- 4,333
- Open issues
- 255
- Last commit
- 2 days ago
What is it?
go-zero is a web and RPC framework written in Go, designed for microservice systems that need to stay stable under high concurrency. It bundles common engineering practices such as chained timeout control, concurrency control, rate limiting, adaptive circuit breaking and adaptive load shedding, many of which work without extra configuration.
The framework is paired with the goctl command-line tool. Developers describe APIs in a simple .api syntax or in .proto files, and goctl generates Go server scaffolding with handlers, logic, service context and typed request/response structs. From the same .api file it can also generate client code for Java, Dart, TypeScript, JavaScript, Kotlin, iOS and Android.
The project also provides AI-assistant guidance for development workflows, including an MCP adapter that exposes goctl generation to tools that support the Model Context Protocol. The core framework is fully compatible with net/http.
Key features
- 01Built-in circuit breaking, rate limiting, load shedding and timeout control
- 02goctl generates Go服务 code from .api or .proto specifications
- 03Automatic validation of request parameters
- 04Client code generation for multiple languages from one .api file
- 05Fully compatible with net/http and integrates with existing middleware
Use cases
- Building high-traffic REST APIs that need built-in resilience protection
- Developing multiple RPC services that communicate with each other in a microservice architecture
- Generating boilerplate and client SDKs for Go and mobile or web front ends from a single API spec
Quick start
- 1
Install goctl with Go
go install github.com/zeromicro/go-zero/tools/goctl@latest - 2
Create the API file greet.api (template generated by goctl)
goctl api -o greet.api - 3
Generate Go server code from the API file
goctl api go -api greet.api -dir greet - 4
Run the generated service
cd greet && go mod tidy && go run greet.go -f etc/greet-api.yaml
In collections
Topics
FAQ
- What is go-zero?
- A Go web and RPC microservices framework with built-in resilience features and a goctl code generator driven by .api specs. go-zero is a web and RPC framework written in Go, designed for microservice systems that need to stay stable under high concurrency. It bundles common engineering practices such as chained timeout control, concurrency control, rate limiting, adaptive circuit breaking and adaptive load shedding, many of which work without extra configuration.
- Is go-zero free to use? What license does it have?
- go-zero is open source under the MIT license. Check the license terms before using it in commercial products.
- Is go-zero still maintained?
- Actively maintained. The last commit to go-zero was on Oct 21, 2026.
- What can I use go-zero for?
- Building high-traffic REST APIs that need built-in resilience protection Developing multiple RPC services that communicate with each other in a microservice architecture Generating boilerplate and client SDKs for Go and mobile or web front ends from a single API spec
- How do I install go-zero?
- Install goctl with Go: go install github.com/zeromicro/go-zero/tools/goctl@latest Create the API file greet.api (template generated by goctl): goctl api -o greet.api Generate Go server code from the API file: goctl api go -api greet.api -dir greet Run the generated service: cd greet && go mod tidy && go run greet.go -f etc/greet-api.yaml
- Where can I get go-zero?
- The source code and installation instructions are on GitHub: https://github.com/zeromicro/go-zero
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A language-independent RPC framework with a code generator that builds interoperable clients and servers across many programming languages.
Java implementation of Apache Dubbo, an RPC and microservice framework for building service communication, discovery and traffic management.
A high-performance HTTP web framework for Go with a Martini-like API, built for REST APIs, web apps and microservices.
An opinionated Java framework for building production-grade, Spring-powered applications and services with minimal setup.
Cloud-native API gateway built on Istio and Envoy, with AI gateway features for LLM providers and MCP server hosting.