Skip to content

Sample of nest.js graphql with Apollo Studio as Schema Registry

Notifications You must be signed in to change notification settings

GeekEast/nest-apollo-studio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nest.js + Apollo Studio

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

no image found

Fetch Schema from Schema Registry in Federation Gateway (recommended)

  • register account in Apollo Studio
  • go to Dashboard tab and create graph

no image found

  • name your graph and select supergraph

no image found

  • update schema:publish cmd in package.json and APOLLO_KEY in .env.local in posts and users services

no image found

  • checkout branch
git checkout schema-registry
  • publish schemas
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

no image found

  • start 3 services
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

  • checkout branch
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)

Service Url List

service url
gateway http://localhost:3001/graphql
users http://localhost:6001/graphql
posts http://localhost:6002/graphql

About

Sample of nest.js graphql with Apollo Studio as Schema Registry

Topics

Resources

Stars

Watchers

Forks