GraphQL 2021 Wishlist- The top GraphQL Opportunities & Challenges for 2021

Rate this content
Bookmark

As GraphQL enters its 6th year, we've come a long way as a community and an ecosystem. But there's still a lot of work to be done for GraphQL to go totally mainstream and retain its momentum. In this talk, I'll highlight the top cross-cutting technical and tooling challenges that practitioners face in getting GraphQL adopted and hope to spark new ideas and discussions around what we need to spec out, what we need to build and what need to improve!

I'm excited to share a list of opportunities and ideas that encompass a) the boring things that need to be done (eg: health-check & error handling!), b) the hard problems that need to be solved (eg: rate-limiting & security) and c) the exciting challenges (eg: GraphQL & wasm) facing us as a GraphQL community.

I hope that at the end of the talk we have a real sense of what the top challenges are and why, and that we're excited about going into 2021 discussing these challenges and building potential solutions.

Tanmai Gopal
Tanmai Gopal
35 min
02 Jul, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

GraphQL has not yet reached mainstream adoption and there are still inflection points to cross. Fragments in GraphQL clients need improvement, and non-GraphQL approaches like SWR and Vulkane offer alternatives for automating data fetching. GraphQL clients beyond UI frameworks present challenges, but tools like the GraphQL code generator and Juke offer solutions. Using GraphQL as an intermediate representation and bridging the gap between GraphQL and REST are appealing concepts. Joining graphs and data in different use cases is a challenge, but solutions like a common GraphQL model or programmable API gateway are emerging. Unifying the entire API ecosystem may not be necessary in large enterprises, focusing on specific API endpoints can be more beneficial.

1. Introduction to GraphQL and its Use Cases

Short description:

Hey everybody, I'm Tanmay, the CEO and co-founder at Hasura. Let's start by understanding where we are with GraphQL today. Although GraphQL has become more popular, it hasn't yet reached mainstream adoption. There are certain inflection points that we still need to cross. People like GraphQL for different reasons, such as optimizing data fetching logic for UI applications and driving a unified API experience. GraphQL provides a better way to batch and type data, making it ideal for client-heavy applications. It also offers ease of exploration and consumption, allowing developers to view multiple models together. These aspects make GraphQL a powerful tool for interacting with heterogeneous data sources or services.

Hey everybody, super glad to be here. I'm Tanmay, and I'm going to be talking to you a little bit about my GraphQL 2021 wishlist. These are the summary of some challenges, and of course, through those challenges, opportunities that we have as a community in front of us to build more tooling, do a few more specifications and exchange more ideas with each other.

To kick things off a little bit, maybe with a brief introduction. I'm Tanmay, I'm the CEO and co-founder at Hasura, and a lot of what I'm talking to you about is stuff that we've learned from our community, from our user community and patterns that we've seen from our enterprise users, especially. And so with that, let's kind of start things off by doing a quick stock of two things. One, where we are with GraphQL today. So the good news is that we are super... GraphQL has become more and more popular which is awesome, but the slightly sad news is that it's been five years with GraphQL, and GraphQL isn't really yet mainstream. If you think about kind of where, say Kubernetes or CNCF, which was another huge wave that happened in the ecosystem quite recently, it was at a very different level of kind of adoption and enterprise kind of interest and investment as compared to where GraphQL is today. And that's not necessarily a bad thing, but it's just an interesting thing to kind of note that there are certain inflection points that we still I think need to cross for GraphQL to kind of become mainstream. And hopefully the kinds of challenges and opportunities that we're gonna be talking about are going to help kind of understand that a little bit and see if we can build things to solve some of these problems and take GraphQL mainstream over the next few years as a community.

So the two things or two points of context that I'd like to add before we kind of dive into some of these challenges is the reason why people like GraphQL and the use cases are not homogeneous, right? People aren't using GraphQL and people like GraphQL for slightly different reasons. And I think it's important to kind of differentiate between these two. So the first use case, and I'm going to call that a client-centric use case, right? is primarily when we're using GraphQL to help people and help our developers build better UI applications, right? And here kind of what's appealing about GraphQL at a very technical level is that it gives us the ability or it gives the client and the server a contract and an ability to kind of automatically optimize data fetching logic, right? So instead of kind of relying, and this is the n plus one REST API called problem, right? So instead of making many REST API calls to render a particular UI page, right? You're able to fetch that from the application dynamically in a single kind of batched query. And GraphQL is a specification for essentially doing that, right? And here we're primarily thinking of GraphQL as a more optimized API to fetch data. Right. And this is kind of a new problem that's kind of come in when we've moved towards more kind of client-heavy applications, right? This wasn't a problem with kind of purely server rendered applications, things like PHP or whatnot back in the day, where a lot of the data fetching that multiple amounts of data required to render a UI component was done on the server that was rendering the UI itself. And then that UI was just sent to the client that was going to use it, right? But as kind of things become more dynamic, we've realized that making multiple API calls because of just the network is not good. And we need an automatic way of transferring that. Another similar convenience in a technical problem here is that JSON, which was the kind of data exchange format that's emerged over the last decade, was untyped, and it required certain typing, and GraphQL was a nicer technical way of doing it, right? And so this is a very technical reason and how GraphQL is helping us build better UIs. And here you're essentially thinking of GraphQL as just in a very abstract, not completely correct way, a better way to batch and a better way to type, right? That's essentially it without going into the ergonomics of GraphQL. But the second aspect, and the second kind of use case and why people like GraphQL, is what I call a platform-centric use case, right? And here people like GraphQL as a specification to drive a unified API experience, to say that, hey, instead of kind of looking at my one service and it has 10 endpoints, I can have one endpoint and then browse a graph of the models that this API serves. Or if I have multiple services, then maybe I can build an aggregator kind of like a backend for front-end sometimes, or even an internal API aggregator that allows developers to kind of view all of these models together and it becomes easier to consume and explore the API. And this is a big part of GraphQL's appeal, which is this ease of exploration and consumption, which may be a slightly controversial statement to make, but which has nothing to do with the technical performance optimization benefit of GraphQL. These are almost two independent aspects of the use case and why one likes GraphQL. And of course, because GraphQL is kind of a JSON API, it's a great API to interact with when you have heterogeneous data sources or services, being able to view that as one unified JSON graph is great. It's like a MongoDB experience over all of your data over an API type. And this doesn't have too much to do with the technical benefit of GraphQL, which is the batching and there is typing, which helps, of course. The typing is kind of in the middle of both a very technical benefit and an ergonomic benefit as well.

2. Challenges in GraphQL Clients and Fragments

Short description:

Fragments are critical for automating data fetching in GraphQL clients, but the tooling around fragments needs improvement. Manually writing and importing fragments can be tedious, and it hinders the automatic composition of data queries. The Relay compiler has made progress in automating fragment handling, but this concept should be extended to other GraphQL clients. Additionally, other approaches like SWR and Vulkane offer interesting alternatives for automating data fetching without the complexity of GraphQL. These non-GraphQL approaches have the potential to optimize data fetching and make it more efficient.

But these are kind of the two lenses with which we can think about the way GraphQL is kind of being adopted, used and loved by people when they're using GraphQL. And so when we think about the challenges in the next few minutes, let's keep these two kinds of use cases in mind. So the first is GraphQL clients and fragments, which is primarily client-centric use case. And here, the challenge is that when we think about going beyond the convenience of GraphQL and really kind of optimizing and automating high performance data fetching, it's really hard to do that without good fragment-based tooling.

Fragments are critical and tooling around fragments is critical to automate the heavy lifting and the grunt work of building a UI that kind of composes all of its requirements together into a single query and fetches that data. And here, again, maybe a little bit controversial statement, fragments are, in my opinion, not very useful for reuse. It's not like I'm not particularly excited about creating a separate file where I store all my GraphQL queries and fragments and then I refer to those fragments and use them in my components. That's not a particularly exciting use case for fragments for me. I'd rather just specify the query next to my component. I'd rather co-locate my data fetch requirement within my UI component as a developer. Instead of touching 10 different files, I'd rather touch my component file.

And in this case, what fragments can really allow us to do is to, me as a developer working on a particular UI component, I can work on a single component and I can specify my data requirements as a fragment. And multiple people can work on different components, specifying their requirements as a fragment, which automatically get merged. When all of those UI components come together in kind of a UI component tree, all of those fragments will also get composed into a single query. The beauty of this approach is that it has to happen automatically. If this is happening manually in the sense that I write a fragment here, then I have to import the fragment somewhere else. And then I have to specify that, Hey, I'm using this fragment. I have to go to the top level component and specify my top level query that I'm using a fragment somewhere. It's not a great experience. And it's kind of the benefit of using GraphQL to automate this data query composition stuff is lost.

