Notes on GraphQL

Motivation for GraphQL

REST APIs can often require multiple queries in order to return a meaningful set of information. This can lead to many roundtrips to the server and high load time for the user.

Developing client software includes assumptions on what data will be returned from the API. This often leads to bugs.

Properties of GraphQL

GraphQL is not about “graphs”. There’s no requirement to model your data with nodes and edges. Instead it’s about the mental model of interconnected data, such as being able to query about e.g. your friends, and their events, and the number of attendees to that event all in one go.

GraphQL does not replace SQL or MongoDB, instead it replaces REST, in that it’s a new way for frontend and backend to communicate.