GraphQL in 2023 - Still Relevant?

Rate this content
Bookmark
Slides

With fetching libraries like TanStack Query, swr, or RTK Query becoming more widespread, some of the immediate “selling points” of GraphQL clients seem to be less unique - so it might be a good idea to take a step back and ask the question “is this even still relevant?”. And to already take the answer away - it is “yes”. The unique selling points of GraphQL go far beyond having a smooth data fetching experience by solving many inter-team and architectural problems. While it might not always be immediately evident as a benefit for us as Frontend Developers,  GraphQL gives us a lot of freedom and makes us less dependent on backend teams implementing a Backend-for-the-frontend for us. Also, while data-fetching libraries have made it a lot easier to work with REST nowadays, GraphQL still has properties that are just not present in traditional REST APIs, and on top of that GraphQL has kept evolving. New directives like @live or @defer enable developers to create a fantastic user experience with very little work - especially when combined with React’s new suspense features.

FAQ

Yes, GraphQL remains relevant in 2023, offering unique benefits like normalized caching, fragment co-location, query composition, and the deferred directive, which continue to distinguish it in the field of API technologies.

Reasons to choose GraphQL include its ability to fetch only the needed data, use a single endpoint for requests, and facilitate easier data integration across different services using GraphQL Federation.

Yes, while GraphQL initially stood out for reducing boilerplate code, its primary advantage now lies in features like type-safe data fetching and the ability to precisely request and combine data from various resources.

GraphQL is beneficial for mobile applications as it allows developers to request exactly the necessary data, reducing bandwidth usage and improving mobile data transfer efficiency.

GraphQL enhances integration by providing a consistent, language-agnostic schema across frontend and backend, which simplifies development and maintains type safety across different programming environments.

GraphQL Federation is a feature that allows multiple GraphQL services to be combined into a single data graph, facilitating seamless access to a unified API without extensive inter-service communication.

Yes, GraphQL can minimize the need for specific BFF architectures by allowing frontend developers to fetch data directly from a unified GraphQL API, reducing dependencies on backend changes for frontend adjustments.

The defer directive in GraphQL allows developers to defer loading parts of a query until later, enabling faster initial data loading and improving user experience by streaming non-critical data as it becomes available.

Lenz Weber-Tronic
Lenz Weber-Tronic
Jerel Miller
Jerel Miller
24 min
06 Jun, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today we'll discuss whether GraphQL is still relevant in 2023, exploring its benefits and unique features. We'll cover caching data on the client, data normalization, and reducing redundancy. We'll also look at updating data with mutations and upcoming features like the defer directive. Additionally, we'll explore the power of GraphQL Federation and how it allows for observing changes and making informed decisions.

1. Is GraphQL Still Relevant in 2023?

Short description:

Today, we're going to talk about whether GraphQL is still relevant in 2023. We'll cover reasons to use GraphQL and discuss the growth of the ecosystem. The biggest selling point of GraphQL used to be boilerplate, but that's not the case anymore. Another selling point is its language-agnostic contract.

Hey, there. Today, we're going to talk about the question if GraphQL is still relevant in the year 2023.

First, a few words about us. That's me. My name is Lenzi Wirtronics. I'm a Senior Staff Software Engineer at Apollo GraphQL. That means I'm a maintainer of Apollo Client. I'm the author of RTK Query. I'm a Redux 2 co-maintainer, and I'm one of those ADHD persons with a million weird hobbies. And I'm just saying that because I think as a person with ADHD in our industry, we need representation. And that's what I'm here for. You can find me on GitHub as franiris, on Twitter on fry, or on mastodon as franiris at chaos.social.

I'm today joined by my colleague, Gerald, who will be introducing himself. Thanks, Lenz. My name is Gerald Miller, and I'm a Principle Software Engineer at Apollo. I work alongside Lenz as a maintainer of the Apollo Client Library. You can find me both on Twitter and GitHub under my handle geraldmiller. And with that, we start into the talk.

First, let's talk about why we wanted to do this talk. A lot of times people are getting into Graph QL for reasons that might not be unique to Graph QL nowadays. There are very good reasons to still use Graph QL, and we're also going to cover those. But first, we're going to cover where the ecosystem has grown up, and maybe you don't need to go for Graph QL to get those benefits. Because honestly, while I work at Apollo, and I'm happy for everyone out there who is using Graph QL, I also don't want people to use Graph QL for the wrong reasons and get frustrated with it.

So the biggest selling point of Graph QL back in the day was boilerplate, because what you're seeing right now is the amount of code that was necessary to catch data from an API and Redux. And if you compare that to the amount of code that was necessary in Apollo Client to do the same thing, there's a striking difference. But this selling point isn't really true anymore nowadays. Because if you compare this to how it's done in Redux today and that's all the code you get a hook for it, or how it would be done in TANStackQuery, which is also known as ReactQuery, there's not so much of a difference. So this wouldn't be one of those reasons where I say, yeah, you have to use Graph QL just for this. Another very big selling point of Graph QL was also that you had this language-agnostic contract. So you could use it in the front end and in the back end, and everything was type safe and you could use it with TypeScript or JavaScript or Go or Java.

2. Exploring GraphQL Benefits

Short description:

