grandstack-federation: overview

GraphQL federation for GRANDstack. The Neo4j server becomes a subgraph, a small Wikipedia subgraph is added, and a gateway composes them, so one query returns movie and person data from Neo4j together with a Wikipedia summary, image and page link.

Federation overview

  1. Clients (grandstack-web, agents, curl) send one query to the gateway.
  2. The gateway (Hive Gateway) serves the composed supergraph on port 4000 and plans each query.
  3. supergraph.graphql is composed from the two subgraphs by npm run compose and committed.
  4. The Neo4j subgraph is grandstack-server with FEDERATION=true; Movie and Person are keyed on wikipediaTitle.
  5. The Wikipedia subgraph adds a wikipedia field to Movie and Person and calls the public Wikipedia API.
  6. seed/wikipedia-links.cypher stores each film’s and person’s Wikipedia page at server start.
{
  movies(where: { title: { eq: "Heat" } }) {
    title released
    wikipedia { description extract pageUrl thumbnailUrl }
  }
}

returns the film from Neo4j and "1995 crime drama film by Michael Mann" from Wikipedia. A film or person with no link (for example Madonna) gives wikipedia: null, with no error.

Needs internet. The Wikipedia part calls the live public Wikipedia API. Content, descriptions and rate limits are Wikipedia’s, and its text is available under CC BY-SA 4.0 (show the pageUrl when you display it). The stack is open, with no auth; see auth and agents.

Run it

Clone grandstack, grandstack-server, grandstack-web and this repo side by side into one folder, then start the stack from the grandstack folder:

mkdir grand-stack && cd grand-stack      # any folder name
for repo in grandstack grandstack-server grandstack-web grandstack-federation; do git clone https://github.com/grand-stack/$repo; done
cd grandstack
docker compose -f compose.yaml -f compose.federation.yaml up --build
OpenWhat
http://localhost:4000/graphqlThe gateway: the one endpoint for everything (the web app uses it too)
http://localhost:3000grandstack-web, unchanged, now talking to the gateway
http://localhost:4001/graphqlThe Neo4j subgraph, for development
http://localhost:4010/graphqlThe Wikipedia subgraph, for development

The first start of the gateway needs a gateway/supergraph.graphql; the committed one works as it is. After changing either subgraph’s schema, run npm run compose (see composition). With the stack up, run npm ci and then npm run smoke inside the grandstack-federation folder.

Documentation

ReadTo learn
How it worksThe pieces, one federated query step by step, auth and agents
The subgraphsThe FEDERATION setting, the @key, the Wikipedia subgraph, caching, errors
Linking films and people to WikipediaThe link builder, matching rules, coverage, what is not matched
Composition and the gatewaynpm run compose, the supergraph, addresses, when to recompose
What we triedMesh’s OpenAPI handler, version pins, and why the Wikipedia subgraph is hand-written
RecipesLink another entity, add another subgraph
Exercise: show Wikipedia in grandstack-webA follow-up task for a developer or coding agent
TestingUnit tests, the smoke script
TroubleshootingErrors we hit and their fixes

Working with a coding agent? Start with AGENTS.md.

Last verified: grandstack-federation v0.1.1 with grandstack-server v0.9.0, grandstack-web v0.5.1, Hive Gateway 2.15.2, Mesh compose CLI 1.8.4, @apollo/subgraph 2.14.4, Neo4j 2026.10 community, under Podman 6 on macOS.

Licence

Apache License 2.0. See LICENSE and NOTICE. The same licence applies to every GRANDstack repository and to grandstack.ai.

Source: grandstack-federation/README.md (this page is a copy; edit it in the repository)