Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

kratos

> 云原生
Open source

Your ultimate Go microservices framework for the cloud-native era.

25.8K stars0 likes12 views
WebsiteGitHub

About

Your ultimate Go microservices framework for the cloud-native era.

Translations: English | 简体中文

Kratos

Kratos is a lightweight Go framework for building cloud-native microservices. It provides small, explicit APIs for transport, middleware, registry, configuration, logging, encoding, and code generation so applications can focus on business logic.

Features

  • API-first development with Protobuf and generated HTTP/gRPC code.
  • Unified transport layer for HTTP and gRPC.
  • Composable middleware for recovery, logging, validation, tracing, metrics, auth, and more.
  • Pluggable registry, configuration, and encoding components.
  • Standard-library log/slog based logging with OpenTelemetry extensions in contrib packages.
  • Consistent metadata, errors, validation, OpenAPI, and code-generation workflows.
  • A contrib ecosystem for optional integrations such as registries, config stores, middleware, encodings, and observability.

Installation

Requirements

  • Go 1.25 or later
  • protoc
  • protoc-gen-go

Install the CLI

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

Create a Service

bash
kratos new helloworld
cd helloworld
go mod tidy
kratos run

Visit http://localhost:8000/helloworld/kratos after the service starts.

For a fuller generated service flow:

bash
kratos proto add api/helloworld/helloworld.proto
kratos proto client api/helloworld/helloworld.proto
kratos proto server api/helloworld/helloworld.proto -t internal/service
go generate ./...
kratos run

Usage Example

go
package main

import (
	"github.com/go-kratos/kratos/v3"
	"github.com/go-kratos/kratos/v3/transport/grpc"
	"github.com/go-kratos/kratos/v3/transport/http"
)

func main() {
	httpSrv := http.NewServer(http.Address(":8000"))
	grpcSrv := grpc.NewServer(grpc.Address(":9000"))

	app := kratos.New(
		kratos.Name("helloworld"),
		kratos.Version("v1.0.0"),
		kratos.Server(httpSrv, grpcSrv),
	)
	if err := app.Run(); err != nil {
		panic(err)
	}
}

v3 Migration

Kratos v3 reduces core dependencies and makes previously implicit behavior explicit. Review the v2 to v3 migration guide before upgrading production services.

Further Reading

  • Documentation
  • Examples
  • Project Layout
  • v2 to v3 Migration Guide
  • Community Contribution Guide

Development

bash
make test
make lint

Community

  • Documentation
  • WeChat Group
  • Discord Group
  • Discussions

Security

If you discover a security vulnerability in Kratos, please contact [email protected]. Security reports are handled privately before disclosure.

Contributors

Thank you for contributing to Kratos. The contribution guide is available in the Kratos documentation.

Acknowledgments

The following projects influenced Kratos design:

  • go-kit/kit
  • go-micro
  • google/go-cloud
  • go-zero
  • beego

License

Kratos is open-sourced software licensed under the MIT license.

Issues· 116 open

View all issuesOpen on GitHub
  • #3886

    middleware/logging: duplicate error string recorded in `error` & `stack`, and all non-nil errors hardcoded to LevelError

    bugUpdated Sep 27, 2026
  • #3890

    [Vulnerability] GO-2026-5471

    bugUpdated Sep 16, 2026
  • #3889

    Config map-merge keeps both proto field spellings; Scan fails with duplicate field

    bugUpdated Sep 14, 2026
  • #3888

    Config map-merge keeps both proto field spellings; Scan fails with duplicate field

    Updated Sep 14, 2026
  • #3880

    go-kratos.dev的文档该更新了

    bugUpdated Aug 28, 2026
  • #3881

    Boolean config fields cannot be overridden from the environment

    bugUpdated Aug 26, 2026
  • #3854

    protobuf slice bounds out of range panic

    bugUpdated Aug 12, 2026
  • #3815

    http server Bind errors bypass middleware chain (logging/tracing/recovery not executed)

    bugstaleUpdated Aug 12, 2026
  • #3868

    Kratos 命令行工具创建的模板与自身版本不匹配

    bugUpdated Aug 7, 2026
  • #3867

    middleware/metadata: non-ASCII values break gRPC calls, header values should be percent-encoded

    bugUpdated Aug 7, 2026

> Tags

Goaiarchitecturecloud-nativeframework

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
Category云原生
PricingOpen source

> Related tools

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,