/

hasura-header-illustration

State of GraphQL 2022 Survey Report Summary and Insights

The first "State of GraphQL" survey was released recently, with over 3000 developers participating.

In this post, we will look at the key insights and latest GraphQL trends identified in this survey.

GraphQL Feature Usage and Popularity

Let's start by looking at the GraphQL features and their usage. We'll see which features are the most and least popular & used by developers.

The most used features are: fragments, interfaces, unions, and custom scalars. On the other hand, the least used features are directives such as: @defer, @specifiedBy, and @stream.

You can learn about some of these GraphQL concepts in this free GraphQL course.

When it comes to the GraphQL directives, the @deprecated, @include, and @skip directives are the most used.

It's interesting to see the @defer and @stream directives being amongst the least used/popular features considering that they help improve the app performance by reducing latency. These two directives are great features, so you might want to try them out. You can read more about @defer and @stream here.

If you are using Hasura to build your GraphQL API, you don't need to use these directives for the use case of streaming real-time data. Hasura comes with streaming over GraphQL subscriptions.

GraphQL Subscriptions seem to be the popular choice among developers when it comes to real-time data. Meanwhile, most developers are not even aware of Live Queries. That means they are less popular and used compared to GraphQL Subscriptions.

It's important to mention that features such as @defer, @stream, and live queries are not specified in the official GraphQL specification. Perhaps developers are less inclined to use features that are not included in the GraphQL spec.

Moreover, most developers were only aware of a small subset of GraphQL features. If you search for features such as live queries, for example, you won't find a lot of material on the subject. So it makes sense when you see that most developers didn't know about many features. Maybe we, the GraphQL community, could do better to raise awareness of the different GraphQL features.

In Hasura, Live Queries is a pattern of querying real-time data where a response is returned every time the data changes. Read more about Hasura's Live Query architecture.

GraphQL Libraries

In this section, we'll look at the available libraries in the GraphQL ecosystem. We'll go over the following:

  • servers
  • clients
  • API generators
  • schema builders

GraphQL Servers

Let's start by looking at the GraphQL servers developers use to power their APIs.

According to the survey, the top 5 popular choices are Apollo Server, Express-GraphQL, GraphQL.js, Yoga, and GraphQL-Go.

If we flip the chart and look at the retention rate, we can see a significant change in the rankings. A higher retention rate means developers would use the technology again to build GraphQL servers. The top 5 are as follows:

  • DGS
  • Absinthe
  • GraphQL.js
  • Mercurius
  • Apollo Servers

It would be interesting to be able to look into why those technologies have a high retention rate. Is it because they have excellent developer experience? Is it because they are complete solutions? Is it because they have lots of features? It would be interesting to know.

Looking at other tools, we can see Hasura in second place. That shows that Hasura is quite a popular choice for developing GraphQL servers.

Overall, there are plenty of choices for building GraphQL servers. Looking at the data, we can see that the community is happy with the current state of GraphQL technologies for building servers. Do note that these are libraries or frameworks you use to write a GraphQL server from scratch completely.

GraphQL Clients

Now let's look at the GraphQL clients developers use to query their APIs.

When it comes to GraphQL clients, the top 5 most known technologies are as follows:

  • Apollo Client
  • Relay
  • No client
  • React Query
  • URQL

Looking at the retention rate (whether the developers would use the technology again or not), the chart changes quite a bit.

The chart shows that the top 5 clients with the highest retention rate are: GraphQL Hooks, graphql-request, React Query, URQL, and Apollo Kotlin. Like with the GraphQL servers, it would be nice to understand why they have a high retention rate.

One thing to observe is that GraphQL extends outside the JavaScript ecosystem. We can see clients for Kotlin, Swift, and iOS.

Even though there are only a handful of GraphQL clients, most developers are happy with the pool of choices.

If you are interested in exploring GraphQL clients, check this article.

API Generators

This section will cover the ORMs, CMSes, and other tools that help developers create a GraphQL API. This category is where Hasura fits in too.

Hasura is leading the way when it comes to awareness of such tools. Hasura is then followed by:

  • Strapi
  • Contentful
  • AWS AppSync
  • Fauna
  • Graphene

and others. The chart includes tools such as API generators, content management systems (CMSes), libraries, and plugins.

If we look at the usage of these tools, the chart changes a bit, but Hasura is close to the top spot. It seems that developers prefer to use Hasura.

The above chart illustrates whether developers want to learn/would use a technology again or are not interested/wouldn't use it again. According to the chart, the majority of developers would like to learn how to use Hasura, or they would use it again in their projects.

Looking at the chart, we can see that there are many tools available to build or support GraphQL APIs. Also, Hasura seems to be relatively popular when it comes to API generators.

Schema Builders

It would be interesting to look at libraries and utilities developers use to build their GraphQL Schema.

The "GraphQL Code Generator" technology is the most popular and used technology. It's a tool that automatically generates code from your GraphQL schema and operations.

Other notable technologies are:

  • Type-GraphQL - It enables you to create GraphQL schema and resolvers with TypeScript, using classes and decorators
  • gqlgen - Go library for building GraphQL servers
  • Pothos - another TypeScript schema builder
  • Nexus
  • Sangria

To conclude, there are some excellent technologies to help you kickstart your GraphQL API development.

Other GraphQL Tools

This section is all the tools that help with GraphQL development but don't fit in the previous categories. That includes tools that allow you to combine schemas, data sources, GraphQL IDEs, etc.

There are cases when you might have multiple GraphQL APIs you want to join together. There are a couple of tools to help you with that, one being Hasura Data Federation.

At the moment, Apollo Federation and Schema Stitching are leading the way, but it's worth keeping an eye on to see how things evolve.

When it comes to the database used in conjunction with GraphQL, PostgreSQL leads the way, followed by MySQL, MongoDB, Redis, and others. We can also observe that developers prefer SQL databases when working with GraphQL.

By the way, if you wish to get started with PostgreSQL, check out the introduction to PostgreSQL tutorial.

Lastly, if we look at the chart, we can see that GraphiQL and GraphQL Playground are the most popular & used tools to query GraphQL APIs. It's expected since they are both designed specifically for GraphQL and do a great job!

Check out the public version of GraphiQL that you can use to share GraphQL queries - GraphiQL.

Summary

The "State of GraphQL" survey gives us valuable insight into the GraphQL ecosystem! Check out the full survey results here.

The survey shows that GraphQL has matured over recent years and is also gaining ground outside the JavaScript ecosystem. Hopefully, in the next release of the GraphQL specification, we will also see features such as live queries and the @stream and @defer directives added.

All in all, the future looks great!

20 Oct, 2022

6 MIN READ

Share
Blog
20 Oct, 2022
Email
Subscribe to stay up-to-date on all things Hasura. One newsletter, once a month.
Loading...
v3-pattern
Accelerate development and data access with radically reduced complexity.