
Kratos
A lightweight Go framework for building cloud-native microservices.
- Stars
- 26k
- Forks
- 4.2k
- Licence
- MIT
- Language
- Go
- Last update
- 5 days ago
- Type
- Library
What it is
Kratos is a Go framework for building microservices, the small backend services that together make up a larger application. It provides APIs for handling HTTP and gRPC traffic, middleware, service registry, configuration, logging, and code generation from Protobuf definitions, so developers can focus on business logic. It is maintained as an open-source project under the MIT license.
- Generate a starter service with the kratos CLI and run it locally on port 8000
- Define an API in a .proto file and generate matching HTTP and gRPC server and client code
- Add middleware for recovery, logging, validation, tracing, or auth to a service
- Connect a service to a pluggable registry or configuration store through contrib packages
Great for
- Go developers building a set of backend services that talk over HTTP or gRPC
- Teams that want an API-first workflow starting from Protobuf definitions
- Developers who want a lightweight framework with explicit, composable components
- Teams moving to cloud-native deployments who want pluggable registries and configuration
Not ideal for
- Developers who do not use Go, since the framework is written for Go only
- Beginners with no Go or Protobuf experience, because the setup requires installing protoc and protoc-gen-go first
- Teams planning to upgrade from v2 without reviewing the migration guide, since v3 changes implicit behavior
How to get it
- 1
Install with a package manager
You'll need: Go 1.25 or later · protoc · protoc-gen-go
Install the CLI
go install github.com/go-kratos/kratos/cmd/kratos/v3@latestUpgrade the CLI tooling
kratos upgrade - 2
Run it
- Create a new service with kratos new helloworld
- Enter the folder and run go mod tidy
- Start the service with kratos run
- Visit http://localhost:8000/helloworld/kratos to see the response
- 3
Get the most out of it
- Use kratos proto add, kratos proto client, and kratos proto server to scaffold API definitions and service code from Protobuf
- Run go generate ./... after changing Protobuf files to regenerate code
- Review the v2 to v3 migration guide in docs/migration/v2-to-v3.md before upgrading production services
- Browse the examples repository and kratos-layout project for fuller reference setups
- Use contrib packages to add optional registries, config stores, and OpenTelemetry observability
Downloads
Strengths
- Unified transport layer covering both HTTP and gRPC
- Composable middleware and pluggable components for registry, config, and encoding
- Uses the standard library log/slog for logging, with OpenTelemetry extensions in contrib packages
Trade-offs
- Requires several tools to be installed before a first generated service runs (Go 1.25+, protoc, protoc-gen-go)
- The latest release v3.0.0 has no prebuilt binaries, so installation goes through Go tooling
- Upgrading from v2 requires reading the migration guide because v3 changes previously implicit behavior
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| kratos (this) | 26k | Library | intermediate | 5 days ago | Go developers building a set of backend services that talk over HTTP or gRPC |
| go-zero | 33.4k | Library | intermediate | 5 days ago | Go developers building REST APIs or microservices |
| chi | 23k | Library | intermediate | 19 days ago | Go developers building REST API services |
| gf | 13.3k | Framework | intermediate | 7 days ago | Go developers looking for a full-featured framework |
| grpcurl | 12.9k | CLI | beginner | 24 days ago | Backend engineers testing gRPC endpoints during development |
| kit | 27.4k | Library | advanced | 2.3 years ago | Go developers building service-oriented or microservice backends |
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.