GraphQL
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 us 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 breadth and depth.
Alternatives
The following alternative was considered but not chosen for these reasons:
REST
- It provides 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Â .
Last updated on