Top Related Projects
A standard library for microservices.
The Go language implementation of gRPC. HTTP/2 based RPC
Gin is a high-performance HTTP web framework written in Go. It provides a Martini-like API but with significantly better performance—up to 40 times faster—thanks to httprouter. Gin is designed for building REST APIs, web applications, and microservices.
High performance, minimalist Go web framework
Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
⚡️ Express inspired web framework written in Go
Quick Overview
Go Micro is a framework for distributed systems development in Go. It provides the core requirements for distributed systems development including RPC and event-driven communication. Go Micro abstracts away the details of distributed systems, allowing developers to focus on building business logic.
Pros
- Simplifies the development of microservices in Go
- Provides a pluggable architecture for flexibility and extensibility
- Offers built-in service discovery, load balancing, and fault tolerance
- Supports multiple protocols (gRPC, HTTP, etc.) and encodings
Cons
- Learning curve for developers new to microservices architecture
- May be overkill for simple applications or small projects
- Documentation can be sparse or outdated in some areas
- Community support might be less compared to some other frameworks
Code Examples
- Defining a service:
import (
"github.com/micro/go-micro/v3"
)
service := micro.NewService(
micro.Name("greeter"),
micro.Version("latest"),
)
service.Init()
- Implementing a handler:
type Greeter struct{}
func (g *Greeter) Hello(ctx context.Context, req *proto.Request, rsp *proto.Response) error {
rsp.Greeting = "Hello " + req.Name
return nil
}
- Calling a service:
client := proto.NewGreeterService("greeter", service.Client())
rsp, err := client.Hello(context.Background(), &proto.Request{Name: "John"})
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp.Greeting)
Getting Started
-
Install Go Micro:
go get github.com/micro/go-micro/v3 -
Create a new service:
package main import ( "github.com/micro/go-micro/v3" "log" ) func main() { service := micro.NewService( micro.Name("my.service"), ) service.Init() if err := service.Run(); err != nil { log.Fatal(err) } } -
Run the service:
go run main.go
Competitor Comparisons
A standard library for microservices.
Pros of kit
- More flexible and modular architecture, allowing developers to pick and choose components
- Extensive documentation and examples for various use cases
- Strong focus on observability with built-in support for metrics, tracing, and logging
Cons of kit
- Steeper learning curve due to its flexibility and numerous concepts
- Requires more boilerplate code to set up services
- Less opinionated, which may lead to inconsistencies across projects
Code Comparison
kit example:
func main() {
svc := service.New(myService{})
endpoints := endpoint.New(svc)
http.ListenAndServe(":8080", endpoints)
}
go-micro example:
func main() {
service := micro.NewService(micro.Name("my.service"))
service.Init()
micro.RegisterHandler(service.Server(), new(Handler))
service.Run()
}
The kit example shows a more explicit setup process, while go-micro provides a more streamlined approach with built-in service discovery and registration. go-micro offers a higher level of abstraction, making it easier to get started but potentially less flexible for complex scenarios. kit's modular design allows for more customization but requires more setup code.
The Go language implementation of gRPC. HTTP/2 based RPC
Pros of grpc-go
- More widely adopted and battle-tested in production environments
- Extensive documentation and community support
- Highly performant with efficient binary serialization
Cons of grpc-go
- Steeper learning curve, especially for developers new to gRPC
- Requires more boilerplate code for setup and configuration
- Limited to gRPC-specific communication patterns
Code Comparison
grpc-go:
s := grpc.NewServer()
pb.RegisterGreeterServer(s, &server{})
lis, err := net.Listen("tcp", ":50051")
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
if err := s.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
}
go-micro:
service := micro.NewService(
micro.Name("greeter"),
)
service.Init()
pb.RegisterGreeterHandler(service.Server(), &Greeter{})
if err := service.Run(); err != nil {
fmt.Println(err)
}
Summary
grpc-go is a robust, high-performance gRPC implementation with extensive community support, while go-micro offers a more abstracted, microservices-oriented framework. grpc-go excels in raw performance and gRPC-specific features, whereas go-micro provides a more flexible, plugin-based architecture for building microservices with various communication protocols.
Gin is a high-performance HTTP web framework written in Go. It provides a Martini-like API but with significantly better performance—up to 40 times faster—thanks to httprouter. Gin is designed for building REST APIs, web applications, and microservices.
Pros of gin
- Lightweight and fast HTTP web framework
- Simple and intuitive API for building web applications
- Extensive middleware support for easy customization
Cons of gin
- Limited to HTTP-based applications
- Lacks built-in support for microservices architecture
- Requires additional libraries for advanced features like service discovery
Code Comparison
gin example:
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "pong"})
})
r.Run()
go-micro example:
service := micro.NewService(micro.Name("greeter"))
service.Init()
proto.RegisterGreeterHandler(service.Server(), new(Greeter))
service.Run()
Summary
gin is a lightweight HTTP web framework focused on simplicity and performance, while go-micro is a more comprehensive framework for building microservices. gin excels in creating HTTP-based applications quickly, but lacks built-in microservices features. go-micro provides a complete toolkit for microservices development, including service discovery and message encoding, but may be overkill for simple web applications. Choose gin for straightforward web projects and go-micro for complex, distributed systems.
High performance, minimalist Go web framework
Pros of Echo
- Lightweight and minimalist web framework, focusing on HTTP routing and middleware
- Excellent performance and low memory footprint
- Simple and intuitive API, making it easy to learn and use
Cons of Echo
- Limited built-in features compared to full-stack microservices frameworks
- Less suitable for complex distributed systems and microservices architectures
- Smaller ecosystem and fewer plugins/extensions available
Code Comparison
Echo:
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
go-micro:
service := micro.NewService(
micro.Name("helloworld"),
)
service.Init()
proto.RegisterGreeterHandler(service.Server(), new(Greeter))
if err := service.Run(); err != nil {
fmt.Println(err)
}
Key Differences
- Echo is primarily a web framework, while go-micro is a microservices framework
- go-micro provides more built-in features for distributed systems, such as service discovery and load balancing
- Echo focuses on HTTP routing and middleware, while go-micro offers a broader range of communication protocols
- go-micro has a steeper learning curve but offers more scalability for complex microservices architectures
- Echo is better suited for simpler web applications or APIs, while go-micro excels in distributed systems
Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
Pros of gorilla/mux
- Lightweight and focused solely on HTTP routing
- Easy to learn and use, with a straightforward API
- Highly flexible and customizable for specific routing needs
Cons of gorilla/mux
- Limited to HTTP routing, lacking built-in support for microservices architecture
- Requires additional libraries for more complex features like service discovery or load balancing
Code Comparison
gorilla/mux:
r := mux.NewRouter()
r.HandleFunc("/api/{key}", ApiHandler)
r.HandleFunc("/", HomeHandler)
http.ListenAndServe(":8080", r)
go-micro:
service := micro.NewService(
micro.Name("my.service"),
)
service.Init()
proto.RegisterGreeterHandler(service.Server(), new(Greeter))
service.Run()
Key Differences
- go-micro is a comprehensive microservices framework, while gorilla/mux focuses on HTTP routing
- go-micro provides built-in support for service discovery, load balancing, and message encoding
- gorilla/mux offers more granular control over HTTP routing and middleware
- go-micro is better suited for complex, distributed systems, while gorilla/mux excels in simpler web applications
Use Cases
- Choose gorilla/mux for straightforward web applications or APIs with custom routing requirements
- Opt for go-micro when building a microservices-based architecture with multiple interconnected services
⚡️ Express inspired web framework written in Go
Pros of Fiber
- Extremely fast and lightweight web framework
- Express-inspired API, making it easy for Node.js developers to transition
- Built-in support for WebSocket, middleware, and static file serving
Cons of Fiber
- Focused primarily on HTTP services, less suitable for complex microservices architectures
- Smaller ecosystem and community compared to Go-Micro
- Limited built-in support for service discovery and load balancing
Code Comparison
Fiber example:
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})
app.Listen(":3000")
Go-Micro example:
service := micro.NewService(
micro.Name("helloworld"),
)
service.Init()
proto.RegisterGreeterHandler(service.Server(), new(Greeter))
service.Run()
Go-Micro is more focused on building microservices with features like service discovery and message encoding, while Fiber is a lightweight web framework optimized for HTTP services. Go-Micro provides a more comprehensive toolkit for distributed systems, whereas Fiber excels in simplicity and performance for web applications. The choice between them depends on the specific requirements of your project.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Go Micro

