Skip to content

go-zero Documentation

Build resilient microservices in Go with less code and more confidence.

Simple Code Generation

Generate Go, API, and RPC code from simple definitions using goctl. Less boilerplate, more productivity.

Built-in Resilience

Circuit breakers, rate limiting, adaptive load shedding, and timeout control work automatically. No extra configuration needed.

High Performance

Zero-allocation router, efficient serialization, and optimized middleware chain for production-grade throughput.

Battle Tested

Used by thousands of companies in production, handling millions of requests daily.

// Define your API in a .api file
type (
LoginReq {
Username string `json:"username"`
Password string `json:"password"`
}
LoginResp {
Token string `json:"token"`
}
)
service user-api {
@handler Login
post /api/user/login (LoginReq) returns (LoginResp)
}

Then generate everything with one command:

Terminal window
goctl api go -api user.api -dir .

That’s it. You get a complete, production-ready API server with routing, validation, middleware support, and error handling.

Read the Introduction

Learn what go-zero is and why it exists. Introduction →