Is GraphQL dying? 2023 Trend Analysis of REST, GraphQL, OpenAPI, SOAP, gRPC and tRPC
Today I've noticed a post on /r/webdev stating that GraphQL is trending down. Is this really the case, or are the numbers lying to us?
Let's take a closer look at the data and see if this is really true. First, let's have another look at the original trend from the post:
StackOverflow GraphQL vs OpenAPI 2023
We can see that GraphQL peaked in 2020 and is now trending down. OpenAPI is trending up, but not as fast as GraphQL was trending up. So, is GraphQL really dying? Let's find out!
But before we look at the truth, let's see what people on Reddit have to say about this.
Here's the most upvoted post:
graphQL is one of those things that got a huge hype wave. Thats not to say it isn't useful it's just that resume driven development lead to it being used for everything. Its just coming down to a normal level that fits its real world use cases. GraphQL is great in cases where you have a ton of data but clients may only ever need some small subset of it at one time and you can give them a small payload of just what they need. Most companies don't have this much data and often a REST style api is just way simpler to build. People just made it the go to for everything. I had an old boss who wanted to use graphQL for a single form post endpoint once with no reading of data at all.
I don't really like the negative sentiment in this comment. But except from the content, there's one thing that really bothers me. Please don't write GraphQL with lowercase 'g' at the beginning, it's GraphQL. I'll explain the rest of the post in my conclusion.
IMO still a good trend – the technology found its use cases, just not overhyped. I think it's also largerly missunderstood tech. It was sold as simple to go solution, while in reallity it requires huge infrastructure investemnts on both, client, and server. For me, the part I miss the most is a forever evolving API, instead of finding ways to version API endpoints between multiple services, looking for correct version of API docs. Supporting multiple versions of the API for every small change to avoid breaking old versions of apps is no fun.
This comment should be the most upvoted comment as it contains a lot of useful information. GraphQL found its use cases and a lot of people misunderstood it.
And here's another one:
IMO graphql was a thing where everyone pretended it would replace rest then realized it's meh
Again, only ranting about GraphQL is not adding much value to the discussion. Unfortunately, a lot of other comments went into the same direction.
Alright, trend analysis time!
GraphQL vs OpenAPI 2023 Trend Analysis - Relative vs Absolute
We've already seen the trend-line of the original post. The original post is using absolute numbers. This means that the trend-line needs to be adjusted for the total number of questions asked per month.
Your key takeaway here is that you should never look at absolute numbers alone. It's always important to look at relative numbers as well. Let's add a graph with relative numbers to the original graph:
StackOverflow GraphQL vs OpenAPI 2023
Now we see a different picture. GraphQL peaked in 2022 and is moving sideways since then. You could argue that GraphQL is in a slow decline, but the time-frame is too short to make any conclusions yet.
OpenAPI on the other hand is steadily growing. Switching from absolute to relative shows an even stronger trend for OpenAPI.
Another important observation we can make is that there are 3.4 times more questions about GraphQL than OpenAPI. Honestly, this is surprising to me. Considering that REST is by far the most dominant API style, I would have expected the opposite.
GraphQL vs REST vs OpenAPI vs SOAP vs gRPC
Now that we understand the problem with absolute numbers, let's look at the trend of some other API styles and get fooled by absolute numbers again.
StackOverflow GraphQL vs REST vs OpenAPI vs SOAP vs gRPC 2023
According to this graph, both GraphQL and REST are quickly dying, while OpenAPI, SOAP, and gRPC are more or less irrelevant.
In short, APIs are becoming irrelevant. I mean, now that ChatGPT takes over the world, who needs APIs anyway?
Dear Reddit user, this was satire. Let's get serious again.
StackOverflow GraphQL vs REST vs OpenAPI vs SOAP vs gRPC 2023 - Relative
GraphQL is still going sideways. REST is in a slow decline. SOAP is in a slow decline as well. Both OpenAPI and gRPC are slowly climbing in popularity.
Finally, let's add everybody's favorite API style to the mix, tRPC. According to Twitter, tRPC is taking the API world by storm. Let's check the numbers!
StackOverflow GraphQL vs REST vs OpenAPI vs tRPC 2023
To put things into perspective, the question volume for GraphQL is 31 times higher than for tRPC. That said, people are asking questions about tRPC. You have to start somewhere.
At this point, you might be asking what these numbers really mean. Is GraphQL dying or not? And why is REST in a decline as well?
Let me give you two explanations. When a lot of absolute numbers on a platform like StackOverflow are trending down, the platform might actually be experiencing a decline in popularity. Therefore, the simplest explanation could be that "fewer people ask questions on StackOverflow in general".
The second explanation is about the nature of asking questions. Why would people ask questions about REST or GraphQL when most questions have already been asked and answered? REST is now more than 20 years old . GraphQL is 8 years old .
Is it astounding that the number of questions for an 8-year-old technology is trending down? I think it's totally fine.
REST is great, GraphQL found its place, and I'm really happy that more and more people use OpenAPI to document their APIs. Regarding tRPC, I'm really excited to see what the future holds for it. It's amazing to see how tRPC influences other API styles and pushes framework authors to improve the developer experience.
In case you don't know WunderGraph yet, it's a Backend for Frontend (BFF) Framework combining the strength of BFF, API Gateway with ideas from npm. Instead of writing a BFF from scratch, you can "generate" a BFF on top of OpenAPI, GraphQL and more with very little effort.