Federation of GraphQL Services using Apollo Gateway

… to continue discussion from previous post:
GraphQL Services using Node and Apollo

For the sake of separation of concerns, responsibilities and teams, each team could implement their own GraphQL services, possibly on top of existing RESTful services. It may be developer-friendly to expose single GraphQL service by using Apollo Federation.

First we need to convert the standard GraphQL services to federated services by extending the schemas. At initial glance, this sounds straight-forward. But it is not developer-friendly when we check the extensions:

On Auth service we need to extend the entities of Accounts service, and on Accounts service we need to extend the entities of Auth service. The assumption is each service will define and resolve their entities and only gateway will know which entity is resolved by which service. The fragments of those entities can be added on the entities of each other by using extensions.

Auth service resolvers:

Accounts service resolvers:

Author: murat