CLI Configuration (gqless.config.cjs)
The GQless CLI reads project settings from gqless.config.cjs (or .js) at the repository root. Keeping introspection endpoints, scalar mappings, and output paths in one declarative file guarantees deterministic builds across local workstations and CI runners.
Example Configuration
/** @type {import('@gqless/cli').GQlessConfig} */
module.exports = {
introspection: {
endpoint: process.env.GRAPHQL_ENDPOINT || 'https://api.example.com/graphql',
headers: {
Authorization: `Bearer ${process.env.INTROSPECTION_TOKEN || ''}`,
},
},
destination: './src/gqless/index.ts',
subscriptions: false,
javascriptOutput: false,
scalarsEnumsHash: {
DateTime: 'string',
JSON: 'Record<string, unknown>',
UUID: 'string',
},
};
Key Options Explained
introspection.endpoint: Accepts an HTTPS URL or a local glob path to.graphqlSDL files when production introspection is disabled per GraphQL specification best practices.scalarsEnumsHash: Maps custom backend scalars (such asDateTimeorBigInt) to concrete TypeScript types instead of falling back toany.destination: Target directory for CLI codegen output.
After updating your config, re-run codegen and verify runtime error handling in the GQlessError reference.