Federating schemas in a to-do list service
In this section, we will create a to-do list using GraphQL Federation. We will use the axolotl
library, together with its micro-federation starter. To bootstrap the federated project, use the following command:
npx @aexol/axolotl@latest create-federation-yoga federated-backend
This will create the federated-backend
folder and install the required dependencies inside it. It also contains a schema for a to-do list with simple user authentication and authorization.
Now, we will examine the content of the repository. We will start with the to-do list, and then move on to the users schema. In the end, we will see how the schemas merge into a supergraph and one gateway for the resolvers.
To-do list
In the to-do list schema – located inside src/todos/schema.graphql
– we have the to-do list logic. Let’s take a look at the code:
type Todo { _id: String! content: String! done...