GraphQL is described by its creators as “a query language for your API”. Using it, your websites and mobile apps can access the data they need. Unlike a traditional REST API, GraphQL allows you to dynamically request the data you need from a single endpoint. Due to its flexibility, GraphQL has rapidly grown in popularity since it was first created in 2012 and released to the public in 2015. Companies of all sizes are increasingly using GraphQL to create services that are used all over the world. In this post, we look at three companies that use GraphQL in 2021.
As the GraphQL ecosystem has evolved over the last few years, it has become an incredibly powerful tool that developers can use to query data dynamically at scale quickly and easily. In many ways, GraphQL can be compared to REST APIs, except that when using GraphQL, the client can construct custom queries to get all of the data it needs from the server. In some cases, your apps will have thousands of data sources. GraphQL allows you to query all of these sources with a single request. Debugging is also made easier with GraphQL tools. With the generation of the type-safe GraphQL schema, and tools like GraphQL playground, you’ll be able to easily see all of the available relationships in your API and trace back problems with your queries.
While GraphQL provides some game changing benefits, there are also some downsides to using GraphQL. One of which is the fact that GraphQL always returns a 200 response code rather than the traditional HTTP error codes. Because of this, developers need to put more effort into handling errors from their GraphQL API, constantly checking if the response contains any errors rather than a try-catch block which would work for most traditional REST APIs. Another disadvantage is the fact that built-in browser caching will not work with GraphQL. Since all of the data from a GraphQL API comes from the same URL, browsers do not know how to handle caching the data. Due to this, developers will likely need to rely on a GraphQL client library like Apollo Client instead of using a browser’s built-in fetch API.
GraphQL is impossible to discuss without mentioning Facebook. They developed GraphQL in 2012, before moving it to the GraphQL Foundation in 2018. GraphQL was built by Facebook because they wanted an API to load their newsfeed across different platforms, but each platform required slightly different data. As a result of building GraphQL, they were able to retrieve all of the data they needed across all platforms without building different APIs for each platform. Facebook also wanted to allow developers to focus more on building the client side of their applications rather than constantly switching between frontend and backend projects to fetch the data that they needed. Facebook talks more about why they built GraphQL and the benefit it provided in a post on their engineering blog.
Airbnb has been moving their apps to GraphQL over the past few years. According to the company's engineers, they move 10x faster with GraphQL. In a talk by Adam Neary from Airbnb, he talks about how the tooling provided by Apollo and GraphQL allows them to build experiences at Airbnb that they wouldn’t have had the time to build otherwise. They were able to focus less on data fetching and caching and more on building core features of their service with GraphQL.
Using GraphQL at Stable allows us to deliver new features quickly to our customers. With GraphQL, we can request the data we need without having to plan and construct REST endpoints for each new feature. It is also possible to extend our schema with new fields using GraphQL in order to support Stable's expanding functionality without building completely new versioned endpoints.
These examples are just three among thousands of companies that employ GraphQL. Companies of all sizes from big tech companies to startups can take advantage of the flexibility of GraphQL to quickly iterate on their products. To learn more about GraphQL, a good place to get started is on the GraphQL Foundation website.
Want to learn more about what it’s like to work with a startup using exciting new technologies like GraphQL? We’re hiring! You can learn more about our open roles on our careers page.