Skip to content
How-to examples of micro usage
Branch: master
Clone or download
asim Merge pull request #56 from swedishborgie/master
Regenerated graphql code with gqlgen.
Latest commit 0550a7b Mar 22, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
api Fix: Init() before Run() in /api/proxy/proxy.go Mar 2, 2019
client update client wrapper Jan 25, 2019
config add go config example Jul 7, 2018
event Update readmes to remove consul Jan 15, 2019
form update readme for form example Feb 4, 2019
function Update docs for micro call Feb 25, 2019
getip update getip readme Nov 15, 2018
graceful move graceful to waitgroup, add graceful as server.Wait Jul 20, 2017
greeter Regenerated graphql code with gqlgen since 99designs/gqlgen@5c8b1e2 r… Mar 21, 2019
grpc Remove dead link to sidecar example Mar 18, 2019
heartbeat add heartbeating example Oct 5, 2017
helloworld Update docs for micro call Feb 25, 2019
noproto Update readmes to remove consul Jan 15, 2019
plugins add url path prefix example Feb 17, 2017
pubsub Update readmes to remove consul Jan 15, 2019
redirect update for proto changes Mar 24, 2018
secure protoc-gen-micro was updated Apr 25, 2018
server Update readmes to remove consul Jan 15, 2019
service Update readmes to remove consul Jan 15, 2019
sharding Update readmes to remove consul Jan 15, 2019
waitgroup update for proto changes Mar 24, 2018
go.sum Add go mod Jan 30, 2019

Micro Examples Travis CI Go Report Card

This is a repository for micro examples. Feel free to contribute.


Most likely needed examples

  • service - A sample micro service
  • greeter - A complete greeter example
  • booking - A demo end to end application


  • api - Provides API usage examples
  • booking - A demo application
  • broker - A example of using Broker for Publish and Subscribing.
  • client - Usage of the Client package to call a service.
  • command - An example of bot commands as micro services
  • config - Using Go Config for dynamic config
  • event - Using the API Gateway event handler
  • filter - Filter nodes of a service when requesting
  • flags - Using command line flags with a service
  • form - How to parse a form behind the micro api
  • function - Example of using Function programming model
  • getip - Get the local and remote ip from metadata
  • graceful - Demonstrates graceful shutdown of a service
  • greeter - A complete greeter example (includes python, ruby examples)
  • heartbeat - Make services heartbeat with discovery for high availability
  • helloworld - Hello world using micro
  • metadata - Extracting metadata from context of a request
  • mocking - Demonstrate mocking helloworld service
  • noproto - Use micro without protobuf or code generation, only go types
  • options - Setting options in the go-micro framework
  • plugins - How to use plugins
  • pubsub - Example of using pubsub at the client/server level
  • grpc - Examples of how to use go-grpc
  • redirect - An example of how to http redirect using an API service
  • roundrobin - A stateful client wrapper for true round robin of requests
  • secure - Demonstrates use of transport secure option for self signed certs
  • server - Use of the Server package directly to server requests.
  • service - Example of the top level Service in go-micro.
  • sharding - An example of how to shard requests or use session affinity
  • shutdown - Demonstrates graceful shutdown via context cancellation
  • stream - An example of a streaming service and client
  • template - Api, web and srv service templates generated with the 'micro new' command
  • waitgroup - Demonstrates how to use a waitgroup with a service
  • wrapper - A simple example of using a log wrapper


Find contributions from the community via the explorer

  • go-shopping - A sample product with a suite of services
  • shippy - A multi app demo and tutorial
  • microhq - A place for micro services


Service Discovery

All services require service discovery. The default is multicast DNS, a zeroconf system.

If you need something multi-host or more resilient use consul.


# install
brew install consul

# run
consul agent -dev

Use flag --registry=consul to enable the consul registry.


Protobuf is used for code generation of message types and client/hander stubs.

If making changes recompile the protos.


Install protoc for your environment. Then:

go get{proto,protoc-gen-go}
go get

Compile Proto

protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. path/to/proto

Chinese language version

Our examples also has Chinese language version, see Chinese

You can’t perform that action at this time.