# Go-kit — Microservices Toolkit for Go > A curated set of packages and best practices for building robust, composable microservices in Go, covering transport, logging, metrics, and service discovery. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: # Go-kit — Microservices Toolkit for Go ## Quick Use ```bash go get github.com/go-kit/kit ``` Create a service interface, wrap it with endpoint middleware, and expose it over HTTP or gRPC using Go-kit's transport layer. ## Introduction Go-kit is a programming toolkit for building microservices in Go. It addresses the common challenges of distributed systems—service discovery, load balancing, instrumentation, and transport—while letting developers focus on business logic. It promotes a layered architecture separating concerns cleanly. ## What Go-kit Does - Provides composable abstractions for endpoints, transports, and middleware - Integrates service discovery via Consul, etcd, ZooKeeper, and DNS SRV - Supports multiple transports: HTTP, gRPC, Thrift, and NATS - Offers instrumentation adapters for Prometheus, StatsD, and OpenTelemetry - Includes circuit breakers, rate limiters, and request tracing out of the box ## Architecture Overview Go-kit separates every microservice into three layers: the Service (pure business logic as an interface), the Endpoint (a single RPC method wrapped with middleware like logging, circuit breaking, and rate limiting), and the Transport (encoding/decoding for HTTP, gRPC, or other protocols). This separation makes each concern independently testable and replaceable. ## Self-Hosting & Configuration - Install with `go get github.com/go-kit/kit` in any Go module - Define your service interface and implement it in a struct - Wrap each method as an endpoint using `endpoint.Endpoint` type - Add middleware (logging, metrics) by chaining endpoint decorators - Choose a transport package and wire up server/client encode/decode functions ## Key Features - Transport-agnostic design decouples business logic from communication protocol - First-class observability with structured logging and metrics adapters - Resilience patterns including circuit breakers (Hystrix, gobreaker) and rate limiters - Distributed tracing via OpenTracing and OpenTelemetry integrations - Mature ecosystem with production use at companies running large Go microservice fleets ## Comparison with Similar Tools - **Micro** — full-fledged framework with runtime and plugins; Go-kit is a library, not a framework - **gRPC (raw)** — handles transport only; Go-kit adds logging, metrics, and service discovery on top - **Kratos** — opinionated Bilibili framework; Go-kit is unopinionated and composable - **Go Zero** — batteries-included with code generation; Go-kit favors explicit wiring - **Dapr** — sidecar-based runtime; Go-kit embeds capabilities directly in the Go process ## FAQ **Q:** Is Go-kit a framework or a library? A: It is a library. It provides building blocks you compose yourself rather than imposing project structure. **Q:** Does Go-kit support gRPC? A: Yes. The transport/grpc package offers server and client helpers with full middleware support. **Q:** Is Go-kit still maintained? A: The project is in maintenance mode with stable APIs. It remains widely used in production. **Q:** Can I use Go-kit with an existing REST service? A: Yes. You can adopt Go-kit incrementally by wrapping individual endpoints without rewriting everything. ## Sources - https://github.com/go-kit/kit - https://gokit.io --- Source: https://tokrepo.com/en/workflows/go-kit-microservices-toolkit-go-5553232a Author: Script Depot