Getting started

This guide will help you create a gqless client for a GraphQL endpoint.


Install the following dependencies to your project:

yarn add gqless
yarn add @gqless/cli --dev


gqless requires information about your schema, which is generated using the CLI.

Create a new file named gqless.config.json at the root of your project, with the following contents:

You can also use the gqless key in your package.json, or gqless.config.{js,ts}

"url": "",
"outputDir": "src/graphql"

Next add a generate script to your package.json:

"scripts": {
"generate": "gqless generate"

And then run the script to generate your schema:

yarn generate

A folder will then be created with the following structure:

├── extensions/ # All your extensions go in this folder
├── generated/ # Ignore this folder
├── client.ts # gqless client is exported from here
└── index.ts


Ensure that the fetchQuery in src/gqless/client.ts is correct, modifying it if need be.

You should then be able to use the client ✨

import { query } from './gqless'
// for example

See Usage with React

Last updated on by Sam Denty