7. How the router resolves data


So far, we've mainly been focused on our . Now it's time!

We know that the uses the to resolve incoming from the client. But how exactly does that process work?

In this lesson, we will:

  • Trace the journey of a client request through the
  • Describe how the creates to resolve across multiple s

The journey of a GraphQL operation through the supergraph

Let's start at the beginning: from the client request.

Step 1: The client request

First, the client sends a to the . The client has no clue which belong to which —or even that there are subgraphs at all!

Step 1: The client sends a GraphQL operation to the router

Step 2: Building a query plan

The looks at the in the and uses the to figure out which are responsible for resolving each field.

The router uses the supergraph schema

It uses this information to build a query plan, a list of smaller to execute on the . The also specifies the order in which the subgraph operations need to run.

The router builds a query plan

Step 3: Executing the query plan

Next, the carries out the by sending the smaller to each of the it needs data from.

The router carries out the query plan

The resolve the the same way as any other : they use their and to retrieve and populate the requested data.

The subgraphs resolve the operations

Step 4: The subgraph responses

The send back the requested data to the , and then the router combines all those responses into a single JSON object.

The subgraphs send back the requested data to the router

Step 5: Sending data back to the client

Finally, the sends the final JSON object back to the client. And that's the end of our 's journey!

The router sends the final JSON object back to the client


Here's the entire journey of a through the , summarized in a single diagram:

federated graph query animations


Which of the following statements are true?

Key takeaways

  • The uses the to create a query plan for the incoming . The is a list of smaller operations the can execute on different to fully resolve the incoming operation.
  • The carries out the by executing the list of on the appropriate .
  • The combines all the responses from the into a single JSON object, which it sends back to the client.

Up next

Coming up next, we're going to configure the to poll Apollo Uplink for our , and we'll finally begin our supergraph!


Share your questions and comments about this lesson

Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.