Kratos is a lightweight Go toolkit for microservices with Protobuf-first APIs, shared HTTP and gRPC transports, and pluggable middleware.
Overview
Kratos helps teams build Go microservices with explicit APIs for networking, middleware, service discovery, configuration, logging, and encoding. The design keeps transport and infrastructure concerns separate so application code can stay focused on domain logic.
Development starts from Protobuf contracts that generate consistent HTTP and gRPC handlers. A unified transport layer routes both protocols through the same service definitions, while composable middleware covers recovery, logging, validation, tracing, metrics, and authentication.
Registry, configuration, and encoding backends are swappable, and logging builds on the standard log and slog packages with optional OpenTelemetry helpers in contrib modules. Shared tooling supports metadata, structured errors, validation, OpenAPI output, and code generation workflows.
A contrib collection adds optional integrations for registries, configuration stores, encodings, and observability vendors. A command-line tool scaffolds new services from templates, and migration guidance documents changes between major versions for production upgrades.
Key features
- Protobuf-first API contracts
- Unified HTTP and gRPC transport
- Composable middleware stack
- Pluggable registry and config
- slog-based logging hooks
- OpenTelemetry contrib support
- Code generation workflows
- CLI service scaffolding
Use cases
- Bootstrap new Go microservices
- Expose both REST and gRPC from one contract
- Standardize tracing and metrics middleware
- Integrate custom service discovery
- Migrate services between Kratos major versions