This project demonstrates a simple Apollo Federation setup using TypeScript and Node.js, with Pokémon card data and user management as subgraphs.
- cards-subgraph/: Serves Pokémon card data from a JSON file
- users-subgraph/: Manages users and their assigned cards
- gateway/: Federates the subgraphs into a single GraphQL endpoint
- Each subgraph is a standalone Node server exposing its own GraphQL schema
- The gateway composes both subgraphs into a single API
- All queries and mutations go through the gateway (http://localhost:4000/graphql)
See each subgraph's README for sample queries and mutations.
- Install dependencies in each folder:
npm install - Build each service:
npm run build - Start each service:
npm start- Start cards-subgraph and users-subgraph first, then the gateway
- Open Apollo Sandbox/Playground at http://localhost:4000/graphql