Now, Relay has done a fabulous job at kind of taking these several concepts that are required to compose data fetching logic automatically. And the tooling that is required to automatically deal with fragments, right? Without having to do the manual work of writing fragments, maybe in a separate file or importing and reusing them and whatnot. But unfortunately, this idea has not come out from the Relay clients, because the Relay compiler is also a little bit complicated. But taking that Relay compiler and using that to build other GraphQL clients is something that we need to do more of. I think there's some interesting work that's happening here with some of the clients. I think if I'm not wrong, the Angular client. But there's a lot of interesting ideas here that we need to take beyond just the React ecosystem into other UI ecosystems as well. Alternatively, there's a lot of love that we need to give to the Relay docs and to get that up to speed so that that client is kind of more usable and more accessible, right? Interestingly, there are other approaches that are emerging to solve a similar problem around data fetching and optimizing data fetching automatically, right? SWR, which is Stale-while-revalidator, the name of a concept but also the name of a library or a tool that the Versal folks built, and Vulkane, which is another approach using HTTP2, are very interesting approaches that allow kind of the similar idea of letting UI developers build their UI components, specifying their API call that fetches data, but then kind of having some of that data fetching logic get automated without developers having to do too much work to kind of compose that together to redo stuff and to make it as efficient as possible, right? And so there's interesting non-GraphQL approaches or can have some overlap with GraphQL as well. And the interesting thing about these approaches is that because they're not reliant on GraphQL, they don't have to add any of that GraphQL complexity. And so this is one area of work that I'm particularly excited about and hoping that there's more stuff that happens over the next few months.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
We all love GraphQL, but it can be daunting to get a server up and running and keep your code organized, maintainable, and testable over the long term. No more! Come watch as I go from an empty directory to a fully fledged GraphQL API in minutes flat. Plus, see how easy it is to use and create directives to clean up your code even more. You're gonna love GraphQL even more once you make things Redwood Easy!
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
How many times did you implement the same flow in your application: check, if data is already fetched from the server, if yes - render the data, if not - fetch this data and then render it? I think I've done it more than ten times myself and I've seen the question about this flow more than fifty times. Unfortunately, our go-to state management library, Vuex, doesn't provide any solution for this.For GraphQL-based application, there was an alternative to use Apollo client that provided tools for working with the cache. But what if you use REST? Luckily, now we have a Vue alternative to a react-query library that provides a nice solution for working with server cache. In this talk, I will explain the distinction between local application state and local server cache and do some live coding to show how to work with the latter.
Batteries Included Reimagined - The Revival of GraphQL Yoga
GraphQL Galaxy 2021GraphQL Galaxy 2021
33 min
Batteries Included Reimagined - The Revival of GraphQL Yoga
The Guild has recently released Envelop - a new, modern GraphQL Server Framework and plugin system. In this talk I’ll share a brief overview of Envelop and why you should probably upgrade your existing GraphQL server to it.
Rock Solid React and GraphQL Apps for People in a Hurry
GraphQL Galaxy 2022GraphQL Galaxy 2022
29 min
Rock Solid React and GraphQL Apps for People in a Hurry
In this talk, we'll look at some of the modern options for building a full-stack React and GraphQL app with strong conventions and how this can be of enormous benefit to you and your team. We'll focus specifically on RedwoodJS, a full stack React framework that is often called 'Ruby on Rails for React'.
Step aside resolvers: a new approach to GraphQL execution
GraphQL Galaxy 2022GraphQL Galaxy 2022
16 min
Step aside resolvers: a new approach to GraphQL execution
Though GraphQL is declarative, resolvers operate field-by-field, layer-by-layer, often resulting in unnecessary work for your business logic even when using techniques such as DataLoader. In this talk, Benjie will introduce his vision for a new general-purpose GraphQL execution strategy whose holistic approach could lead to significant efficiency and scalability gains for all GraphQL APIs.

Workshops on related topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
WorkshopFree
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura
Building GraphQL APIs on top of Ethereum with The Graph
GraphQL Galaxy 2021GraphQL Galaxy 2021
48 min
Building GraphQL APIs on top of Ethereum with The Graph
WorkshopFree
Nader Dabit
Nader Dabit
The Graph is an indexing protocol for querying networks like Ethereum, IPFS, and other blockchains. Anyone can build and publish open APIs, called subgraphs, making data easily accessible.

In this workshop you’ll learn how to build a subgraph that indexes NFT blockchain data from the Foundation smart contract. We’ll deploy the API, and learn how to perform queries to retrieve data using various types of data access patterns, implementing filters and sorting.

By the end of the workshop, you should understand how to build and deploy performant APIs to The Graph to index data from any smart contract deployed to Ethereum.