Skip to content

Demo project to show the GraphQL Federation backend support in SmallRye GraphQL

Notifications You must be signed in to change notification settings

t1/smallrye-graphql-federation-demo

Repository files navigation

SmallRye GraphQL Federation Demo badge

This is a little demo project to show the GraphQL Federation backend support in SmallRye GraphQL.

Parts

  • product GraphQL backend war: serves the name and the description.

  • price GraphQL backend war: extends the product by a price.

  • order GraphQL backend war: uses products for the order items.

  • gateway GraphQL Federation server: combines the three backends (subgraphs) into One API (supergraph).

  • printer Quarkus GraphQL CLI client: calls the gateway to print an order with all details.

Test & Run

Just run mvn verify.

But you can deploy the three war files to any Jakarta EE 10 server with MicroProfile GraphQL support, e.g. WildFly with the GraphQL Feature Pack. We use my WildFly Docker Image rdohna/wildfly:latest via JEE Testcontainers.

The gateway uses Wundergraph. To start it, run:

./gateway/router

Then the UI runs on http://localhost:3002 and you can execute, e.g.:

query order1 {
  order(id:"1") {
    customerNumber
    customerName
    orderDate
    orderItems {
      position
      amount
      product {
        name
        description
        price
      }
    }
  }
}

If you change the schema, you’ll have to regenerate the config.json. You’ll need wgc for that:

npm install -g wgc@latest

Then run (while the three services are running):

wgc router compose -i compose.yaml -o config.json

About

Demo project to show the GraphQL Federation backend support in SmallRye GraphQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published