Skip to Content
Gqlts

Introducing Gqlts

Type safe Graphql query builder for TypeScript and Node.js

Gqlts generates a typed graphql client for your graphql api to use in browser or node.

This package is forked version from genql  It has been updated, fixed few bugs, actively adding features and updated dependencies and codebase to the latest packages

To use gqlts you first need to generate a sdk client for your graphql api.

Gqlts comes with built-in axios client and typed graphql query builder, file upload, subscription, batching, and more.

Features

  • Type completion
  • Type validation
  • Easily fetch all fields in a type
  • Support subscription ( ws, graphql-ws, observable, etc )
  • Built in file upload support
  • Graphql Client built in
  • Works with any client
  • Works in node and the browser
  • Built in Axios Client, and exported to extend with interceptors.
  • Client Operation support for Axios configuration, such as headers, timeout, cancelToken, abortSignal, etc.
  • Support batching queries
  • Consistent response format { data, errors, extensions }

Find more server-client examples in the examples repo 

import { createClient, everything } from '@gqlts/my-lib' const { data, errors, extensions } = await createClient().query({ User: { name: true, surname: true, address: { ...everything, } } }); // data.User

works in browser and node

Graphql queries written in code

Gqlts generates a graphql client with typescript types, giving you type safety and auto-completion

import { createClient, everything } from '@gqlts/my-lib' const { data, errors, extensions } = await createClient().query({ User: { name: true, surname: true, address: { ...everything, } } })`; // data.User
query { User { name surname address { city state } } }`;
Last updated on