{"id":18470960,"url":"https://github.com/moonhighway/schema-federation","last_synced_at":"2025-05-12T13:34:56.917Z","repository":{"id":84066143,"uuid":"190103893","full_name":"MoonHighway/schema-federation","owner":"MoonHighway","description":"Examples of schema federation","archived":false,"fork":false,"pushed_at":"2019-06-04T00:58:13.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T18:44:14.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/MoonHighway.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,"publiccode":null,"codemeta":null}},"created_at":"2019-06-04T00:56:24.000Z","updated_at":"2019-06-04T00:59:18.000Z","dependencies_parsed_at":"2023-05-13T17:15:49.929Z","dependency_job_id":null,"html_url":"https://github.com/MoonHighway/schema-federation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoonHighway%2Fschema-federation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoonHighway%2Fschema-federation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoonHighway%2Fschema-federation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MoonHighway%2Fschema-federation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MoonHighway","download_url":"https://codeload.github.com/MoonHighway/schema-federation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253748566,"owners_count":21957945,"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":[],"created_at":"2024-11-06T10:15:21.974Z","updated_at":"2025-05-12T13:34:56.892Z","avatar_url":"https://github.com/MoonHighway.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snowtooth Federation Lab\n\nSnowtooth Mountain lift ops team has created a `Lift` service that provides lift status reporting for skiers and the ability to change the lift status for ski patrollers. The mountain ops team has created their own service to report on `Trail` status. These are completely separate GraphQL API's, and it is our job to turn them into federated apis that work under one gateway.\n\n## Challenge 1: Create Federated Services\n\nWe have two services that run independently of one another on two different endpoints. We need to take these services and make them apollo federated services so that they can run behind a federated gateway.\n\n## Challenge 2: Create a Gateway\n\nNow that we have federated services, we need to access them both from a single endpoint. Create a gateway services that allows me to query `allLifts` and `allTrails` from the same endpoint. The following query should work when sent to the gateway:\n\n```graphql\nquery {\n  allLifts {\n    id\n    name\n  }\n  allTrails {\n    id\n    name\n  }\n}\n```\n\n## Challenge 3: Extend the Trail Entity\n\nFrom the `lifts` service, we need to extend the `Trail` entity. Add a field to `Trail` called `liftAccess` and resolve the `lift` types that access that trail. _Hint: the data for each lift contains a `trails` array_. Once complete the following query should work form the gateway:\n\n```graphql\nquery {\n  allTrails {\n    id\n    name\n    liftAccess {\n      id\n      name\n      status\n    }\n  }\n}\n```\n\n## Challenge 4: Resolve external Trails\n\nFrom the `lifts` service, we need to extend the `Lift` type to resolve `Trail` entities. The following query should work from the gateway:\n\n```graphql\nquery {\n  allLifts {\n    id\n    name\n    trailAccess {\n      name\n      difficulty\n      status\n    }\n  }\n}\n```\n\n## Challenge 5: Add easiest Trail to Lift Service\n\nThe mountain ops team wants to provide an `easyWayDown` field for every lift so skiers will know the easiest route to the bottom no matter what lift they are on. The trail services has an algorithm for this, so we need to add an `easyWayDown` field to `Lift` entity from the trail service.\n\n```graphql\nquery {\n  allLifts {\n    id\n    name\n    easyWayDown {\n      name\n      difficulty\n      status\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonhighway%2Fschema-federation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoonhighway%2Fschema-federation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoonhighway%2Fschema-federation/lists"}