In 2011, developers at Facebook noticed the industry was making a massive shift towards mobile applications, and were very concerned. They didn't have a native mobile app at the time.
Facebook prided itself on being a website company and didn’t have an app as we know today. They based their application off the website browser, and for a while it worked fine.
But they noticed that every year native mobile apps were improving, while mobile browsers got slower. And buggier. The way things were moving, mobile browsers soon wouldn't have the power to sustain their needs. And the Facebook app wouldn’t be able to handle the needs of users who were simply scrolling through their newsfeed.
On top of that, Facebook was evolving into something beyond just pictures and comments – it was coordinating an interconnected web of those comments, along with people, likes, communications, and more. For a billion users. As it evolved into a new platform experience, it was creating big problems from a technology perspective.
This was a scalability problem that could cripple the company.
REST, the standard programming language, didn’t have the flexibility they needed to make a new mobile app successful. Faced with this massive user experience issue, they set out to build an API from scratch. One that would work natively with the data and give users a better mobile experience.
In 2012, one of the engineers offered an idea – the foundation of GraphQL – about changing the language into “something a little more client focused rather than server focused.” It was this idea that caused a spark with two other developers from different departments. They grabbed an office in an empty part of their building and started working on something revolutionary.
A New Language Is Born
After a weeks-long, round-the-clock binge trying to work on what was the beginnings of GraphQL, they deployed the native rewrite of the Facebook app, called iOS 5.0.
It was a big success. Over the next year and half, it covered not just the newsfeed section, but the product overall.
In 2015, they released it to open source, and it’s revolutionized several big companies. GitHub. Spotify. Yelp. Coursera. Shopify. You’re probably using an API with GraphQL right now. And more are coming down the line.
So what is it that GraphQL has over REST? The simplest way we can sum it up is that gets things on your screen quicker.
More specifically, it’s a query language that goes on top of your existing application code, and more efficiently communicates between the client (like your phone) and server.
It has three main characteristics:
- It lets the client specify exactly what data it needs.
- It makes it easier to aggregate data from multiple sources.
- It uses a type system to describe data.
And since it loads data from server-to-client more efficiently, it’s also more flexible.
That's it in a nutshell. Want to hear more of the story, plus some reasons why it’s fantastic while simultaneously being not all it’s cracked up to be? Download our ebook and read more.