Skip to content

byteleaf/graphql-microservice-example

 
 

Repository files navigation

GraphQL Microservices Example with Apollo Gateway / Schema Federation

Graphql Microservice example

Services

  • Product Service here
  • Account Service here
  • Order Service here

Playground

Single Services:

Query

Query by Order

You can query order ids from 1-3

{
  order(id: "1") {
    id
    title
    account {
      id
      firstname
      lastname
      orders {
        id
        title
      }
    }
    products {
      name
      description
      price
    }
  }
}

Query by Account

You can query account ids from 1-2

{
  account(id: "1") {
    firstname
    lastname
    orders {
      id
      title
      products {
        id
        name
        description
      }
    }
  }
}

Run

Run with IntelliJ

Wait for maven import and click on "Show run configurations in Services"

IntelliJ run

Then you can start all Services with one click IntelliJ run IntelliJ run

Run with Maven Wrapper

It also possible to start services with Maven. This must be done in every service subfolder.

./mvnw spring-boot:run -f product-service/pom.xml
./mvnw spring-boot:run -f account-service/pom.xml
./mvnw spring-boot:run -f order-service/pom.xml

Run Apollo Gateway

Last, start Apollo Gateway in subfolder: "graphql-gateway". See here.

npm --prefix graphql-gateway install
npm --prefix graphql-gateway start

References

About

GraphQL Microservices Example with Apollo Gateway / Schema Federation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 93.7%
  • JavaScript 6.3%