Instructor: 0:01 Apollo Federation is an open source architecture that is designed to help your organization implement and orchestrate GraphQL services at scale. Let's take a look.
0:10 I have a lift service running here on port 4001. This service contains information about all of the chair lifts as inaudible . For instance, I can get the name and status of each lift in a query. The lift service is being maintained by the lift operations team. They work on the service independently. Anything that involves chair lifts are handled by this team.
0:34 Over here, on port 4002, I have another service. This one is brought to you by the Mountain Ops Team. This is the trail service. It contains information about all of inaudible trails. I can access the name, difficulty, and grooming status for each trail.
0:49 The Mountain Ops Team is responsible for hosting and maintaining this trail service. We have two separate services brought to you by two separate teams that work in isolation.
1:01 Here, on port 4000, we have an Apollo gateway, a single service that orchestrates requests from both services. I can query both trails in lifts from a single service. This is Apollo Federation.
1:15 The independent lift in trail services are referred to as federated services. The playground now has a query plan panel. This panel can be used to see how the gateway is executing request of the federated services.
1:28 We can see here that our query for allLifts and allTrails is broken up among two services. Two parallel requests are made. All of that data is packaged up and returned in a single query.
1:41 Take a look at the schema and you'll see that a federated service has some additional queries and directives. These are required in order for Apollo to orchestrate these federated services behind the gateway.
1:54 This service that is running on port 4000 is referred to as the gateway. It orchestrates request from all federated services. One of the best features of GraphQL is the power to connect data. For instance, I can run a query that returns each lift and I can add a field to that query that finds the easiest way down, which is a trail.
2:14 The Mountain Ops Team are experts on trails. They even have an algorithm for finding the easiest trail in the list. Federation allows the Mountain Ops Team to extent the lift type from the trail service. This is possible because Apollo Federation allows us to defined entity types.
2:32 Here we can see that the trails and lifts are entities. An entity can be extended and resolved from other federated services. This means that the trail service can extend and resolve lifts. The lift service can extend and resolve trails.
2:46 Apollo Federation is the solution for hosting and orchestrating GraphQL services, which is essential for working with GraphQL at scale.