GotQL v2.2.0 is a Node.js library that allows you to write GraphQL queries as JavaScript objects instead of strings, wrapping the Got HTTP client. It acts as a transpiler, converting JSON query definitions into proper GraphQL strings and sending them via HTTP. Key differentiators include built-in HTTP client (Got v11+), support for fragments, variables, enums via template literal helper, and nested fields. Release cadence: infrequent, last release Apr 2022. Requires Node >=18 and ESM.
npm install gotqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage with ESM import, constructing a JSON query object and using the query() function with an authorization header.
Use import instead of require, or downgrade to v2.0.8 if CJS required
Create a new object or deep clone before modifying
Refer to Got v11 documentation for options like http2, timeout, etc.
Upgrade to v2.0.8 or later
Upgrade to v2.0.5 or later
Switch to import syntax: import gotql from 'gotql'
Use import gotql from 'gotql' or destructure: import { query } from 'gotql'Ensure query object has structure: { operation: { name: 'operationName', fields: [...] } }