GenQL
GenQL is a fantastic library and CLI tool allowing to automatically generate a fully typed SDK with a builtin GQL client. It works flawlessly with Hasura and is currently a recommended way to use DipDup on the client side.

Project structure

GenQL CLI generates a ready-to-use package, already compiled and prepared to be published to NPM. A typical setup is a mono repository containing several packages including the auto-generated SDK and your front-end application.
1
project_root/
2
├── package.json
3
└── packages/
4
├── app/
5
│ ├── package.json
6
│ └── src/
7
└── sdk/
8
└── package.json
Copied!

SDK package config

Your minimal package.json file will look like the following:
1
{
2
"name": "%PACKAGE_NAME%",
3
"version": "0.0.1",
4
"main": "dist/index.js",
5
"types": "dist/index.d.ts",
6
"devDependencies": {
7
"@genql/cli": "^2.6.0"
8
},
9
"dependencies": {
10
"@genql/runtime": "2.6.0",
11
"graphql": "^15.5.0"
12
},
13
"scripts": {
14
"build": "genql --esm --endpoint %GRAPHQL_ENDPOINT% --output ./dist"
15
}
16
}
17
Copied!
That's it! Now you only need to install dependencies and execute the build target:
1
yarn
2
yarn build
Copied!
Last modified 5mo ago