Version: 0.12.x

Graphback CRUD Client Queries Plugin

Graphback CRUD Client plugin

Graphback client plugin allows users to generate client-side queries based on the model and CRUD settings. Developers can embed generated queries into their client-side applications. Generated queries are compatible with all major GraphQL plugins like Apollo and URQL.


npm install @graphback/codegen-client


Client-side queries can be consumed inside any application. When using any GraphQL Clients queries can be compiled and passed to the client methods. For example:


Plugin allows to create files in many formats to suit the needs of your application.

Please refer to ts-apollo-fullstack app for fully functional example:

Plugin Config

* Output language that will be supported
* Our plugin supports multiple languages for simplicity
* - ts - typescript file output (backwards compatibility)
* - graphql - .graphql file
* - gqlwithfragment - complete graphql queries containing fragments for redundancy
format: 'ts' | 'graphql' | 'gqlwithfragment'
* Generate only fragments and skip query, mutation and subscription elements
* This can be particulairly usefull when many custom complex queries are needed
* but they still base on autogenerated fragments
fragmentOnly?: boolean
* RelativePath for the output files created by generator
outputPath: string

Example plugin configuration in YAML:

format: 'graphql'
outputPath: ./client/src/graphql

Note: Plugin require crud configuration specified as part of the graphback extension

How it works

Graphback asks whether you want to generate client-side queries in the graphback config command. Answering 'yes' will setup client generator plugin in your config.

For a data model having

type Note {
id: ID!
title: String!
description: String!

running graphback generate will generate queries and mutations that are enabled in crud config section.