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.

This talk has been presented at GraphQL Galaxy 2020, check out the latest edition of this Tech Conference.

FAQ

Tanmay is the CEO and co-founder of Hasura.

The two main use cases are the client-centric use case, which helps developers build better UI applications, and the platform-centric use case, which provides a unified API experience.

While GraphQL has become more popular, it is not yet mainstream because it has not reached the same level of adoption and enterprise interest as technologies like Kubernetes or CNCF.

A major challenge is the need for good fragment-based tooling to automate the heavy lifting of building a UI that composes all of its requirements into a single query.

GraphQL provides an optimized API for data fetching and a unified API experience, making it easier to consume and explore APIs.

The challenge is making GraphQL APIs usable in non-UI frameworks while ensuring they remain easy to integrate and do not require maintaining both GraphQL and REST APIs.

Server-side caching is challenging because GraphQL returns errors inside the response body, not inside status codes, making it difficult for existing caching tools to work effectively.

Using GraphQL as an intermediate representation involves developers using GraphQL during development to explore and prototype APIs, which are then converted into idiomatic REST or gRPC endpoints for production use.

Emerging challenges include integrating these specifications with WebSockets, HTTP/2, and HTTP/3, and handling stateful workloads effectively from a load balancing, scaling, and security perspective.

Role-based schemas can provide a dynamic schema that reflects the user accessing it, making it easier to manage and consume APIs in large enterprises with many endpoints.

Tanmai Gopal
Tanmai Gopal
35 min
02 Jul, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Fragments are essential for automating data fetching in GraphQL clients, but tooling around them needs improvement. Writing and importing fragments manually can be tedious, hindering automatic query composition. The Relay compiler has automated fragment handling, and this should be extended to other GraphQL clients. Non-GraphQL approaches like SWR and Vulkane offer alternatives for data fetching. Native GraphQL clients beyond UI frameworks present challenges, as GraphQL is optimized for UI usage. The GraphQL code generator and Juke in the SQL world offer solutions for code generation and type explosion. Bridging the GraphQL to REST tooling gap is crucial as GraphQL returns errors in the response body, not in status codes. Server-side caching and automated mapping from GraphQL to REST are potential solutions. 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. The flexibility of GraphQL APIs can make them difficult to consume and integrate. Bridging the gap between GraphQL and existing API services and tooling is vital for successful integration.

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
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
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
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.
Batteries Included Reimagined - The Revival of GraphQL Yoga
GraphQL Galaxy 2021GraphQL Galaxy 2021
33 min
Batteries Included Reimagined - The Revival of GraphQL Yoga
Envelope is a powerful GraphQL plugin system that simplifies server development and allows for powerful plugin integration. It provides conformity for large corporations with multiple GraphQL servers and can be used with various frameworks. Envelope acts as the Babel of GraphQL, allowing the use of non-spec features. The Guild offers GraphQL Hive, a service similar to Apollo Studio, and encourages collaboration with other frameworks and languages.
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
The Talk discusses the challenges and advancements in using GraphQL and React together. It introduces RedwoodJS, a framework that simplifies frontend-backend integration and provides features like code generation, scaffolding, and authentication. The Talk demonstrates how to set up a Redwood project, generate layouts and models, and perform CRUD operations. Redwood automates many GraphQL parts and provides an easy way for developers to get started with GraphQL. It also highlights the benefits of Redwood and suggests checking out RedwoodJS.com for more information.
Adopting GraphQL in an Enterprise
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
Adopting GraphQL in an Enterprise
Today's Talk is about adopting GraphQL in an enterprise. It discusses the challenges of using REST APIs and the benefits of GraphQL. The Talk explores different approaches to adopting GraphQL, including coexistence with REST APIs. It emphasizes the power of GraphQL and provides tips for successful adoption. Overall, the Talk highlights the advantages of GraphQL in terms of efficiency, collaboration, and control over APIs.
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
GraphQL has made a huge impact in the way we build client applications, websites, and mobile apps. Despite the dominance of resolvers, the GraphQL specification does not mandate their use. Introducing Graphast, a new project that compiles GraphQL operations into execution and output plans, providing advanced optimizations. In GraphFast, instead of resolvers, we have plan resolvers that deal with future data. Graphfast plan resolvers are short and efficient, supporting all features of modern GraphQL.

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
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
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