Home

Awesome

<div align='center'> <br/> <br/> <img src='https://genql.dev/banner.png' width='380px'> <br/> <br/> <h3>Type safe Graphql query builder</h3> <h4>Write Graphql queries with type validation and auto completion</h4> <br/> <br/> </div>

[!IMPORTANT] Genql is building a cloud platform to automate SDK generation in multiple languages, docs website with examples, changelog website and more. Fill this form if you are interested!

Read the quick start guide to generate your client and start writing queries.

You can stay up to date with the latest changes subscribing to the Genql changelog.

Features

Example

First generate your client with the genql cli.

You can find other cli options here

npm i -D @genql/cli # cli to generate the client code
genql --schema ./schema.graphql --output ./generated

Then you can use your client as follow

import { createClient, everything } from './generated'
const client = createClient()

client
    .query({
        countries: {
            // pass arguments to the query
            __args: {
                filter: {
                    currency: {
                        eq: 'EUR',
                    },
                },
            },
            name: true,
            code: true,
            nestedField: {
                // fetch all scalar fields
                __scalar: true,
            },
        },
    })
    .then(console.log)

The code above will fetch the graphql query below

query {
    countries(filter: { currency: { eq: "EUR" } }) {
        name
        code
        nestedField {
            scalarField1
            scalarField2
        }
    }
}

Why

Genql has a lot of benefits over writing graphql queries by hand:


Sponsors

Notaku

Notaku

Vercel


Licensed under MIT.