There are three projects inside this repo. One is the federation gateway , which is served at port http://localhost:3001/graphql
the other two are the graphql node services , that are served at port http://localhost:6001/graphql
and http://localhost:6002/graphql
Fetch Schema from Schema Registry in Federation Gateway (recommended)
register account in Apollo Studio
go to Dashboard
tab and create graph
name your graph and select supergraph
update schema:publish
cmd in package.json
and APOLLO_KEY
in .env.local
in posts and users services
git checkout schema-registry
cd nest-post-service && npm install && npm run schema:publish
cd nest-user-service && npm install && npm run schema:publish
click the operation tab in left side and update APOLLO_KEY
AND APOLLO_GRAPH_REF
in each .env.local
file
cd nest-federation-gateway && npm install && npm start
cd nest-post-service && npm install && npm start
cd nest-user-service && npm install && npm start
Build Federated Schema via Service URl in Federation Gateway
git checkout build-federated-schema
you have to start the posts and users service at first
cd nest-post-service && npm install && npm start
cd nest-user-service && npm install && npm start
then start the federation gateway service
cd nest-federation-gateway && npm install && npm start
Comparison Between Registry and BuildFederationSchema
Feature
Schema Registry
Build Federated Schema
remove deployment dependency between gateway and graphql services
✅
federated schema will be updated in realtime if sub graph get updated (no need to redeploy gateway to update federated schema)
✅