{"id":26533608,"url":"https://github.com/graphql-hive/federation-composition","last_synced_at":"2026-01-17T10:54:59.529Z","repository":{"id":197008978,"uuid":"689979716","full_name":"graphql-hive/federation-composition","owner":"graphql-hive","description":"Open Source Composition library for Apollo Federation","archived":false,"fork":false,"pushed_at":"2025-07-29T18:56:45.000Z","size":1267,"stargazers_count":50,"open_issues_count":7,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-29T23:54:48.709Z","etag":null,"topics":["federation","graphql","graphql-federation","the-guild"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-hive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-11T09:52:23.000Z","updated_at":"2025-07-07T04:08:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"d781bf64-6371-449a-8eda-632f03549876","html_url":"https://github.com/graphql-hive/federation-composition","commit_stats":{"total_commits":85,"total_committers":4,"mean_commits":21.25,"dds":"0.44705882352941173","last_synced_commit":"1cd26c168d6f603dc55f44a5fccb4a46caca80a0"},"previous_names":["the-guild-org/federation","graphql-hive/federation-composition"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/graphql-hive/federation-composition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-hive%2Ffederation-composition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-hive%2Ffederation-composition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-hive%2Ffederation-composition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-hive%2Ffederation-composition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-hive","download_url":"https://codeload.github.com/graphql-hive/federation-composition/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-hive%2Ffederation-composition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268693290,"owners_count":24291599,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"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":["federation","graphql","graphql-federation","the-guild"],"created_at":"2025-03-21T19:10:10.558Z","updated_at":"2026-01-17T10:54:59.511Z","avatar_url":"https://github.com/graphql-hive.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Federation Composition\n\nSupports all Federation versions. Drop-in replacement for `@apollo/composition`.\n\n[Learn more about compability](#compatibility).\n\n## Comparison with `@apollo/composition`\n\n- Open Source (MIT License)\n- identical API\n- same set of validation rules and exact same error messages\n- produces Supergraph SDL (can be used with Apollo Router and every tool that supports Supergraph\n  SDL)\n- does not support Hints\n- 3-4x faster\n- up to 2x less memory usage\n\n## Installation\n\n```bash\n# NPM\nnpm install @theguild/federation-composition\n# PNPM\npnpm add @theguild/federation-composition\n# Yarn\nyarn add @theguild/federation-composition\n```\n\n## Usage\n\n```ts\nimport { parse } from \"graphql\";\nimport {\n  composeServices,\n  compositionHasErrors,\n} from \"@theguild/federation-composition\";\n\nconst result = composeServices([\n  {\n    name: \"users\",\n    typeDefs: parse(/* GraphQL */ `\n      extend schema\n        @link(url: \"https://specs.apollo.dev/federation/v2.3\", import: [\"@key\"])\n\n      type User @key(fields: \"id\") {\n        id: ID!\n        name: String!\n      }\n\n      type Query {\n        users: [User]\n      }\n    `),\n  },\n  {\n    name: \"comments\",\n    typeDefs: parse(/* GraphQL */ `\n      extend schema\n        @link(\n          url: \"https://specs.apollo.dev/federation/v2.3\"\n          import: [\"@key\", \"@external\"]\n        )\n\n      extend type User @key(fields: \"id\") {\n        id: ID! @external\n        comments: [Comment]\n      }\n\n      type Comment {\n        id: ID!\n        text: String!\n        author: User!\n      }\n    `),\n  },\n]);\n\nif (compositionHasErrors(result)) {\n  console.error(result.errors);\n} else {\n  console.log(result.supergraphSdl);\n}\n```\n\n## Contributing\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\nRun the tests:\n\n```bash\npnpm test\n```\n\n### How to help?\n\n- Grab one of the failing tests and fix it.\n- Add new tests to cover more cases.\n- Add missing rules.\n- Look for `// TODO:` comments in the code and fix/implement them.\n- Todos with `// TODO: T[NUMBER]` are on Notion.\n- Look for `skipIf` or `skip` in the tests.\n- Refactor code (piece by piece) if you feel like it.\n\n### Compatibility\n\nThe lack of a publicly available specification for Apollo Federation, coupled with the non\nopen-source license of the Apollo Composition library, makes it difficult or even impossible to\nassure complete compatibility of our open-source composition library.\n\nGiven that Apollo tools utilize their composition library, there is a potential for conflicting\nresults between our composition library and Apollo's. This may lead to variations in the supergraph,\ndiffering composition errors, or, in some cases, conflicting composition outcomes.\n\nWe are working to ensure that our composition library is as compatible as possible with Apollo's and\nwill continue to do so as we learn more about the Federation specification.\n\nYour feedback and bug reports are welcome and appreciated.\n\n## Supergraph SDL Composition\n\n✅ Done\n\n## Validation\n\n### Validation rules\n\n- ✅ `NO_QUERIES`\n- ✅ `TYPE_KIND_MISMATCH`\n- ✅ `EXTENSION_WITH_NO_BASE`\n- ✅ `FIELD_TYPE_MISMATCH`\n- ✅ `FIELD_ARGUMENT_TYPE_MISMATCH`\n- ✅ `EXTERNAL_TYPE_MISMATCH`\n- ✅ `ENUM_VALUE_MISMATCH`\n- ✅ `EMPTY_MERGED_ENUM_TYPE`\n- ✅ `EMPTY_MERGED_INPUT_TYPE`\n- ✅ `OVERRIDE_SOURCE_HAS_OVERRIDE`\n- ✅ `EXTERNAL_MISSING_ON_BASE`\n- ✅ `REQUIRED_ARGUMENT_MISSING_IN_SOME_SUBGRAPH`\n- ✅ `REQUIRED_INPUT_FIELD_MISSING_IN_SOME_SUBGRAPH`\n- ✅ `EXTERNAL_ARGUMENT_MISSING`\n- ✅ `INPUT_FIELD_DEFAULT_MISMATCH`\n- ✅ `FIELD_ARGUMENT_DEFAULT_MISMATCH`\n- ✅ `DEFAULT_VALUE_USES_INACCESSIBLE`\n- ✅ `ONLY_INACCESSIBLE_CHILDREN`\n- ✅ `REFERENCED_INACCESSIBLE`\n- ✅ `INTERFACE_KEY_MISSING_IMPLEMENTATION_TYPE`\n- ✅ `INVALID_FIELD_SHARING`\n- ✅ `PROVIDES_INVALID_FIELDS_TYPE`\n- ✅ `INVALID_GRAPHQL`\n- ✅ `OVERRIDE_ON_INTERFACE`\n- ✅ `OVERRIDE_FROM_SELF_ERROR`\n- ✅ `QUERY_ROOT_TYPE_INACCESSIBLE`\n- ✅ `PROVIDES_UNSUPPORTED_ON_INTERFACE`\n- ✅ `REQUIRES_UNSUPPORTED_ON_INTERFACE`\n- ✅ `KEY_UNSUPPORTED_ON_INTERFACE`\n- ✅ `KEY_INVALID_FIELDS_TYPE`\n- ✅ `KEY_FIELDS_HAS_ARGS`\n- ✅ `KEY_FIELDS_SELECT_INVALID_TYPE`\n- ✅ `KEY_INVALID_FIELDS`\n- ✅ `REQUIRES_INVALID_FIELDS`\n- ✅ `REQUIRES_INVALID_FIELDS_TYPE`\n- ✅ `MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL`\n- ✅ `INTERFACE_KEY_NOT_ON_IMPLEMENTATION`\n- ✅ `PROVIDES_FIELDS_MISSING_EXTERNAL`\n- ✅ `REQUIRES_FIELDS_MISSING_EXTERNAL`\n- ✅ `PROVIDES_ON_NON_OBJECT_FIELD`\n- ✅ `INVALID_SUBGRAPH_NAME`\n- ✅ `PROVIDES_FIELDS_HAS_ARGS`\n- ✅ `PROVIDES_INVALID_FIELDS`\n- ✅ `EXTERNAL_UNUSED`\n- ✅ `DIRECTIVE_COMPOSITION_ERROR`\n- ✅ `ROOT_QUERY_USED`\n- ✅ `ROOT_MUTATION_USED`\n- ✅ `ROOT_SUBSCRIPTION_USED`\n- ✅ `INVALID_SHAREABLE_USAGE`\n- ✅ `DIRECTIVE_DEFINITION_INVALID`\n- ✅ `KEY_DIRECTIVE_IN_FIELDS_ARG`\n- ✅ `PROVIDES_DIRECTIVE_IN_FIELDS_ARG`\n- ✅ `REQUIRES_DIRECTIVE_IN_FIELDS_ARG`\n- ✅ `TYPE_DEFINITION_INVALID`\n- ✅ `OVERRIDE_COLLISION_WITH_ANOTHER_DIRECTIVE`\n- ✅ `INTERFACE_OBJECT_USAGE_ERROR`\n- ✅ `REQUIRED_INACCESSIBLE`\n- ✅ `SATISFIABILITY_ERROR`\n- ✅ `INTERFACE_FIELD_NO_IMPLEM`\n- ✅ `LINK_IMPORT_NAME_MISMATCH`\n- ✅ `IMPLEMENTED_BY_INACCESSIBLE`\n\n### Not yet covered Validation rules\n\n- [ ] `DISALLOWED_INACCESSIBLE`\n- [ ] `EXTERNAL_ARGUMENT_DEFAULT_MISMATCH`\n- [ ] `EXTERNAL_ARGUMENT_TYPE_MISMATCH`\n- [ ] `EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE`\n- [ ] `UNSUPPORTED_LINKED_FEATURE`\n- [ ] `TYPE_WITH_ONLY_UNUSED_EXTERNAL`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-hive%2Ffederation-composition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-hive%2Ffederation-composition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-hive%2Ffederation-composition/lists"}