llucasreis / game-dgs-federation

Demo Application of Netflix DGS with Apollo Federation Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game DGS Federation

Demo application of using DGS framework together with Apollo Federation Server.

The repository contains three dgs microservices:

  • game-dgs: Spring Boot GraphQL service providing the federated Game type.
  • user-dgs: Spring Boot GraphQL service providing the federated User type.
  • review-dgs: Spring Boot GraphQL service extending Game and User type with Review.

And a apollo-gateway acting as the Federated Gateway connecting the three microservices.

The image below summarize the relation between them: Diagram

How to Run

  1. Start game-dgs by running the Spring Boot app from an IDE or mvn spring-boot:run.
  2. Start user-dgs by running the Spring Boot app from an IDE or mvn spring-boot:run.
  3. Start review-dgs by running the Spring Boot app from an IDE or mvn spring-boot:run.
  4. Run npm install in apollo-gateway and then npm run server.
  5. Open http://localhost:4000 in the GraphQL Playground.

Example Queries

The following federated queries should work when all microservices are up:

{
  games {
    name
    releaseYear
    reviews {
      comment
      starRating
    }
  }
}
{
  users {
    username
    reviews {
      comment
      starRating
    }
  }
}
{
  reviews {
    comment
    starRating
    game {
      name
    }
    user {
      username
    }
  }
}

References


Made by Lucas Reis

About

Demo Application of Netflix DGS with Apollo Federation Server


Languages

Language:Java 96.3%Language:TypeScript 3.7%