Graphql Migration Strategy

While moving from REST to Graphql people are encounter the following issues.

  1. How we can migrate the backend without any customer impacts?
  2. How we can migrate all our client apps from Rest to Graphql?
  3. Will Graphql will serve the business needs without any performance downgrade in real load?

There are five phases that will be required to move from REST to Graphql.

Graphql Federation Setup

We need to develop the graphql microservices and need to be orchestrated via graphql federated gateway. So all the graphql APIs can be consumed via a single endpoint.

Graphql Conversion Layer(GQCL)

It's just a data conversion and pass-through layer. It will convert the rest api request to equivalent graphql requests and it will access the graphql gateway and return the responses back to restful services.

Test on Graphql

Graphql Migration Strategy

Before releasing the Graphql gateway to client apps first it needs to be consumed by internal restful APIs. Restful APIs already serve the business needs. If graphql APIs are able to serve the restful APIs needs then it will be able to consume the client app needs also. In case if there are any issues we can roll back from the backend itself without any client interaction. Rollback will be simple over failure. Once Graphql gateway is ready we can orchestrate restful services or restful gateway requests via GQCL.

Based on the Graphql data matrics like performance, reliability, reusability businesses can make a decision whether client or other restful services can consume the graphql APIs or not. 

Move to Graphql

Graphql Migration Strategy

Businesses are happy with Graphql matrics, then they can expose the graphql gateway to the outside world for the customers who are willing to move their client apps from restful gateway to graphql gateway. Graphql gateway will serve the request from internal restful services as well as client apps.

Push to Graphql

Graphql Migration Strategy

Instead of maintaining the multiple services for the same purpose then we can push our clients to consume the graphql APIs. Once all our clients moved to graphql we can remove the restful services and GQCL layer also.

From my experience, Graphql will not be a complete replacement for REST. Both will be coexist based on the business needs. But we can achieve the best results by a mix of Graphql and REST.

Similar Articles