Why GraphQL is the future
Jonas Helfer
By now you’ve almost certainly heard of GraphQL, an open-source data query language and runtime. There’s been a lot of buzz about it lately — at React Europe, which took place in Paris last week, there were three full talks about GraphQL. After reading this post, you will know why.
1. You’re already using it.
In case this is the first time you’re hearing about GraphQL, here’s an interesting fact: You’ve been using it every day for the last few years. Facebook has more than 1 billion daily active users, and GraphQL is fundamental to how Facebook works. Using Facebook means using GraphQL.
Facebook has been using GraphQL since 2012 — well before it was open-sourced in July of last year. Since then, there’s been a flurry of activity, and the open-source ecosystem around GraphQL has grown rapidly.
2. GraphQL solves real problems, and people are taking notice.
It’s not just React developers who are getting excited about GraphQL. Angular, iOS and Android developers are equally interested in what GraphQL has to offer. Its popularity is rapidly growing, and for a good reason: GraphQL has solutions for some very real problems that developers grapple with every day. That’s why companies like Twitter, Intuit and Drupal are adopting it.
Fabric, Twitter’s mobile development platform, just announced that they are using GraphQL:
Since we started building Apollo, an open-source GraphQL data stack, we’ve been approached almost daily by companies who want to adopt GraphQL for building a new product, or even rewrite their entire production infrastructure to use GraphQL.
These companies are very diverse, but they have one thing in common — they all have at least one of the following:
- They have more than one client (e.g. web + iOS)
- They have a mobile client and care about latency and bandwidth
- They are moving to a microservices architecture
- Their REST API has gotten so complicated that it’s a significant drag on product development.
- They want to decouple frontends and backends to speed up development
Companies turn to GraphQL because they realize that REST can’t help them solve these problems, but GraphQL can. Which brings me to my next point…
3. REST is not the answer.
Here’s the difference between REST and GraphQL in a nutshell:
GraphQL is the clean layer of abstraction between servers and clients that an ad-hoc REST approach will never be able to provide.
This post isn’t going to go into more detail about how GraphQL compares to REST, but if you’re interested in digging deeper, we’ve written several of blog posts about it.
Don’t take it from me. Ask any of these people:
- From REST to GraphQL by Jacob Gillespie
- GraphQL at The Financial Times by Victor Charypar
- The Business Case for GraphQL by James Baxley III
- Adopting GraphQL by Arunoda Susiripala
There are many more examples out there if you care to look for them. Twitter, Intuit, and Drupal are only the beginning (and in Drupal’s case, their GraphQL module is only the beginning). I could tell you the names of at least a dozen more well-known companies who just haven’t publicly announced their GraphQL use yet. There’s no doubt about it, GraphQL is the future.
You might be thinking, “That’s great, but why should I care?”
4. GraphQL is great news for developers.
GraphQL brings order to the chaos:
- Clean API between backends and frontends
- Less communication overhead and fewer meetings
- No more time spent writing API documentation
- No more time spent trying to figure out an API
- Great tooling for your API
With GraphQL, it takes literally 5 minutes for a new engineer to learn how to use your API. And that includes the time they need to understand how to write basic GraphQL queries.
So whether you’re a React, Angular, Ember, iOS or Android developer: take some time to learn about GraphQL, use it in your next project and try to convince your colleagues or your boss to start adopting it. You won’t regret it.
The best news is — you’re not alone! There are many devs who are just discovering GraphQL, and they’re finding a very friendly and supportive community out there of other newcomers. Some are in our Slack channel, and others are joining a very active group of users and contributors in the Apollo and GraphQL GitHub organizations.
And if you run into a member of the REST police or a professional curmudgeon, just remember this:
A new scientific truth does not triumph by convincing its opponents and making them see the light, but rather because its opponents eventually die out, and a new generation grows up that is familiar with it.
— Max Planck