{"id":13416888,"url":"https://github.com/harlow/go-micro-services","last_synced_at":"2025-05-15T10:07:02.352Z","repository":{"id":25686041,"uuid":"29122050","full_name":"harlow/go-micro-services","owner":"harlow","description":"HTTP up front, Protobufs in the rear","archived":false,"fork":false,"pushed_at":"2023-12-15T00:30:52.000Z","size":14472,"stargazers_count":1085,"open_issues_count":0,"forks_count":165,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-14T16:57:12.571Z","etag":null,"topics":["consul","go","golang","grpc","jaeger","microservice","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"debois/elm-mdl","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harlow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-01-12T06:31:38.000Z","updated_at":"2025-03-18T07:32:14.000Z","dependencies_parsed_at":"2023-01-14T03:07:16.963Z","dependency_job_id":"f7c4ec6c-5981-49b0-beca-f57b3df69104","html_url":"https://github.com/harlow/go-micro-services","commit_stats":{"total_commits":238,"total_committers":9,"mean_commits":"26.444444444444443","dds":"0.13025210084033612","last_synced_commit":"7afd2b8d5f92a2d45c345b615320862dcbf3717a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harlow%2Fgo-micro-services","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harlow%2Fgo-micro-services/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harlow%2Fgo-micro-services/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harlow%2Fgo-micro-services/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harlow","download_url":"https://codeload.github.com/harlow/go-micro-services/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319720,"owners_count":22051073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consul","go","golang","grpc","jaeger","microservice","protobuf"],"created_at":"2024-07-30T22:00:28.364Z","updated_at":"2025-05-15T10:06:57.341Z","avatar_url":"https://github.com/harlow.png","language":"Go","funding_links":[],"categories":["Go Microservices repos","Resources","Repositories","Go","protobuf"],"sub_categories":["Examples"],"readme":"# Golang Microservices Example\n\nA demonstration of Golang micro-services that expose a HTTP/JSON frontend and then\nleverages [gRPC][1] for inter-service communication.\n\n* Services written in Golang\n* gRPC for inter-service communication\n* Jaeger for request tracing\n\nThe example application plots Hotel locations on a Google map:\n\n\u003cimg width=\"865\" alt=\"screen shot 2016-11-07 at 9 31 12 pm\" src=\"https://cloud.githubusercontent.com/assets/739782/20087958/de0ef9b4-a531-11e6-953a-4425fe445883.png\"\u003e\n\nThe web page makes an HTTP request to the API Endpoint which in turn spawns a number of RPC requests to the backend services.\n\nData for each of the services is stored in JSON flat files under the `data/` directory. In reality each of the services could choose their own specialty datastore. The Geo service for example could use PostGis or any other database specializing in geospacial queries.\n\n## Installation\n\n### Setup\n\nDocker is required for running the services https://docs.docker.com/engine/installation.\n\nProtobuf v3 are required:\n\n    $ brew install protobuf\n\nInstall the protoc-gen libraries:\n\n    $ go get -u github.com/golang/protobuf/{proto,protoc-gen-go}\n\nClone the repository:\n\n    $ git clone git@github.com:harlow/go-micro-services.git\n\n### Run\n\nTo make the demo as straigforward as possible; [Docker Compose](https://docs.docker.com/compose/) is used to run all the services at once (In a production environment each of the services would be run (and scaled) independently).\n\n    $ make run\n\nVist the web page in a browser:\n\n[http://localhost:5000/](http://localhost:5000/)\n\ncURL the API endpoint and receive GeoJSON response:\n\n    $ curl \"http://localhost:5000/hotels?inDate=2015-04-09\u0026outDate=2015-04-10\"\n\nThe JSON response:\n\n```json\n{\n\t\"type\": \"FeatureCollection\",\n\t\"features\": [{\n\t\t\"id\": \"5\",\n\t\t\"type\": \"Feature\",\n\t\t\"properties\": {\n\t\t\t\"name\": \"Phoenix Hotel\",\n\t\t\t\"phone_number\": \"(415) 776-1380\"\n\t\t},\n\t\t\"geometry\": {\n\t\t\t\"type\": \"Point\",\n\t\t\t\"coordinates\": [-122.4181, 37.7831]\n\t\t}\n\t}, {\n\t\t\"id\": \"3\",\n\t\t\"type\": \"Feature\",\n\t\t\"properties\": {\n\t\t\t\"name\": \"Hotel Zetta\",\n\t\t\t\"phone_number\": \"(415) 543-8555\"\n\t\t},\n\t\t\"geometry\": {\n\t\t\t\"type\": \"Point\",\n\t\t\t\"coordinates\": [-122.4071, 37.7834]\n\t\t}\n\t}]\n}\n```\n\n## Request Tracing\n\nThe [Jaeger Tracing](https://github.com/jaegertracing/jaeger) project is used for tracing inter-service requests. The `tracing` package is used initialize a new service tracer:\n\n```go\ntracer, err := tracing.Init(\"serviceName\", jaegeraddr)\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"%v\\n\", err)\n    os.Exit(1)\n}\n```\n\n\u003cimg width=\"1129\" alt=\"jaeger tracing example\" src=\"https://user-images.githubusercontent.com/739782/37546077-554cb6a2-29bf-11e8-9bc8-3de2a01d0d69.png\"\u003e\n\nView dashboard: http://localhost:16686/search\n\n\n### Protobufs\n\nIf changes are made to the Protocol Buffer files use the Makefile to regenerate:\n\n    $ make proto\n\n### Bindata\n\nThe example app data is stored in flat files in the `/data` directory. When any of\nthe data files are manually editied the bindata must be regenerated.\n\nInstall the go-bindata libraries:\n\n    $ go get -u github.com/go-bindata/go-bindata/...\n\nIf changes are made to any of the raw JSON data files use the Makefile to regenerate:\n\n    $ make data\n\n## Credits\n\nThanks to all the [contributors][6]. This codebase was heavily inspired by the following talks and repositories:\n\n* [Scaling microservices in Go][3]\n* [gRPC Example Service][4]\n* [go-kit][5]\n\n[1]: http://www.grpc.io/\n[2]: https://github.com/docker/compose/issues/3560\n[3]: https://speakerdeck.com/mattheath/scaling-microservices-in-go-high-load-strategy-2015\n[4]: https://github.com/grpc/grpc-go/tree/master/examples/route_guide\n[5]: https://github.com/go-kit/kit\n[6]: https://github.com/harlow/go-micro-services/graphs/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharlow%2Fgo-micro-services","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharlow%2Fgo-micro-services","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharlow%2Fgo-micro-services/lists"}