With GraphQL, you can explore the schema, add fields, and see the results. Tools like Wegger UI and tRPC make exploration and type safety easier. Code generation in GraphQL provides types for queries. Open API specifications can be used with REST APIs. Alternatives to GraphQL should be considered, but it still has unique benefits.

And yeah, that's true, but never was really unique. There was stuff like SOAP, the old among us might remember, or the Swagger specification, which over time has been renamed, has become the open API specification and is something that nowadays is very common and most services can just auto-generate it for you.

With such a schema or specification in place, we can look at exploring it. This was magic for me when I started using Graph QL, like just clicking through the whole schema, having documentation everywhere, just being able to add fields and send off requests and seeing all of that come back. For example, there's Wegger UI, which lets you do the same and it might not let you combine different results, but you can explore everything. You can read the documentation that's embedded. You already see what will be coming back. This is an amazing tool.

Also, if you're just using TypeScript in your backend and your frontend, and you happen to use a monorepo, you could use something like tRPC to make RPC calls between your frontend and your backend, that are just perfectly type safe and super easy to explore because you have autocomplete in your browser. This stuff will become even more common once we start adopting React Server Component. Another big benefit would be code generation. In GraphQL, you just write your query out and from that, the GraphQL code generator in the past would have generated a hook or nowadays, it just annotates your query with types and everywhere you use that query, you will have all the types at your fingertips. But of course, that's possible within REST API as well. If you have that open API specification, you can use the RTK Query OpenAPI CodeChain to get the RTK query endpoints. Generated for you, or you use Orble, which will generate all the code you need, for example, for react query or also for SWR. So going from here, if these are all the benefits that you would personally see from using something like GraphQL, you might want to consider alternatives. But of course, GraphQL still has very unique benefits, and that's what we're going to talk about in the next part.

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

Don't Solve Problems, Eliminate Them
React Advanced Conference 2021React Advanced Conference 2021
39 min
Don't Solve Problems, Eliminate Them
Top Content
Humans are natural problem solvers and we're good enough at it that we've survived over the centuries and become the dominant species of the planet. Because we're so good at it, we sometimes become problem seekers too–looking for problems we can solve. Those who most successfully accomplish their goals are the problem eliminators. Let's talk about the distinction between solving and eliminating problems with examples from inside and outside the coding world.
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!
Jotai Atoms Are Just Functions
React Day Berlin 2022React Day Berlin 2022
22 min
Jotai Atoms Are Just Functions
Top Content
Jotai is a state management library. We have been developing it primarily for React, but it's conceptually not tied to React. It this talk, we will see how Jotai atoms work and learn about the mental model we should have. Atoms are framework-agnostic abstraction to represent states, and they are basically just functions. Understanding the atom abstraction will help designing and implementing states in your applications with Jotai
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.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.
Fighting Technical Debt With Continuous Refactoring
React Day Berlin 2022React Day Berlin 2022
29 min
Fighting Technical Debt With Continuous Refactoring
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt. In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Workshops on related topic

React, TypeScript, and TDD
React Advanced Conference 2021React Advanced Conference 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Web3 Workshop - Building Your First Dapp
React Advanced Conference 2021React Advanced Conference 2021
145 min
Web3 Workshop - Building Your First Dapp
Top Content
Featured WorkshopFree
Nader Dabit
Nader Dabit
In this workshop, you'll learn how to build your first full stack dapp on the Ethereum blockchain, reading and writing data to the network, and connecting a front end application to the contract you've deployed. By the end of the workshop, you'll understand how to set up a full stack development environment, run a local node, and interact with any smart contract using React, HardHat, and Ethers.js.
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
Remix Fundamentals
React Summit 2022React Summit 2022
136 min
Remix Fundamentals
Top Content
Featured WorkshopFree
Kent C. Dodds
Kent C. Dodds
Building modern web applications is riddled with complexity And that's only if you bother to deal with the problems
Tired of wiring up onSubmit to backend APIs and making sure your client-side cache stays up-to-date? Wouldn't it be cool to be able to use the global nature of CSS to your benefit, rather than find tools or conventions to avoid or work around it? And how would you like nested layouts with intelligent and performance optimized data management that just works™?
Remix solves some of these problems, and completely eliminates the rest. You don't even have to think about server cache management or global CSS namespace clashes. It's not that Remix has APIs to avoid these problems, they simply don't exist when you're using Remix. Oh, and you don't need that huge complex graphql client when you're using Remix. They've got you covered. Ready to build faster apps faster?
At the end of this workshop, you'll know how to:- Create Remix Routes- Style Remix applications- Load data in Remix loaders- Mutate data with forms and actions
Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Featured WorkshopFree
Mikhail Kuznetcov
Mikhail Kuznetcov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
JSNation 2023JSNation 2023
174 min
Developing Dynamic Blogs with SvelteKit & Storyblok: A Hands-on Workshop
Top Content
Featured WorkshopFree
Alba Silvente Fuentes
Roberto Butti
2 authors
This SvelteKit workshop explores the integration of 3rd party services, such as Storyblok, in a SvelteKit project. Participants will learn how to create a SvelteKit project, leverage Svelte components, and connect to external APIs. The workshop covers important concepts including SSR, CSR, static site generation, and deploying the application using adapters. By the end of the workshop, attendees will have a solid understanding of building SvelteKit applications with API integrations and be prepared for deployment.