# Go Micro — Distributed Microservices Framework for Go > Go Micro is a pluggable framework for building microservices in Go. It provides service discovery, RPC communication, event-driven messaging, and load balancing out of the box with a clean, idiomatic API. ## Install Save in your project root: # Go Micro — Distributed Microservices Framework for Go ## Quick Use ```bash # Install the CLI go install go-micro.dev/v4/cmd/micro@latest # Create a new service micro new helloworld cd helloworld # Run the service go run main.go ``` ## Introduction Go Micro provides a set of pluggable building blocks for writing microservices in Go. It abstracts away the details of distributed systems — service discovery, message encoding, RPC transport, and async messaging — letting developers focus on business logic rather than infrastructure plumbing. ## What Go Micro Does - Abstracts service discovery with a Registry interface (Consul, etcd, mDNS, Kubernetes) - Provides synchronous RPC via a Transport layer and asynchronous messaging via a Broker - Includes built-in load balancing, retries, and timeouts for client calls - Generates service scaffolding with the micro CLI tool - Supports protocol buffers and gRPC as first-class transports ## Architecture Overview Go Micro is built around a set of interfaces: Registry for discovery, Transport for point-to-point communication, Broker for pub/sub, Codec for serialization, and Server/Client for the RPC layer. Each interface has multiple pluggable implementations, so you can swap Consul for etcd or gRPC for HTTP without changing application code. The framework uses a sidecar-free approach — all logic runs in-process. ## Self-Hosting & Configuration - Install via `go get go-micro.dev/v4` in any Go module - Configure service discovery backend via environment variables or code options - Use the built-in mDNS registry for local development without external dependencies - Deploy to Kubernetes using the built-in Kubernetes registry plugin - Set timeouts, retries, and connection pools through functional options ## Key Features - Fully pluggable architecture — swap any component without code changes - Built-in service discovery, load balancing, and fault tolerance - Code generation from protobuf definitions for type-safe RPC - Event-driven architecture support through the Broker interface - Zero external dependency mode using mDNS for development ## Comparison with Similar Tools - **gRPC-Go** — lower-level RPC framework; Go Micro adds discovery, load balancing, and a pluggable architecture on top - **Go Kit** — toolkit with explicit middleware composition; Go Micro offers a more opinionated, batteries-included approach - **Dapr** — sidecar-based runtime; Go Micro runs entirely in-process without sidecar overhead - **Kratos** — Bilibili's Go framework; Go Micro has a longer track record and larger plugin ecosystem ## FAQ **Q: Is Go Micro still actively maintained?** A: The project has transitioned through several maintainers. The v4 release is stable and used in production by many teams. **Q: Can I use Go Micro with gRPC?** A: Yes. A gRPC transport plugin lets you use gRPC as the underlying communication layer. **Q: Does Go Micro require Consul or etcd?** A: No. It ships with an mDNS-based registry for development, and supports Kubernetes, etcd, Consul, and others via plugins. **Q: How does Go Micro handle versioning and rolling deployments?** A: Services register with version metadata. The client-side load balancer can route to specific versions using selector filters. ## Sources - https://github.com/micro/go-micro - https://go-micro.dev/ --- Source: https://tokrepo.com/en/workflows/asset-9b315199 Author: AI Open Source