Rationale
GraphQL is the query language we use for our official API.
The main reasons why we chose it over other alternatives are:
- It is Open source.
- It provides a very flexible syntax that allows end users to fetch exactly the data they need.
- It allows front-ends to inherit all the API types by using its schema.
- It makes versioning way easier by allowing to deprecate specific queries and mutations, which allows us to keep evolving our API without having to introduce major changes.
- It supports playgrounds, which are ideal for comfortably learning and interacting with the API.
- Although it is harder to protect a GraphQL API against DoS attacks due to its flexibility, it still supports validations like query breath and depth.
Alternatives
The following alternatives were considered but not chosen for the following reasons:
REST
- It provided a much more limited syntax for end users.
- It makes versioning harder as entire endpoints must be deprecated, losing granularity and forcing us to introduce major changes to keep compatibility.
- Protecting it against DoS attacks is easier due to its limited flexibility.
Usage
We use GraphQL as the query language for our official API.