Repolode
go-kratos

go-kratos/kratos

A lightweight Go framework for building cloud-native microservices with unified HTTP and gRPC transports, middleware, and Protobuf-based code generation.

Stars
25,984
Forks
4,182
Open issues
121
Last commit
2 days ago

What is it?

Kratos is a Go framework for building cloud-native microservices. It offers small, explicit APIs for transport, middleware, service registry, configuration, logging, encoding, and code generation, so developers can spend more of their time on business logic.

The framework is API-first: services are defined in Protobuf, and the Kratos CLI generates HTTP and gRPC server and client code from those definitions. Both HTTP and gRPC share one transport layer, and middleware covers recovery, logging, validation, tracing, metrics, and authentication. Registry, configuration, and encoding components are pluggable.

The project ships a CLI for scaffolding new services, and a contrib ecosystem provides optional integrations such as registries, config stores, and OpenTelemetry-based observability. Logging is built on the standard library's log/slog package.

Key features

  • 01Protobuf-first workflow that generates HTTP and gRPC code.
  • 02Unified transport layer serving both HTTP and gRPC.
  • 03Composable middleware for recovery, logging, validation, tracing, metrics, and auth.
  • 04Pluggable registry, configuration, and encoding components.
  • 05Standard-library log/slog logging with OpenTelemetry extensions in contrib packages.

Use cases

  • Building a set of microservices in Go that communicate over gRPC and HTTP.
  • Defining APIs in Protobuf and generating server and client stubs for a Go team.
  • Scaffolding a new Go service with a standard project layout.

Quick start

  1. 1

    Install the Go toolchain, protoc and protoc-gen-go as listed in the requirements

  2. 2

    Install the Kratos CLI

    go install github.com/go-kratos/kratos/cmd/kratos/v3@latest
  3. 3

    Create a new service named helloworld

    kratos new helloworld
  4. 4

    Enter the project, fetch dependencies and run the service

    cd helloworld && go mod tidy && kratos run

Things to know

  • Requires protoc and protoc-gen-go to be installed separately for code generation.
  • Requires Go 1.25 or later.

In collections

Topics

FAQ

What is kratos?
A lightweight Go framework for building cloud-native microservices with unified HTTP and gRPC transports, middleware, and Protobuf-based code generation. Kratos is a Go framework for building cloud-native microservices. It offers small, explicit APIs for transport, middleware, service registry, configuration, logging, encoding, and code generation, so developers can spend more of their time on business logic.
Is kratos free to use? What license does it have?
kratos is open source under the MIT license. Check the license terms before using it in commercial products.
Is kratos still maintained?
Actively maintained. The last commit to kratos was on Oct 21, 2026.
What can I use kratos for?
Building a set of microservices in Go that communicate over gRPC and HTTP. Defining APIs in Protobuf and generating server and client stubs for a Go team. Scaffolding a new Go service with a standard project layout.
How do I install kratos?
Install the Go toolchain, protoc and protoc-gen-go as listed in the requirements Install the Kratos CLI: go install github.com/go-kratos/kratos/cmd/kratos/v3@latest Create a new service named helloworld: kratos new helloworld Enter the project, fetch dependencies and run the service: cd helloworld && go mod tidy && kratos run
Where can I get kratos?
The source code and installation instructions are on GitHub: https://github.com/go-kratos/kratos

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects