nitrogql logonitrogql

Configuration File Name

A configuration file is to be placed in the root of your project. The nitrogql CLI will automatically search for a configuration file in the current directory.

Default config file name

By default, configuration file is searched in the following order:

  1. graphql.config.json
  2. graphql.config.yaml
  3. graphql.config.yml
  4. graphql.config.js
  5. graphql.config.mjs
  6. graphql.config.cjs
  7. graphql.config.ts
  8. graphql.config.mts
  9. graphql.config.cts
  10. .graphqlrc
  11. .graphqlrc.json
  12. .graphqlrc.yaml
  13. .graphqlrc.yml
  14. .graphqlrc.js
  15. .graphqlrc.mjs
  16. .graphqlrc.cjs
  17. .graphqlrc.ts
  18. .graphqlrc.mts
  19. .graphqlrc.cts

Using JavaScript/TypeScript configuration files

nitrogql supports configuration files written in JavaScript or TypeScript (both CommonJS and ES Module syntax are supported). When using a JavaScript configuration file, an ES Module configuration file should default-export the configuration object. A CommonJS configuration file should assign the configuration object to module.exports.

import type { NitrogqlConfig } from "@nitrogql/cli";

const config: NitrogqlConfig = {
  schema: "./schema/*.graphql",
  documents: ["./app/**/*.graphql", "./common/**/*.graphql"],
  // ...
};

export default config;