{"id":22588505,"url":"https://github.com/danny-yamamoto/go-graphql-federation-example","last_synced_at":"2026-06-20T12:32:47.307Z","repository":{"id":183558948,"uuid":"670162156","full_name":"danny-yamamoto/go-graphql-federation-example","owner":"danny-yamamoto","description":"Implement GraphQL Federation.","archived":false,"fork":false,"pushed_at":"2023-07-27T11:00:59.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T14:43:11.676Z","etag":null,"topics":["bramble","go","gqlgen","graphql"],"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/danny-yamamoto.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":"2023-07-24T12:33:34.000Z","updated_at":"2023-07-26T10:09:13.000Z","dependencies_parsed_at":"2024-06-19T13:30:52.799Z","dependency_job_id":"39bf88ab-1ab4-4e1e-9f0d-8dcac961ea6d","html_url":"https://github.com/danny-yamamoto/go-graphql-federation-example","commit_stats":null,"previous_names":["danny-yamamoto/go-graphql-federation-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danny-yamamoto/go-graphql-federation-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-yamamoto%2Fgo-graphql-federation-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-yamamoto%2Fgo-graphql-federation-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-yamamoto%2Fgo-graphql-federation-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-yamamoto%2Fgo-graphql-federation-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danny-yamamoto","download_url":"https://codeload.github.com/danny-yamamoto/go-graphql-federation-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danny-yamamoto%2Fgo-graphql-federation-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34570535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bramble","go","gqlgen","graphql"],"created_at":"2024-12-08T08:09:44.134Z","updated_at":"2026-06-20T12:32:47.282Z","avatar_url":"https://github.com/danny-yamamoto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-graphql-federation-example\nImplement GraphQL Federation.\n\n```mermaid\nflowchart LR\n    Gateway[\"Gateway\"]\n    Subgraph1[\"Subgraph1\n    users\"]\n    Subgraph2[\"Subgraph2\n    contact\"]\n    Client --\u003e|8082| Gateway --\u003e|4000| Subgraph1\n    Gateway --\u003e|4001| Subgraph2\n```\n\n## Installation\n```bash\ngo install github.com/99designs/gqlgen@latest\ngo get github.com/99designs/gqlgen/graphql/handler\n```\n\n## Add Subgraph\n### Add `Service`\n- `schema.graphqls`\n```graphql\ntype Service {\n  name: String!\n  version: String!\n  schema: String!\n}\n```\n\n### Generate\n```bash\ngqlgen generate\n```\n\n### Add resolver\n\n## Running Subgraph1\n```bash\nvscode ➜ /workspaces/go-graphql-federation-example/users (main) $ go run server.go \n2023/07/25 04:31:12 connect to http://localhost:4000/ for GraphQL playground\n```\n\n```bash\nvscode ➜ /workspaces/go-graphql-federation-example (main) $ curl -X POST -H \"Content-Type: Application/json\" -d '{\"query\":\"{ todos { id } }\"}' http://localhost:4000/query\n{\"data\":{\"todos\":[{\"id\":\"TODO-1\"},{\"id\":\"TODO-2\"}]}}\nvscode ➜ /workspaces/go-graphql-federation-example (main) $ \n```\n\n## Running Gateway\n```bash\ngo install github.com/movio/bramble/cmd/bramble@latest\ntouch config.json\n```\n\n```bash\ncd cmd/bramble/\ngo run main.go -conf ./config.json \n```\n\n## Querying Gateway\n### users | `id` only\n```bash\nvscode ➜ /workspaces/go-graphql-federation-example (main) $ curl -X POST -H \"Content-Type: Application/json\" -d '{\"query\":\"{ todos { id } }\"}' http://localhost:8082/query\n{\"data\":{\"todos\":[{\"id\":\"TODO-1\"},{\"id\":\"TODO-2\"}]}}\nvscode ➜ /workspaces/go-graphql-federation-example (main) $ \n```\n\n### users | `id` and `text`\n```bash\nvscode ➜ /workspaces/go-graphql-federation-example (main) $ curl -X POST -H \"Content-Type: Application/json\" -d '{\"query\":\"{ todos { id text } }\"}' http://localhost:8082/query\n{\"data\":{\"todos\":[{\"id\":\"TODO-1\",\"text\":\"My Todo 1\"},{\"id\":\"TODO-2\",\"text\":\"My Todo 2\"}]}}vscode ➜ /workspaces/go-graphql-federation-example (main) $\n```\n\n### contact \n```bash\nroot ➜ /workspaces/go-graphql-federation-example/contact (main) $ curl -X POST -H \"Content-Type: Application/json\" -d '{\"query\":\"{ contacts { firstname } }\"}' http://localhost:8082/query\n{\"data\":{\"contacts\":[{\"firstname\":\"mirai\"}]}}\nroot ➜ /workspaces/go-graphql-federation-example/contact (main) $ \n```\n\n## Implement your own schema\n### Create directory\n```bash\nmkdir -p contact\ngo mod init github.com/danny-yamamoto/go-graphql-federation-example/contact\ngo get -u github.com/99designs/gqlgen\ngo install github.com/99designs/gqlgen@latest\ngo get github.com/99designs/gqlgen/graphql/handler\n```\n### Add a package directory to go.work\n### Create a schema file\n```bash\ntouch schema.graphqls\ntouch gqlgen.yml\ngqlgen generate\n```\n\n## Reference\n- [GraphQL の基本](https://learn.microsoft.com/ja-jp/azure/developer/javascript/how-to/with-web-app/graphql/static-web-app-graphql/graphql-basics)\n- [Bramble Getting started](https://movio.github.io/bramble/#/getting-started?id=querying-bramble)\n- [Apollo Federation](https://gqlgen.com/recipes/federation/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanny-yamamoto%2Fgo-graphql-federation-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanny-yamamoto%2Fgo-graphql-federation-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanny-yamamoto%2Fgo-graphql-federation-example/lists"}