CLI Configuration

Configure the StepZen CLI for testing and deployment

When you run either stepzen start to deploy and test your schema, you may notice a new file created within your working directory named stepzen.config.json. This is a configuration file used by the StepZen CLI to manage some settings. While you typically do not need to modify this file, there are some cases where you may want to do so.

Modifying the Folder Name and Endpoint Name of a Deploy

When you first call stepzen start for a schema, the CLI will ask you to provide a folder name and endpoint name for the deployed schema. This is required to be in the format folder_name/endpoint_name.

You can choose whatever you like for either value, keeping in mind that this determines the GraphQL endpoint URL that you'll call to access this API. For example, if my account name is brian and I supply a folder name/endpoint name of api/my_first_endpoint, then the GraphQL endpoint URL to query the deployed schema would be https://brian.stepzen.net/api/my_first_endpoint/__graphql.

The endpoint name is stored in the stepzen.config.json file under the endpoint value:

{
  "endpoint": "api/my_first_endpoint"
}

Every subsequent time that you run stepzen start in this directory, the CLI will reference this file to get the folder name and endpoint name to deploy to StepZen. If you'd like to change either of these, you can manually update the file. Thus, if I changed the value to the following:

{
  "endpoint": "api/my_second_endpoint"
}

Assuming my account is still brian, running stepzen start will deploy to https://brian.stepzen.net/api/my_second_endpoint/__graphql. However, it's important to note that:

  • This will not remove the deployed endpoint at api/my_first_endpoint.
  • This will overwrite any existing endpoint at api/my_second_endpoint

Changing the Root Folder for GraphQL Schema Files

By default, the stepzen.config.json currently only contains the endpoint value, but you can add a value for root to customize where the CLI looks for the .graphql schema files.

For example, a common pattern is to build your schema files in a subdirectory of your web application such as /schema or /stepzen. If you would like to be able to run stepzen start from the root of your application and you have the schema files in a stepzen folder, you can add a root property to

{
  "endpoint": "api/my_first_endpoint",
  "root": "stepzen"
}

Running stepzen start from the directory will now look for the .graphql files in the /stepzen folder.

This site uses cookies: By using this website, you consent to our use of cookies in accordance with our Website Terms of Use and Cookie Policy.