{"id":46940799,"url":"https://github.com/aristat/golang-example-app","last_synced_at":"2026-03-13T05:02:05.974Z","repository":{"id":40565120,"uuid":"130220325","full_name":"Aristat/golang-example-app","owner":"Aristat","description":"Example application","archived":false,"fork":false,"pushed_at":"2023-07-20T19:04:28.000Z","size":463,"stargazers_count":192,"open_issues_count":1,"forks_count":80,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-14T18:37:34.218Z","etag":null,"topics":["casbin","circleci","cobra","dataloader","docker","example","go","golang","gorm","graphql","grpc","jaeger","mux","nats","protobuf","sql-migrate","viper","wire","zap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aristat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2018-04-19T13:32:28.000Z","updated_at":"2025-11-13T05:04:10.000Z","dependencies_parsed_at":"2024-06-18T21:27:11.994Z","dependency_job_id":"490eab4d-fcff-42a1-9ce2-ead0e09ee22c","html_url":"https://github.com/Aristat/golang-example-app","commit_stats":null,"previous_names":["aristat/golang-oauth2-example-app"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Aristat/golang-example-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aristat%2Fgolang-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aristat%2Fgolang-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aristat%2Fgolang-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aristat%2Fgolang-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aristat","download_url":"https://codeload.github.com/Aristat/golang-example-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aristat%2Fgolang-example-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["casbin","circleci","cobra","dataloader","docker","example","go","golang","gorm","graphql","grpc","jaeger","mux","nats","protobuf","sql-migrate","viper","wire","zap"],"created_at":"2026-03-11T07:00:32.790Z","updated_at":"2026-03-11T07:00:49.362Z","avatar_url":"https://github.com/Aristat.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![golang logo](golang_logo.png)\n\n# Golang Example Application\n\n# Table of Contents\n\n- [Overview](#overview)\n- [Package list](#package-list)\n- [Installing](#installing)\n  * [Local environment](#local-environment)\n  * [Docker environment](#docker-enviroment)\n- [Run services](#run-services)\n  * [Start in local](#start-in-local-machine)\n  * [Start in docker](#start-in-docker)\n- [Getting started](#getting-started)  \n  * [Jaeger](#jaeger)\n  * [Http with gRPC](#http-example-with-grpc)\n  * [Graphql with gRPC](#graphql-example-with-grpc)\n- [Deprecate version](#deprecated-version)  \n- [Testing](#testing)\n\n# Overview\n\nThis is an example golang application.\nCommands list:\n1. Daemon - main service\n2. Product service - service that returns Product, an example of gRPC client/server interaction\n3. Health check service - this service is needed to show how convenient to understand on which of the services an error occurred in jaeger\n4. Migrate - commands for migration\n5. JWT - commands for generate JWT token\n\n# Package list\n\nPackages which use in this example project\n\n1. [sql-migrate](https://github.com/rubenv/sql-migrate) - SQL migrations\n2. [wire](https://github.com/google/wire) - dependency Injection\n3. [viper](https://github.com/spf13/viper) - environment configuration\n4. [cobra](https://github.com/spf13/cobra) - create commands\n5. [cast](https://github.com/spf13/cast) - easy casting from one type to another\n6. [gorm](https://github.com/jinzhu/gorm) - database ORM\n7. [zap](https://github.com/uber-go/zap) - logger\n8. [mux](https://github.com/gorilla/mux) - http router\n9. [nats-streaming](https://github.com/nats-io/stan.go) - NATS Streaming System\n10. [gqlgen](https://github.com/99designs/gqlgen) - graphql server library\n11. [protobuf](https://pkg.go.dev/google.golang.org/protobuf) - Google's data interchange format\n12. [grpc](google.golang.org/grpc) - RPC framework\n13. [opentelemetry](https://github.com/open-telemetry/opentelemetry-go) - OpenTelemetry\n14. [jaeger](https://github.com/uber/jaeger-client-go) - Jaeger Bindings for Go OpenTelemetry API\n15. [casbin](https://github.com/casbin/casbin) - Supports access control\n16. [dataloaden](https://github.com/vektah/dataloaden) - DataLoader for graphql\n17. [nats](https://github.com/nats-io/nats.go) - Golang client for NATS, the cloud native messaging system\n\n# Installing\n\nInstall the Golang and GO environment\n\n```$xslt\nhttps://golang.org/doc/install\n```\n\nInstall [Postgresql](https://www.postgresql.org/download) (if you want to run locally)\n\nClone repository\n\n```$xslt\ngit clone git@github.com:Aristat/golang-example-app.git (go get)\n```\n\n## Local environment\n\nInstall Golang packages without modules\n\n```$xslt\nmake install\n```\n\nInstall database\n\n```$xslt\nmake createdb\n```\n\nSql migrations\n\n```$xslt\nsql-migrate up\n```\n\nInstall Golang dependencies\n\n```$xslt\nmake dependencies\n```\n\nGenerate artifacts(binary files and configs)\n\n```$xslt\nmake build\n```\n\nPackages for proto generator\n\n```$xslt\nhttps://grpc.io/docs/languages/go/quickstart/#prerequisites\n```\n\nSet APP_WD if you start to use html templates or path to ssh keys or run `make test`\n\n```$xslt\nexport APP_WD=go_path to project_path/resources or project_path/artifacts\n```\n\n## Docker environment\n\nGenerate docker image\n\n```$xslt\nDOCKER_IMAGE=golang-example-app TAG=development make docker-image\n```\n\n# Run services\n\n## Start in local machine\n\nUp jaeger in docker-compose or disable Jaeger(and rebuild binary file) in `resources/configs/*.yaml`\n\n```$xslt\ndocker-compose up jaeger\n```\n\nStart daemon (main service)\n\n```$xslt\nmake start\n```\n\nor\n\n```$xslt\n./artifacts/bin daemon -c ./artifacts/configs/development.yaml -d\n```\n\nStart product service \n\n```$xslt\n./artifacts/bin product-service -c ./artifacts/configs/development.yaml -d\n```\n\nStart health-check service\n\n```$xslt\n./artifacts/bin health-check -c ./artifacts/configs/development.yaml -d\n```\n\n## Start in docker\n\n#### Run this commands\n```$xslt\ndocker-compose rm # Remove previous containers\nREMOVE_CONTAINERS=on DOCKER_IMAGE=golang-example-app TAG=development make docker-image # Generate new docker image\ndocker-compose up\n```\n\n#### or run script\n\n```$xslt\n./scripts/docker-compose-start.sh\n```\n\n# Getting Started\n\n## Jaeger\n\n```$xslt\nhttp://localhost:16686\n```\n\n## Http example with gRPC\n\n```$xslt\nhttp://localhost:9096/products_grpc\n```\n\n## Http example with Nats Streaming\n\n```$xslt\nhttp://localhost:9096/products_nats\n```\n\n## Http example with graceful shutdown(long request, you can check the server shutdown)\n\n```$xslt\nhttp://localhost:9096/products_slowly\n```\n\n## Graphql example with gRPC\n\nGraphql [client](https://github.com/prisma-labs/graphql-playground) for testing. End-point `http://localhost:9096/query`.\n\nGenerate JWT for Graphql authorization\n\n```$xslt\n./artifacts/bin jwt token --key='./artifacts/keys/local/private_key.pem' --fields='{\"sub\": \"owner\", \"iss\": \"test-service\"}'\n```\n\nSet JWT token in headers\n\n```$xslt\n{\n  \"Authorization\": \"bearer token\"\n}\n```\n\nExample query\n\n```\nquery oneUser {\n  users {\n    one(email: \"test@gmail.com\") {\n      email\n      id\n    }\n  }\n}\n```\n\nExample query with data loader\n\n```\nquery allProducts {\n  products {\n    list {\n      products {\n        id\n        productItems {\n          id\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nExample mutation\n\n```\nmutation createUser {\n  users {\n    createUser(email: \"test1@gmail.com\", password: \"123456789\") {\n      id\n      email\n    }\n  }\n}\n```\n\n# Testing\n```\n➜  make test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faristat%2Fgolang-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faristat%2Fgolang-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faristat%2Fgolang-example-app/lists"}