Skip to content

chi vs Kratos

Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.

chi

Open source · MIT

A small, standard-library-compatible router for building Go HTTP and REST API services.

Kratos

Open source · MIT

A lightweight Go framework for building cloud-native microservices.

The short answer

Choose chi if you need…

  • Go developers building REST API services
  • Teams that want routing built on the standard net/http package
  • Projects that need route groups, nested sub-routers, or mounted handlers
  • Developers who want optional middleware and route documentation generation

Choose Kratos if you need…

  • 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

Side-by-side

chiKratos
TypeLibraryLibrary
PriceFree and open sourceFree and open source
LicenceMITMIT
GitHub stars23k26k
Setup difficultyIntermediateIntermediate
How you get itInstall with a package managerInstall with a package manager
Main languageGoGo
Last code update19 days ago5 days ago

What each one is

chi

chi is a routing library for Go that maps incoming web requests to the code that should handle them, such as sending /articles/123 to a function that loads article 123. It is built on Go's standard net/http package and context package, so handlers and middleware written for the standard library generally work with it. It is aimed at larger REST API projects that need to stay organized as they grow.

Kratos

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.

Best for

chi

  • Go developers building REST API services
  • Teams that want routing built on the standard net/http package
  • Projects that need route groups, nested sub-routers, or mounted handlers
  • Developers who want optional middleware and route documentation generation

Kratos

  • 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

Strengths

chi

  • Small core router (the README says under 1000 lines of code) with no external dependencies
  • Compatible with net/http, so existing standard-library handlers and middleware can be reused
  • Supports route groups, sub-routers, and mounting for organizing large APIs

Kratos

  • 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

Not ideal for

chi

  • Developers who want a full web framework with templates, ORM, and built-in auth, since chi covers routing and relies on separate packages for other needs
  • People not writing Go, since the library is Go-only
  • Beginners with no Go experience, since the README assumes familiarity with Go handlers and context

Kratos

  • 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

Trade-offs

chi

  • Routing only; features like rendering, validation, and database access need separate packages or your own code
  • The README's examples use string keys for context values, which is a pattern the README itself shows and not a fully type-safe approach

Kratos

  • 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

Getting started

chi

Install chi v5

go get -u github.com/go-chi/chi/v5
Step-by-step guide: how to use chi

Kratos

Install the CLI

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

Upgrade the CLI tooling

kratos upgrade
Step-by-step guide: how to use Kratos

Frequently asked questions

What is the difference between chi and Kratos?

chi: A small, standard-library-compatible router for building Go HTTP and REST API services. Kratos: A lightweight Go framework for building cloud-native microservices. chi suits go developers building rest api services, while Kratos suits go developers building a set of backend services that talk over http or grpc.

Are chi and Kratos free?

chi: Free and open source. Kratos: Free and open source.

Is chi or Kratos more popular?

Kratos has more GitHub stars (26k) than chi (23k). Popularity isn't the same as fit — check which one matches your use case above.

What are other alternatives to chi and Kratos?

Other options people compare them with include Gin, Echo, dio, go-zero, warp.

Keep comparing

Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.