GraphQL for building microservices
Ossi Puustinen · Tampere University Institutional Repository (Tampere University) · 2020
Most of the current day web applications follow a strict decoupling of the client and the backend. While REST has become the industry standard for writing APIs, it has its shortcomings - most notably data under- and over-fetching. GraphQL has been hyped as the successor of REST as the new standard for building Web based APIs. GraphQL offers clients a way to describe precisely the data and interactions they are interested in. Its big-name adopters include Shopify, Twitter, Atlassian and PayPal. This thesis is a case study of a GraphQL microservice, which combines data from multiple different sources and offers it in a single cohesive data model. The objective of the study is to gather information on building GraphQL based microservices, best practices on resolving GraphQL queries and maintainability of a GraphQL server. The results showed that GraphQL suited well for building microservices, but it is highly oriented towards serving client applications. There are some caveats on resolving hierarchical queries with GraphQL, which are well known and documented and can be avoided. GraphQL provides some benefits in the terms of project maintainability but might require more code to be written when compared to REST.