{"id":13769809,"url":"https://github.com/graph-quilt/graphql-orchestrator-java","last_synced_at":"2025-04-05T22:08:09.369Z","repository":{"id":37603675,"uuid":"376136959","full_name":"graph-quilt/graphql-orchestrator-java","owner":"graph-quilt","description":"GraphQL Orchestrator stitches the schemas from multiple micro-services and orchestrates the graphql queries to these services accurately at runtime","archived":false,"fork":false,"pushed_at":"2025-01-29T07:15:28.000Z","size":2678,"stargazers_count":71,"open_issues_count":14,"forks_count":31,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T21:06:37.488Z","etag":null,"topics":["federation","gateway","graphql","graphql-gateway","graphql-java","graphql-server","hacktoberfest","hacktoberfest2023","orchestrator","stitching"],"latest_commit_sha":null,"homepage":"https://graph-quilt.github.io","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graph-quilt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-11T20:35:18.000Z","updated_at":"2025-03-24T08:09:33.000Z","dependencies_parsed_at":"2023-11-14T19:29:45.719Z","dependency_job_id":"96aae872-4de3-443e-b0a4-962077d06eb7","html_url":"https://github.com/graph-quilt/graphql-orchestrator-java","commit_stats":{"total_commits":455,"total_committers":23,"mean_commits":"19.782608695652176","dds":0.7648351648351648,"last_synced_commit":"6cd0eb65fdfe6bd9cef86c3b653205d1db0bb251"},"previous_names":["intuit/graphql-orchestrator-java"],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graph-quilt%2Fgraphql-orchestrator-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graph-quilt%2Fgraphql-orchestrator-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graph-quilt%2Fgraphql-orchestrator-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graph-quilt%2Fgraphql-orchestrator-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graph-quilt","download_url":"https://codeload.github.com/graph-quilt/graphql-orchestrator-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406090,"owners_count":20933803,"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":["federation","gateway","graphql","graphql-gateway","graphql-java","graphql-server","hacktoberfest","hacktoberfest2023","orchestrator","stitching"],"created_at":"2024-08-03T17:00:31.739Z","updated_at":"2025-04-05T22:08:09.330Z","avatar_url":"https://github.com/graph-quilt.png","language":"Groovy","readme":"\u003cdiv align=\"center\"\u003e\n\n  ![graphql-orchestrator-java](./logo.png)\n\n\u003c/div\u003e\n\nA powerful Java library for aggregating and executing GraphQL operations from multiple microservices using a single unified schema.\n\n![Master Build](https://github.com/graph-quilt/graphql-orchestrator-java/actions/workflows/main.yml/badge.svg)\n[Builds](https://circleci.com/gh/graph-quilt/graphql-orchestrator-java)\n\n### Introduction\n\n**graphql-orchestrator-java** simplifies the process of accessing data from various GraphQL microservices by providing a unified GraphQL schema. \nThis enables you to query multiple microservices through a single endpoint, reducing complexity and improving performance.\n\nThe library supports two strategies to aggregate and combine the schemas from multiple microservices\n* Schema Stitching with [a recursive strategy](https://graph-quilt.github.io/docs/merging-types/)\n* [Apollo Federation Style](https://netflix.github.io/dgs/federation/) Schema Composition. (_Currently, it supports `@key, @requires, @extends, and @external` directives)\n\nAt query execution time, it orchestrates the GraphQL queries to the appropriate micro-services, using the popular [graphql-java](https://github.com/graphql-java/graphql-java) \nlibrary as the execution engine.\n\n### Features \n\n* [Apollo Federation Style Schema Composition](https://netflix.github.io/dgs/federation/)\n* [Recursive Stitching](https://graph-quilt.github.io/docs/merging-types/)\n* [Query Batching](https://graph-quilt.github.io/docs/graphql-query-execution/)\n* [Type Conflict Resolution Strategy](https://graph-quilt.github.io/docs/conflict-resolution/)\n* [Pluggable `graphql-java` Instrumentation](https://github.com/graph-quilt/graphql-authorization-java)\n\n\n## Getting Started\n\n### Dependency\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.intuit.graphql\u003c/groupId\u003e\n    \u003cartifactId\u003egraphql-orchestrator-java\u003c/artifactId\u003e\n    \u003cversion\u003e${graphql.orchestrator.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Usage in code\n\n* Implement the ServiceProvider interface. You will need a new instance for each GraphQL Service.\n\nConsider the following 2 service providers below\n\n```java\nclass PersonNameService implements ServiceProvider {\n\n  public static final String schema = \n        \"type Query { person: Person } \" \n      + \"type Person { firstName : String lastName: String }\";\n  \n  @Override\n  public String getNameSpace() { return \"PERSON_NAME\"; }\n\n  @Override\n  public Map\u003cString, String\u003e sdlFiles() { return ImmutableMap.of(\"schema.graphqls\", schema); }\n\n  @Override\n  public CompletableFuture\u003cMap\u003cString, Object\u003e\u003e query(final ExecutionInput executionInput, \n      final GraphQLContext context) {\n    //{'data':{'person':{'firstName':'GraphQL Orchestrator', 'lastName': 'Java'}}}\"\n    Map\u003cString, Object\u003e data = ImmutableMap\n        .of(\"data\", ImmutableMap.of(\"person\", ImmutableMap.of(\"firstName\", \"GraphQL Orchestrator\", \"lastName\", \"Java\")));\n    return CompletableFuture.completedFuture(data);\n  }\n}\n```\n\n```java\nclass PersonAddressService implements ServiceProvider {\n\n  public static final String schema = \n        \"type Query { person: Person }\"\n      + \"type Person { address : Address }\"\n      + \"type Address { city: String state: String zip: String}\";\n\n  @Override\n  public String getNameSpace() { return \"PERSON_ADDRESS\";}\n\n  @Override\n  public Map\u003cString, String\u003e sdlFiles() { return ImmutableMap.of(\"schema.graphqls\", schema);}\n\n  @Override\n  public CompletableFuture\u003cMap\u003cString, Object\u003e\u003e query(final ExecutionInput executionInput,\n      final GraphQLContext context) {\n    //{'data':{'person':{'address':{ 'city' 'San Diego', 'state': 'CA', 'zip': '92129' }}}}\"\n    Map\u003cString, Object\u003e data = ImmutableMap\n        .of(\"data\", ImmutableMap.of(\"person\", ImmutableMap.of(\"address\", ImmutableMap.of(\"city\",\"San Diego\", \"state\",\"CA\", \"zip\",\"92129\"))));\n    return CompletableFuture.completedFuture(data);\n  }\n}\n```\n\n* Create an instance of Orchestrator and execute the query as below.\n```java\n\n    // create a runtimeGraph by stitching service providers\n    RuntimeGraph runtimeGraph = SchemaStitcher.newBuilder()\n        .service(new PersonNameService())   \n        .service(new PersonAddressService())  \n        .build()\n        .stitchGraph();\n\n    // pass the runtime graph to GraphQLOrchestrator\n    GraphQLOrchestrator graphQLOrchestrator = GraphQLOrchestrator.newOrchestrator()\n        .runtimeGraph(runtimeGraph).build();\n    \n    //Execute the query \n    CompletableFuture\u003cExecutionResult\u003e execute = graphQLOrchestrator\n        .execute(\n            ExecutionInput.newExecutionInput()\n              .query(\"query {person {firstName lastName address {city state zip}}}\")\n              .build()\n        );\n\n    ExecutionResult executionResult = execute.get();\n    System.out.println(executionResult.getData().toString());\n    // Output: \n   // {person={firstName=GraphQL Orchestrator, lastName=Java, address={city=San Diego, state=CA, zip=92129}}}\n```\n------------------------------\nThe Orchestrator uses a recursive algorithm to combine the schemas from multiple services and generate the following unified schema.\n\n```graphql\ntype Query {\n    person: Person \n}\n\ntype Person { \n    firstName: String  \n    lastName: String\n    address: Address\n} \n\ntype Address { \n    city: String \n    state: String \n    zip: String\n}\n```\n\n### Graph Quilt Gateway\n\n[Graph Quilt Gateway](https://github.com/graph-quilt/graphql-gateway-java) is a SpringBoot application that uses the graphql-orchestrator-java.\n\n### Documentation\n\nDetailed [Documentation](https://graph-quilt.github.io/graphql-orchestrator-java/) can be found here\n\n### Contributing\nIf you are interested in contributing to this project, please read the [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for details on our code of conduct, and the process for submitting pull requests to us.\n\n### License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n### Acknowledgments\n- Thanks to the contributors of the [graphql-java](https://github.com/graphql-java/graphql-java) library.\n- Thanks to the contributors of this project for their hard work and dedication.\n\n","funding_links":[],"categories":["Implementations","Schema Libraries"],"sub_categories":["Java","Schema First"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraph-quilt%2Fgraphql-orchestrator-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraph-quilt%2Fgraphql-orchestrator-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraph-quilt%2Fgraphql-orchestrator-java/lists"}