Top 5 tools every frontend developer should be using with GraphQL in 2023
Tags: webdev, graphql, tooling, beginners
Published: 2023-05-31 08:33:01

Every week, a bunch of fresh tools, services, and libraries make their debut, claiming to take the GraphQL developer experience to the next level.

{% embed https://www.youtube.com/watch?v=AV4Amf3Mag0 %}

Here are my top 5 tools every frontend developer should be using with GraphQL in 2023:

## 1. Grafbase OpenAPI Connector

Maximize the power of web and mobile app development by effortlessly blending REST and GraphQL APIs with Grafbase. Say goodbye to complexity and hello to a unified GraphQL API that supercharges your app development process.

Enter [OpenAPI](https://en.wikipedia.org/wiki/OpenAPI_Specification), formerly known as Swagger - the ultimate game-changer for API definition and documentation. It simplifies things by describing APIs in a format that machines understand, making it easier for developers to work with all kinds of APIs. And with [Grafbase Edge Gateway](https://grafbase.com/edge-gateway), you can seamlessly merge OpenAPI-driven REST APIs and transform them into GraphQL, taking your stack to a whole new level of awesomeness.

```graphql
extend schema
  @openapi(
    name: "Stripe"
    schema: "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"
    headers: [
      { name: "Authorization", value: "Bearer {{ env.STRIPE_API_KEY }}" }
    ]
  ) {
  query: Query
}
```

It's free to get started and you don't even need an account to build locally:

```bash
npx grafbase init --template openapi-stripe
```

## 2. GraphQL Code Generator &mdash; Client Preset

The type system in GraphQL is a major game-changer. We can leverage the GraphQL Code Generator to use that same type system to generate TypeScript types so we can build better frontends without error.

In the past, we relied on the GraphQL Code Generator to generate hooks for our existing GraphQL clients. But it was a pain when we wanted to switch to new clients.

The GraphQL Code Generator recommends using the [`client-preset`](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) and [`TypedDocumentNode`](https://the-guild.dev/graphql/codegen/plugins/typescript/typed-document-node) to level up our functions and make sure we're getting the correct operation and variable types.

Plus, it's all about keeping operations and fragments in their own components. This approach reduces code complexity, keeps things tidy, and makes it a breeze to switch to any GraphQL client that supports `TypedDocumentNode`.

```tsx
export const LessonFragment = graphql(/* GraphQL */ `
  fragment LessonItem on Lesson {
    title
  }
`)

export function Lesson(props: { lesson: FragmentType<typeof LessonFragment> }) {
  const lesson = useFragment(LessonFragment, props.lesson)

  return (
    // Fully typed!
    <li>{lesson.title}</li>
  )
}
```

## 3. GQty

Are you tired of the hassle of writing GraphQL operations and configuring codegen for TypeScript? Say goodbye to all that and switch to [GQty](https://gqty.dev/)!

With GQty, you don't even need a separate GraphQL client. It's like magic! GQty takes care of transforming your code into a GraphQL operation behind the scenes. So sit back, relax, and let GQty handle all the heavy lifting for you.

```tsx
import type { FunctionComponent } from 'react'
import { useQuery } from '../gqty/'

const Query: FunctionComponent = () => {
  const {
    me: { name, friends }
  } = useQuery()

  return (
    <>
      Hello {name}!
      <ol>
        {friends().map(user => (
          <li key={user.id}>{user.name}</li>
        ))}
      </ol>
    </>
  )
}

export default Query
```

## 4. GraphQL Network Inspector

The days of struggling to identify `/graphql` requests in the Network Inspector are over!

[GraphQL Network Inspector](https://github.com/warrenday/graphql-network-inspector), an awesome extension for developer tools that makes debugging a breeze. 

![GraphQL Network Inspector](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fkyrn7rqj9f5sji90j1.png)

It categorizes requests into queries, mutations, and subscriptions and even uses the GraphQL operation name. Say goodbye to confusion and hello to simplified debugging.

## 5. GraphMan

[GraphMan](https://github.com/Escape-Technologies/graphman) takes away all the boring and time-consuming aspects of crafting queries and mutations for a GraphQL API. 

With GraphMan, you can effortlessly generate a comprehensive collection from a single GraphQL endpoint. Each collection includes requests for every query and mutation, all conveniently pre-filled variables.

To create a collection, just pass your Grafbase API URL to the command below. It's that easy!

```bash
deno run https://deno.land/x/graphman@v1.2.1/src/cli.ts GRAFBASE_API_URL_HERE
```

## Join us at GraphQL Conf

Do you want to learn more about GraphQL? Join us at GraphQL Conf this year. [Get your tickets now](https://graphql.org/conf/).