Go Micro is a framework for distributed systems development.
ð Documentation | Sponsored by Anthropic
Overview
Go Micro provides the core requirements for distributed systems development including RPC and Event driven communication. The Go Micro philosophy is sane defaults with a pluggable architecture. We provide defaults to get you started quickly but everything can be easily swapped out.
Features
Go Micro abstracts away the details of distributed systems. Here are the main features.
-
Authentication - Auth is built in as a first class citizen. Authentication and authorization enable secure zero trust networking by providing every service an identity and certificates. This additionally includes rule based access control.
-
Dynamic Config - Load and hot reload dynamic config from anywhere. The config interface provides a way to load application level config from any source such as env vars, file, etcd. You can merge the sources and even define fallbacks.
-
Data Storage - A simple data store interface to read, write and delete records. It includes support for many storage backends in the plugins repo. State and persistence becomes a core requirement beyond prototyping and Micro looks to build that into the framework.
-
Data Model - A typed data model layer with CRUD operations, queries, and multiple backends (memory, SQLite, Postgres). Define Go structs with tags and get type-safe Create/Read/Update/Delete/List/Count operations. Accessible via
service.Model()alongsideservice.Client()andservice.Server()for a complete service experience: call services, handle requests, save and query data. -
Service Discovery - Automatic service registration and name resolution. Service discovery is at the core of micro service development. When service A needs to speak to service B it needs the location of that service. The default discovery mechanism is multicast DNS (mdns), a zeroconf system.
-
Load Balancing - Client side load balancing built on service discovery. Once we have the addresses of any number of instances of a service we now need a way to decide which node to route to. We use random hashed load balancing to provide even distribution across the services and retry a different node if there's a problem.
-
Message Encoding - Dynamic message encoding based on content-type. The client and server will use codecs along with content-type to seamlessly encode and decode Go types for you. Any variety of messages could be encoded and sent from different clients. The client and server handle this by default. This includes protobuf and json by default.
-
RPC Client/Server - RPC based request/response with support for bidirectional streaming. We provide an abstraction for synchronous communication. A request made to a service will be automatically resolved, load balanced, dialled and streamed.
-
Async Messaging - PubSub is built in as a first class citizen for asynchronous communication and event driven architectures. Event notifications are a core pattern in micro service development. The default messaging system is a HTTP event message broker.
-
MCP Integration - An MCP gateway you can integrate as a library, server or CLI command which automatically exposes services as tools for agents or other AI applications. Every service/endpoint get's converted into a callable tool.
-
Multi-Service Binaries - Run multiple services in a single process with isolated state per service. Start as a modular monolith, split into separate deployments when you need independent scaling. Each service gets its own server, client, and store while sharing the registry and broker for inter-service communication.
-
Pluggable Interfaces - Go Micro makes use of Go interfaces for each distributed system abstraction. Because of this these interfaces are pluggable and allows Go Micro to be runtime agnostic. You can plugin any underlying technology.
Getting Started
To make use of Go Micro
go get go-micro.dev/v5@v5.16.0
Create a service and register a handler
package main
import (
"go-micro.dev/v5"
)
type Request struct {
Name string `json:"name"`
}
type Response struct {
Message string `json:"message"`
}
type Say struct{}
func (h *Say) Hello(ctx context.Context, req *Request, rsp *Response) error {
rsp.Message = "Hello " + req.Name
return nil
}
func main() {
// create the service
service := micro.New("helloworld")
// register handler
service.Handle(new(Say))
// run the service
service.Run()
}
Set a fixed address
service := micro.New("helloworld", micro.Address(":8080"))
Call it via curl
curl -XPOST \
-H 'Content-Type: application/json' \
-H 'Micro-Endpoint: Say.Hello' \
-d '{"name": "alice"}' \
http://localhost:8080
MCP & AI Agents
Go Micro is designed for an agent-first workflow. Every service you build automatically becomes a tool that AI agents can discover and use via the Model Context Protocol (MCP).
- ð¤ Agent Playground â Chat with your services through an interactive AI agent at
/agent - ð§ MCP Tools Registry â Browse all services exposed as AI-callable tools at
/api/mcp/tools - ð MCP Documentation â Full guide to MCP integration, auth, and scopes
Services as Tools
Write a normal Go Micro service and it's instantly available as an MCP tool:
// SayHello greets a person by name.
// @example {"name": "Alice"}
func (g *GreeterService) SayHello(ctx context.Context, req *HelloRequest, rsp *HelloResponse) error {
rsp.Message = "Hello " + req.Name
return nil
}
Run with micro run and the agent playground and MCP tools registry are ready:
micro run
# Agent Playground: http://localhost:8080/agent
# MCP Tools: http://localhost:8080/api/mcp/tools
Use micro mcp serve for local AI tools like Claude Code, or connect any MCP-compatible agent to the HTTP endpoint.
See the MCP guide for authentication, scopes, and advanced usage.
Multi-Service Binaries
Run multiple services in a single binary â start as a modular monolith, split into separate deployments later when you actually need to.
users := micro.New("users", micro.Address(":9001"))
orders := micro.New("orders", micro.Address(":9002"))
users.Handle(new(Users))
orders.Handle(new(Orders))
// Run all services together with shared lifecycle
g := micro.NewGroup(users, orders)
g.Run()
Each service gets its own server, client, store, and cache while sharing the registry, broker, and transport â so they can discover and call each other within the same process.
See the multi-service example for a working demo.
Data Model
Go Micro includes a typed data model layer for persistence. Define a struct, tag a key field, and get type-safe CRUD and query operations backed by memory, SQLite, or Postgres.
import (
"go-micro.dev/v5/model"
"go-micro.dev/v5/model/sqlite"
)
// Define your data type
type User struct {
ID string `json:"id" model:"key"`
Name string `json:"name"`
Email string `json:"email" model:"index"`
Age int `json:"age"`
}
Register your types and use the model:
service := micro.New("users")
// Register and use the service's model backend
db := service.Model()
db.Register(&User{})
// CRUD operations
db.Create(ctx, &User{ID: "1", Name: "Alice", Email: "alice@example.com", Age: 30})
user := &User{}
db.Read(ctx, "1", user)
user.Name = "Alice Smith"
db.Update(ctx, user)
db.Delete(ctx, "1", &User{})
Query with filters, ordering, and pagination:
var results []*User
// Find users by field
db.List(ctx, &results, model.Where("email", "alice@example.com"))
// Complex queries
db.List(ctx, &results,
model.WhereOp("age", ">=", 18),
model.OrderDesc("name"),
model.Limit(10),
model.Offset(20),
)
count, _ := users.Count(ctx, model.Where("age", 30))
Swap backends with an option:
// Development: in-memory (default)
service := micro.New("users")
// Production: SQLite or Postgres
db, _ := sqlite.New(model.WithDSN("file:app.db"))
service := micro.New("users", micro.Model(db))
Every service gets Client(), Server(), and Model() â call services, handle requests, and save data all from the same interface.
Examples
Check out /examples for runnable code:
- hello-world - Basic RPC service
- web-service - HTTP REST API
- multi-service - Multiple services in one binary
- mcp - MCP integration with AI agents
See all examples for more.
Protobuf
Install the code generator and see usage in the docs:
go install go-micro.dev/v5/cmd/protoc-gen-micro@v5.16.0
Note: Use a specific version instead of
@latestto avoid module path conflicts. See releases for the latest version.
Docs: internal/website/docs/getting-started.md
Command Line
Install the CLI:
go install go-micro.dev/v5/cmd/micro@v5.16.0
Note: Use a specific version instead of
@latestto avoid module path conflicts. See releases for the latest version.
Quick Start
micro new helloworld # Create a new service
cd helloworld
micro run # Run with API gateway and hot reload
Then open http://localhost:8080 to see your service and call it from the browser.
Development Workflow
| Stage | Command | Purpose |
|---|---|---|
| Develop | micro run | Local dev with hot reload and API gateway |
| Build | micro build | Compile production binaries |
| Deploy | micro deploy | Push to a remote Linux server via SSH + systemd |
| Dashboard | micro server | Optional production web UI with JWT auth |
micro run
micro run starts your services with:
- Web Dashboard - Browse and call services at
/ - Agent Playground - AI chat with MCP tools at
/agent - API Explorer - Browse endpoints and schemas at
/api - API Gateway - HTTP to RPC proxy at
/api/{service}/{method}(no auth in dev mode) - MCP Tools - Services as AI tools at
/api/mcp/tools - Health Checks - Aggregated health at
/health - Hot Reload - Auto-rebuild on file changes
Note:
micro runandmicro serveruse a unified gateway architecture. See Gateway Architecture for details.
micro run # Gateway on :8080
micro run --address :3000 # Custom gateway port
micro run --no-gateway # Services only
micro run --env production # Use production environment
Configuration
For multi-service projects, create a micro.mu file:
service users
path ./users
port 8081
service posts
path ./posts
port 8082
depends users
env development
DATABASE_URL sqlite://./dev.db
The gateway runs on :8080 by default, so services should use other ports.
Deployment
Deploy to any Linux server with systemd:
# On your server (one-time setup)
curl -fsSL https://go-micro.dev/install.sh | sh
sudo micro init --server
# From your laptop
micro deploy user@your-server
The deploy command:
- Builds binaries for Linux
- Copies via SSH to the server
- Sets up systemd services
- Verifies services are healthy
Optionally run micro server on the deployed machine for a production web dashboard with JWT auth, user management, and API explorer.
Manage deployed services:
micro status --remote user@server # Check status
micro logs --remote user@server # View logs
micro logs myservice --remote user@server -f # Follow specific service
No Docker required. No Kubernetes. Just systemd.
See internal/website/docs/deployment.md for full deployment guide.
See cmd/micro/README.md for full CLI documentation.
Docs: internal/website/docs
Package reference: https://pkg.go.dev/go-micro.dev/v5
User Guides:
Architecture & Performance:
Security:
Adopters
- Sourse - Work in the field of earth observation, including embedded Kubernetes running onboard aircraft, and weâve built a mission management SaaS platform using Go Micro.
Top Related Projects
A standard library for microservices.
The Go language implementation of gRPC. HTTP/2 based RPC
Gin is a high-performance HTTP web framework written in Go. It provides a Martini-like API but with significantly better performance—up to 40 times faster—thanks to httprouter. Gin is designed for building REST APIs, web applications, and microservices.
High performance, minimalist Go web framework
Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
⚡️ Express inspired web framework written in Go
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot