GraphQL (https://graphql.org) is a query language created at Facebook around 2012. Facebook's goal with GraphQL was to create an efficient querying and data fetching API, able to simply and efficiently query/retrieve anything from Facebook's enormous data graph.
The first thing to understand about GraphQL is that there are two parts to it:
- A server-side runtime that listens for GraphQL requests, interprets them and executes them, optionally returning requested data
- A set of client-side libraries that you can use to create/send GraphQL queries to pull/push data
As stated in the official documentation, the server-side GraphQL runtime is not tied to any specific database or storage engine, which means that you can add it on top of anything you'd like (for example, MySQL, MongoDB, a filesystem, and so on). This is one of the key strengths of GraphQL. For instance, in our case, we will plug GraphQL on top of the MusixMatch web API.
GraphQL libraries exist for many programming languages, including JavaScript/TypeScript, Java/Kotlin, Python, and so on.
Compared to REST, GraphQL is much more prescriptive. There is a clear specification detailing how queries work, how to filter datasets, how to mutate data, pass variables, and so on. In that regard, GraphQL is great because it doesn't leave too much room for bikeshedding.
In the following section, we'll briefly introduce some GraphQL concepts. Once again, consider this a really condensed and basic introduction; we do not intend to go in-depth here.