https://github.com/t1/smallrye-graphql-federation-demo
Demo project to show the GraphQL Federation backend support in SmallRye GraphQL
https://github.com/t1/smallrye-graphql-federation-demo
Last synced: 10 months ago
JSON representation
Demo project to show the GraphQL Federation backend support in SmallRye GraphQL
- Host: GitHub
- URL: https://github.com/t1/smallrye-graphql-federation-demo
- Owner: t1
- Created: 2022-09-02T10:10:42.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-09-30T12:48:13.000Z (10 months ago)
- Last Synced: 2025-09-30T14:47:10.149Z (10 months ago)
- Language: Java
- Size: 40.6 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= SmallRye GraphQL Federation Demo image:https://github.com/t1/smallrye-graphql-federation-demo/actions/workflows/maven.yml/badge.svg[link=https://github.com/t1/smallrye-graphql-federation-demo/actions/workflows/maven.yml]
This is a little demo project to show the GraphQL Federation backend support in https://github.com/smallrye/smallrye-graphql[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 https://jakarta.ee[Jakarta EE 10] server with https://github.com/eclipse/microprofile-graphql[MicroProfile GraphQL] support, e.g. https://www.wildfly.org/downloads/[WildFly] with the https://github.com/wildfly-extras/wildfly-graphql-feature-pack[GraphQL Feature Pack]. We use my WildFly Docker Image `rdohna/wildfly:latest` via https://github.com/t1/jee-testcontainers[JEE Testcontainers].
The `gateway` uses https://wundergraph.com[Wundergraph]. To start it, run:
[source,bash]
----
./gateway/router
----
Then the UI runs on http://localhost:3002 and you can execute, e.g.:
[source,graphql]
----
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:
[source,bash]
----
npm install -g wgc@latest
----
Then run (while the three services are running):
[source,bash]
----
wgc router compose -i compose.yaml -o config.json
----