go-zero: A Go Microservices Framework That Puts Code Generation First
go-zero is a cloud-native Go web and RPC microservices framework with built-in resilience design and goctl, a CLI that generates multi-language code from .api files.
At a glance
- What is it?
- go-zero is a cloud-native Go framework that pairs an API description language with the goctl code generator. It targets teams that want resilience features like circuit breakers and rate limiting without hand-writing the glue code.
- Who is it for?
- Adopt go-zero if you are building Go microservices and want a framework that generates server code, parameter validation, and middleware from a single .api file, and you accept the goctl workflow as your primary development path. Do not adopt it if you prefer to hand-write your HTTP handlers or want a framework that stays out of your code generation pipeline.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 14, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What go-zero Solves and Who It Is For
go-zero is a web and RPC framework for Go, but the README makes clear that its core value is not just the runtime library. It is the combination of a simple API description syntax and the goctl code generation tool. The framework is designed for teams building cloud-native microservices that need to handle high traffic without spending weeks wiring up resilience patterns. The README states it has been serving sites with tens of millions of users for years, and it is listed in the CNCF Landscape. The intended user is a Go developer who wants to define a service in a single .api file and get a runnable server, complete with request validation, middleware, and service context, rather than assembling those parts by hand. It is also for teams that need to generate clients in multiple languages, since goctl can output Go, iOS, Android, Kotlin, Dart, TypeScript, and JavaScript from the same .api file.
The goctl Code Generation Pipeline
The central mechanism is goctl, a command-line tool that reads an .api file and produces a Go project skeleton. The README shows a minimal greet.api file that defines a Request type with a path parameter and validation options, a Response type, and a service block with a handler annotation. Running goctl api go -api greet.api -dir greet generates a directory with an etc folder for YAML configuration, a main Go file, and an internal folder containing config, handler, logic, and servicecontext files. The generated structure separates routing, business logic, and service dependencies. The logic file is where developers write request handling, while the service context holds shared resources like MySQL or Redis connections. This pipeline is opinionated: the framework wants you to define your contract first, then generate the implementation scaffold. The README also mentions that goctl can generate templates for other languages, which makes it a multi-language contract tool, not just a Go code generator.
Built-In Resilience Without Configuration
One of the strongest claims in the README is that go-zero includes chained timeout control, concurrency control, rate limit, adaptive circuit breaker, and adaptive load shedding, and that these work with no configuration needed. That is a significant promise. Most frameworks require you to set thresholds or tune parameters. go-zero's approach is to embed these protections directly into the middleware stack that goctl generates. The adaptive circuit breaker and load shedding are designed to react to traffic patterns automatically. The practical implication is that a generated service gets a baseline of protection from day one. However, the README does not explain the exact algorithms or thresholds, so a team adopting go-zero should verify how these features behave under their specific load. The phrase 'adaptive' suggests the framework adjusts based on metrics like error rates or latency, but the details are not in the README.
Getting Started: Real Commands and Config Keys
Installation begins with either go get -u github.com/zeromicro/go-zero for the library or go install github.com/zeromicro/go-zero/tools/goctl@latest for the CLI. On macOS, brew install goctl works, and a Docker image is available for other platforms: docker pull kevinwan/goctl, then run docker run --rm -it -v `pwd`:/app kevinwan/goctl --help. After installing goctl, you create an .api file. The example uses a Request struct with a path tag that includes validation options, and a service block that maps a GET route to a handler. You can generate a template with goctl api -o greet.api, then generate the Go server with goctl api go -api greet.api -dir greet. The generated config file is a YAML file in the etc directory, and the README mentions the service context can include MySQL or Redis connections, though it does not show the exact config keys for those.
AI-Assisted Development: A New Layer
The README dedicates a section to AI-native development, which is unusual for a microservices framework. The team provides three projects: ai-context for workflow guidance, zero-skills for pattern examples, and mcp-zero for code generation via the Model Context Protocol. You can integrate these with GitHub Copilot, Cursor, Windsurf, or Claude Desktop. For Copilot, you add a git submodule for ai-context and create a symlink to .github/copilot-instructions.md. For Claude, you clone mcp-zero, build it, and configure it in claude_desktop_config.json or via the claude mcp add command. The idea is that an AI assistant reads the workflow, calls mcp-zero to generate code, and references zero-skills for patterns. This is a real feature, but it adds complexity: you are now managing submodules and symlinks alongside your API files. If you do not use AI coding tools, this section is irrelevant, but it signals that go-zero is betting on AI-assisted development as a first-class workflow.
Limitations and When It Is the Wrong Tool
The most obvious limitation is the strong coupling to goctl. If you want to hand-write your HTTP handlers or use a different routing library, go-zero will fight you. The generated code is meant to be the starting point, and the README shows that business logic goes into a specific logic file. That structure is fine if you accept it, but it can feel rigid for small services or prototypes. Another limitation is that the .api file syntax is a custom DSL. You must learn it, and the validation options are embedded in struct tags, which mixes concerns. The README does not mention how to handle versioning of .api files or migrations when the API changes, which is a practical gap. Also, the resilience features are described as 'adaptive' but with no configuration, which means you have less control. If your service has unusual traffic patterns, the defaults might not suit you. For a team that prefers explicit configuration over magic, go-zero could be the wrong choice.
Alternative: Hand-Rolled net/http with Middleware
The obvious alternative is to skip code generation entirely and build services directly on Go's standard library, net/http, with your own middleware chain. The README itself notes that go-zero's API is fully compatible with net/http, so you could use the framework's middleware components without the code generation. That approach gives you full control over routing and handler structure, but it means you must write the boilerplate that goctl would generate: route registration, request parsing, validation, and service context setup. You also lose the multi-language client generation. Another alternative is a framework like Gin or Echo, which are popular for HTTP APIs but do not include RPC support or the resilience features built in. The difference is that go-zero is not just a web framework; it is a full microservices toolkit with service mesh features like service discovery and load balancing, as mentioned in the README. If you only need a simple REST API, a lighter framework might be easier.
Maintenance, Upgrade Cost, and License
The repository is under active development, with recent releases including v1.10.3 and goctl/v1.10.2 in August 2026. The frequent releases suggest a fast-moving project, which means you should expect regular updates and potential breaking changes. The README does not document a migration path between versions, so upgrading may require regenerating code and adjusting to new generated structures. The license is MIT, which is permissive and allows commercial use, modification, and distribution with attribution. That is a low barrier for adoption. The AI tooling is a separate concern: ai-context, zero-skills, and mcp-zero are separate repositories, and you need to manage them as submodules or clones. That adds maintenance overhead. Before adopting, check the release notes for each version to understand what changed, and consider whether the generated code will be stable enough for your team to maintain over time.
Editorial conclusion
Adopt go-zero if you are building Go microservices and want a framework that generates server code, parameter validation, and middleware from a single .api file, and you accept the goctl workflow as your primary development path. Do not adopt it if you prefer to hand-write your HTTP handlers or want a framework that stays out of your code generation pipeline. Before committing, verify that goctl supports the languages you need beyond Go, and test how the generated service context fits your existing database and cache setup. The framework's resilience features are built in, but they only help if you use the generated structure as intended.
Community notes