The new GraphiQL: Next-level Customizability

Rate this content
Bookmark

We shipped the next major version of GraphiQL earlier this year! We completely rethought the experience with a particular focus on customizability. Not all users and every API have the same needs for a GraphQL IDE, so one of our big goals was to allow GraphiQL to work for a large variety of use-cases. Let's dive deep into the changes of how we took the customizability to the next level and explore together how you can make GraphiQL your own.

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

FAQ

GraphQL is successful due to its powerful tooling, especially GraphiQL, which provides a user-friendly interface for interacting with GraphQL APIs.

Thomas works at Stellate on various GraphQL projects and is one of the maintainers of GraphiQL.

New GraphQL developers often need to learn the syntax, explore the schema, test queries, debug issues, and document their APIs.

The first version of GraphiQL focused on learning, exploring, and developing with GraphQL, making it easy to start without setup or installation.

GraphiQL version 2 introduced a plugin API for customization, refactored components into the GraphiQL React package, and made it easier to embed and customize the tool.

Developers can override CSS variables to change colors and styles, making GraphiQL blend with their own product's design.

The Fetcher function fetches GraphQL requests. Developers can customize it to add functionalities like measuring request timing.

Future improvements include integrating the Monaco code editor, enhancing the GraphiQL Explorer, and expanding plugin capabilities.

Developers can use the GraphiQL React package to embed GraphiQL components into their websites or products, allowing users to interact with GraphQL queries directly.

Developers can find support on the official GraphQL Discord channel, and they can contribute by opening issues on the GraphiQL GitHub repository.

Thomas Heyenbrock
Thomas Heyenbrock
21 min
08 Dec, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

GraphQL is successful due to its tooling and customizability, but developers face challenges such as learning, syntax, schema exploration, API building, visualization, documentation, and collaboration. GraphQL version 2 has made significant improvements, including a plugin API and building blocks in GraphQL React. Customization in GraphQL involves overriding CSS variables and building custom functionality using plugins. The ability to embed a GraphQL IDE into a blog allows users to interact with GraphQL concepts directly. Overall, GraphQL continues to evolve and adapt to the changing needs of its ecosystem.

1. Introduction to GraphQL and Its Challenges

Short description:

Welcome to my talk at GraphQL Galaxy. GraphQL is successful because of its tooling. I want to talk about GraphQL, its customizability, and taking it to the next level. The problems GraphQL developers face include learning, syntax, schema exploration, building APIs, visualization, documentation, and collaboration.

Hello folks. Welcome to my talk at GraphQL Galaxy. I hope you're having an awesome conference so far, enjoying a lot of other interesting talks, and I hope I've got another interesting one lined up for you now. And I want to open it up with a question to you. Why do you think GraphQL is so successful?

Now, I'm recording this talk, so I can't get your answer straight away, but feel free to drop your answers, comments, questions, whatever, in the chat, and let's see that we can get a conversation going. And I'll give you my answer. I believe GraphQL is so successful because of its tooling. And one tool in particular that you can also see on the screen already that I want to talk about is GraphQL.

GraphQL has been around since the release of GraphQL back in 2015. And to this day, it is the portal for me as a GraphQL developer to interact and dive into GraphQL. There's been a lot of development around GraphQL in the last year, and this is what I want to talk about to you today. And in particular, I want to focus on customizability and how you can take GraphQL to the next level.

Quick facts about me. My name is Thomas, I work at Stellate on other cool GraphQL things, and I'm one of the maintainers of GraphQL. But enough about me. Let's dive right into the topic. And I want to start with the why. Why does GraphQL exist? Let's rephrase this to what are actually the problems that GraphQL developers face? Before we talk about any kind of solutions like GraphQL.

If I'm just getting out, a big thing that I need to do is just learning. I need to learn actually what is GraphQL? How does its syntax work? Was it a Graph QL schema, exploring a schema firsthand, and having this first success moment of sending a Graph QL request and getting a response and seeing both of them side by side? Once I learn GraphQL, I grasp the concept, then I want to get my hands dirty. I start developing and building my first Graph QL API. This involves a lot of iteration, and testing out queries as I go and debugging if something is not working as I expect it to.

