Skip to content

Proof of concept of GraphQL Federation with multiple subgraphs

Notifications You must be signed in to change notification settings

dylantf/bookstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An attempt at setting up a federated GraphQL server, containing a local gateway router and two subgraphs

Directories are:

  • router/: (NodeJS) Contains the router gateway and supergraph
  • authors/: (NodeJS) Contains subgraph A (Authors, extension of Book)
  • publishers/: (NodeJS) Contains subgraph B (Publisher, extension of Author)
  • books/: (Elixir/Absinthe) Contains subgraph B (Book, extension of Author)

Installation:

The node APIs just have hardcoded GraphQL SDL since this is the easiest path with Apollo Server.

In the Elixir API (books), use the custom mix task mix sdl. This uses the Absinthe Federation wrapper to generate the federation version of the SDL.

Composing the supergraph:

From within the router/ directory, run bun run supergraph:compose. The supergraph will output to router/src/supergraph.graphql

Running (development)

  • Gateway:
    • From within router/, run bun start
  • Authors subgraph:
    • From within authors/, run bun start
  • Publishers subgraph:
    • From within publishers/, run bun start
  • Books subgraph:
    • From within books, run mix phx.server

About

Proof of concept of GraphQL Federation with multiple subgraphs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published