⚠️ This lesson is retired and might contain outdated information.

WTF is Apollo Federation?

Alex Banks
InstructorAlex Banks
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 2 years ago

Apollo Federation allows you to orchestrate different GraphQL services into a single GraphQL gateway. In this video, we'll take a closer look at how different services run at different endpoints and how the gateway brings these federated services together.

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.

egghead
egghead

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today