Graph QL already contains the word Graph in its name and a Graph is something that can very easily be laid out in a visual way where I can explore, in this case, it's the Graph QL schema, and how different types relate to each other. But it's not just the schema, also the data that the API returns to me. It's depending on the semantics of the API, this data could have certain meaning like I don't know, geolocation data, which I can visualize in a very specific way. It's also a lot about documentation. If I'm in particular, if I'm building my own API, and I want others to use it, I need to document it. And I want this immersive documentation behavior where people can dive into the docs, read through the meanings and the workings of my API. And write in there being able to start writing queries and trying it out, having these interactive embedded sandboxes where you can just get going without ever leaving the documentation. And I also want to collaborate.

2. Customizing GraphQL and Its Evolution

Short description:

Rarely I'm working by myself on a project, so I want to share any kind of queries that I'm writing with my peers, maybe also debugging, and want to easily import export all of the operations that I'm writing between different tools that I'm using. GraphQL version 2 has made significant improvements to address a wider range of problems and provide more flexibility. The addition of a plugin API and the availability of building blocks in GraphQL React make it easier to create custom IDEs. GraphQL continues to evolve and adapt to the changing needs of its growing ecosystem. Now, let's dive into a demo to see how you can customize GraphQL and make it blend seamlessly with your own product.

Rarely I'm working by myself on a project, so I want to share any kind of queries that I'm writing with my peers, maybe also debugging, and want to easily import export all of the operations that I'm writing between different tools that I'm using.

So all in all, a big set of problems. So let's see where does GraphQL fit in as a solution to these problems. Let's start with the initial, the version 1 of GraphQL, which was released back in 2015. This version was really focused and specialized on the learning, exploring and developing part, and it excelled at it. In fact, it's in my opinion a key reason why GraphQL took off and why it got so successful in the first place. Because we had this tool, GraphQL, at our fingertips, where you could just start exploring and playing with GraphQL without needing to set up or install anything. Just open it up in a browser window and go.

The other points, some of them might maybe take a few strides to it, but there was clearly room for improvements still left to do. And, in fact, earlier this year we released the next major version, version 2 of GraphQL, and we also looked at these problems and we figured we need to make GraphQL solve a wider range of these problems and make it more flexible. So what did we do? For example, we added a plugin API, so everybody can now easily write their own GraphQL plugins, which enables you to interact with GraphQL, with its UI, and also render additional components right into the UI that fit your specific API and your specific use cases. We also refactored GraphQL and broke it up into its individual parts and made all of these building blocks available with a new package called GraphQL React. And using these building blocks, it is now more easy than ever before to just take some of these components, plug them together and create your own custom IDE that is very easily embeddable into your products or your websites. Of course, version two is not the end of the road for GraphQL. There will be more things coming in the future and we want to solve an even wider range of use cases and make it even better, but more on that later on. Really coming back to what I'm trying to say here is that GraphQL has seen immense growth over the past years. And with each year there are new tools and new products entering the landscape. And I believe that GraphQL as a tool must not be fixated on the one thing that it did very well back a couple of years ago. GraphQL also needs to evolve together with GraphQL and its ecosystem.

So now is the exciting part because now I want to actually show you what this all means and how you can customize GraphQL. And for this I prepared a demo. I did setup a very simple React application, which at the moment just renders GraphQL. See the app component as my entry point here and it just renders the GraphQL component. And if I take a look at it in my browser, I will see GraphQL version 2, the new version also featuring a new design, but essentially it's the thing you know and love. If we enter a query on the left side, we can also format it and run it and we get back our data on the right side. Awesome. So let's customize this. First thing, maybe, or I hope at least to you, this looks visually appealing, but usually I want to make this blend in with my own product. I don't want to use the colors I see here. I want to use my own brand colors.