It allows you to create a unified GraphQL API in a microservices architecture. Each microservice contributes to a single unified schema.
graphql-gateway is composed of these components:
- registry - Continuously collects, validates and unifies all the schema parts
- graphql-server - A single GraphQL API executed with the unified schema
This deployment is NOT intended for a production environment. It is still a reference implementation and we plan to add some production-ready features like authantication & authorization soon.
Rest service for User details
GET http://user/:id
{
id: ...,
firstName: ...,
lastName: ...
}
POST http://user/:id
body {
firstName: ...,
lastName: ...
}
It would also contain a GQL file declaring this schema (notice the @http directive):
type User {
id: ID!
firstName: String
lastName: String
}
type Query {
user(id: ID!): User
@http(url: "http://user/:id")
}
type Mutation {
createUser(firstName: String!, lastName: String): String
@http(url: "http://user/:id", method: "POST")
}
Rest service for User Subscription details
GET http://user-subscription/:id
{
plan: ...,
expirationDate: ...
}
It would also contain a GQL file declaring a Subscription extension for the User type:
type SubscriptionPlan {
plan: String!
expirationDate: String
}
type User {
subscription: SubscriptionPlan
@http(url: "http://user-subscription/:id")
}
query {
user('some-id') {
firstName
lastName
subscription {
plan
expoirationDate
}
}
}
It is actually resolved from the two separated services! Each is responsible for the schema extension and its own piece of data.
- Rest service
- gRPC service - planned
- Databases - planned
- Kubernetes - planned
- Any platform with a custom CD