Learning different ways of hosting distributed GraphQL services.
$ npm install
When GraphQL services are modules/libraries (done for separation of concerns) but they are not hosted independently. So their schema will be merged and exposed from a single service.
$ npm run start:schema-merge
When GraphQL services are hosted independently but do not share much common between each other such as shared types. In this case, a proxy or gateway service will stich the schema together at runtime and expose both services from a single endpoint.
$ npm run start:schema-stitching::book-service
$ npm run start:schema-stitching::author-service
$ npm run start:schema-stitching::gateway-service
It's similar to Schema Stitching but these services can share types between each other without hardcoding the logic of merging data for these types at gateway level.
- Install Rover CLI
$ cd federation
- Perform Schema Composition
$ npm run start:federation::book-service
$ npm run start:federation::author-service
$ npm run start:federation::router