Follow Datanami:
June 27, 2019

GraphQL Creators Provide a Tutorial on Teamwork

We tend to focus on the latest and the greatest in big data. Here’s a look back at the origins of a tool designed to embed data with applications, and do so without API developers getting bogged down in the details.

The story is told in the form of a mini-documentary detailing the development of GraphQL, the emerging query language for APIs and the runtime that handles those queries with existing data. The video released this week features the Facebook (NASDAQ: FB) software engineers who in two weeks built GraphQL: Lee Byron, Dan Schafer and Nick Schrock.

According to the producers, the documentary describes “what GraphQL was before it was GraphQL.” The motivation was Facebook’s realization that its mobile strategy was failing, requiring a rewrite of its iOS app.

The three developers began rebuilding the iOS app from scratch using native technologies, starting with Facebook’s existing APIs. They soon realized that they—and probably no one else—had never built a mobile app incorporating all the required logic within the API.

“That kind of technical architecture had never existed before,” said Byron. “There’s a lot of complicated things going on.”

In early 2012, the GraphQL team concluded they would need a updated news feed API to build the mobile app that was considered central to the social media giant’s future.

GraphQL, which promises to deliver a graph-like alternative to the piecemeal limitations of procedural REST, was originally developed to provide a faster way to assemble data upon which Facebook’s social media platform is built. The developers sought a higher abstraction level to reduce the need to know specific details of various API calls for the different elements of the Facebook news feed.

“We knew that we had to build this native mobile app,” recalled Schafer. “It was just the right thing to do, so we did it.”

Schrock likened their approach to a better way to buy an item from a vending machine: Instead of dropping quarters into a machine to buy one item, they sought a methodology akin to simultaneously pushing a combination of buttons to buy several items at once.

From left, GraphQL creators Nick Schrock, Dan Schafer and Lee Byron. ‘It was just the right thing to do, so we did it.’

Schrock knocked out the GraphQL prototype called “SuperGraph,” and posted the code for review. The idea was to develop a new engine for what the team decided was a “souped-up version of the graph API.”

“Instead of mapping this kind of object graph, and contorting it to be a relational system,” Schrock said, they decided to “make it an object graph all the way from back to front.”

Schrock had been working with Schafer, Facebook’s expert on its flagship News Feed. Meanwhile, Byron provided enthusiastic feedback about the GraphQL prototype, “The team kind of naturally, organically formed—and we were off to the races,” Schrock said.

For about two weeks, the team closeted itself in what might be called the GraphQL Bunker to build a system that the producers of the documentary breathlessly promote as the query language “that literally saved [Facebook] from impending doom.”

The creators’ mind set was described by Byron thusly: “This thing has to be up, production-ready, serving API requests and do everything News Feed does by this [pre-determined] date.”

Added Schrock: “A lot of clocks had to strike at midnight in order for this to work,” including a feed rewrite and GraphQL, then meshing those components with Facebook’s native mobile team. “And there’s a ton of unknow technical complexity in all that stuff.”

GraphQL was shipped as part of Facebooks iOS app in August 2012, and the team ultimately decided to release its code to the open source community in 2015.

Since then, it has emerged as a likely replacement for the current 20-year-old APIs like REST and SOAP that operate as point-to-point links not designed to pull data from the cloud, a database or microservices. Proponents such as graph platform specialist Apollo are implementing GraphQL as a way to integrate data graph technology between services and devices.

View the GraphQL documentary here.

Recent items:

Will GraphQL Become a Standard for the New Data Economy?

The Graph That Knows the World