There are many ways to configure your application to use GraphQL, and while it is often enough to specify configuration options directly in your application code, maintaining and understanding the hard-coded configuration options may become a challenge as the scale grows. We recommend configuring your application with a
.graphqlrc file that contains commonly needed GraphQL-related artifacts.
The configuration should be placed on the root folder if you are using workspaces.
Think about GraphQL Config as one configuration for all your GraphQL tools.
The basic idea is to have one configuration file that any GraphQL tool could consume.
From the developer perspective, you gain simplicity and a central place to setup libraries, tools and your IDE extensions.
From the point of view of a library author, GraphQL Config makes it easier to maintain the code responsible for handling configuration, loading GraphQL schemas or even files with GraphQL operations and fragments. GraphQL Config provides a set of useful methods and an easy-to-work-with API.
Learn more in usage docs
would allow you to use
We are using
cosmiconfig to load the schema, and it uses the following flow to look for configurations:
- a JSON or YAML, extensionless "rc file"
- an "rc file" with the extensions
.config.jsCommonJS module, or a
.config.tsTypescript module using