# Go Kit — Microservice Toolkit for Go > A standard library for microservices in Go providing packages for service discovery, transport, logging, and circuit breaking. ## Install Save as a script file and run: # Go Kit ## Quick Use ```bash go get github.com/go-kit/kit ``` ## Introduction Go Kit is a collection of Go packages that help you build robust, reliable, and maintainable microservices. It fills the gap between the Go standard library and enterprise microservice requirements without forcing an opinionated framework. ## What Go Kit Does - Provides transport-agnostic service abstractions for HTTP, gRPC, Thrift, and NATS - Includes circuit breaker, rate limiter, and retry patterns out of the box - Offers pluggable service discovery via Consul, etcd, ZooKeeper, and DNS SRV - Delivers structured logging and metrics interfaces with multiple backend adapters - Implements the endpoint middleware pattern for composable cross-cutting concerns ## Architecture Overview Go Kit follows a strict layered architecture: Transport, Endpoint, and Service. Your business logic lives in the Service layer as plain Go interfaces. Endpoints wrap service methods with middleware for logging, auth, and tracing. Transports encode and decode between wire formats and endpoints, keeping business code decoupled from infrastructure. ## Self-Hosting & Configuration - Add Go Kit packages individually with no monolithic import required - Configure service discovery by choosing a registrar such as Consul or etcd - Wire up OpenTelemetry or Prometheus exporters through the metrics interfaces - Use the built-in HTTP or gRPC transports or write a custom transport adapter - Everything is composed programmatically in Go with no config files needed ## Key Features - Composable middleware chain for logging, metrics, tracing, and auth - First-class support for both synchronous and streaming RPC - Interoperability with the Go standard library and no framework lock-in - Clean separation of concerns that scales from a single service to hundreds - Mature and stable API surface trusted in production at scale ## Comparison with Similar Tools - **Micro** — more opinionated full-stack platform; Go Kit is a composable toolkit - **Kratos** — provides built-in code generation; Go Kit favors explicit wiring - **gRPC-Go** — transport-only; Go Kit adds service patterns on top of any transport - **Gin / Echo** — HTTP-only web frameworks; Go Kit is transport-agnostic - **Dapr** — sidecar runtime approach; Go Kit is an in-process library ## FAQ **Q: Is Go Kit a framework or a library?** A: A library. You compose the pieces you need without inheriting a base class or following a rigid structure. **Q: Can I use Go Kit with existing HTTP routers like Chi or Gorilla?** A: Yes. The HTTP transport layer works alongside any standard net/http-compatible router. **Q: Does Go Kit support gRPC streaming?** A: Yes. The grpc transport package supports both unary and streaming RPCs. **Q: Is Go Kit still actively maintained?** A: The project is stable and receives maintenance updates. Its API surface is intentionally frozen for reliability. ## Sources - https://github.com/go-kit/kit - https://gokit.io --- Source: https://tokrepo.com/en/workflows/asset-ee7bd869 Author: Script Depot