Serve
References
CLI Reference

CLI Reference

💡

This page is currently under construction and expected to change. Please feel free to reach out to us directly in case you are having any troubles.

An overview of all the CLI arguments and environment variables for the mesh-serve CLI. Get started with the CLI.

Usage

You can get help with using the CLI by appending the --help argument:

mesh-serve --help

which will print out the following:

Usage: mesh-serve [options]

serve GraphQL federated architecture for any API service(s)

Options:
  --fork [count]            count of workers to spawn. defaults to `os.availableParallelism()` when NODE_ENV is "production", otherwise only one (the main)
                            worker (default: 1, env: FORK)
  -c, --config-path <path>  path to the configuration file. defaults to the following files respectively in the current working directory: mesh.config.ts,
                            mesh.config.mts, mesh.config.cts, mesh.config.js, mesh.config.mjs, mesh.config.cjs (env: CONFIG_PATH)
  -h, --host <hostname>     host to use for serving (default: "0.0.0.0")
  -p, --port <number>       port to use for serving (default: 4000, env: PORT)
  --supergraph <path>       path to the supergraph schema
  --polling <intervalInMs>  schema polling interval in milliseconds (env: POLLING)
  --masked-errors           mask unexpected errors in responses (default: true)
  --help                    display help for command
💡
All arguments can also be configured in the config file.

Environment Variables

In addition to the env vars showcased in the CLI usage, more are available.

These are usually used for easier usage with these two schema registry services. You don’t need any configuration file if you provide these environment variables.

GraphQL Hive

  • HIVE_CDN_ENDPOINT: The endpoint of the Hive CDN to fetch the supergraph. See here
  • HIVE_CDN_KEY: The API key provided by GraphQL Hive for Hive CDN. See here
  • HIVE_REGISTRY_TOKEN: The token to push the metrics to GraphQL Hive. See here

Apollo GraphOS

  • APOLLO_KEY: The API key provided by Apollo GraphOS to fetch the supergraph. See here
  • APOLLO_GRAPH_REF: The API key provided by Apollo GraphOS to fetch the supergraph. See here