Skip to main content

hydrogen codegen

Hydrogen 2026-04 and earlier

This command works with Hydrogen 2026-04 and earlier. Hydrogen 2026-10 doesn't support the command. In a Hydrogen 2026-10 project, use your framework's commands or the @shopify/hydrogen commands instead. To check which commands Hydrogen 2026-10 supports, refer to Shopify CLI Hydrogen commands.

Automatically generates GraphQL types for your project’s Storefront API queries.

The following flags are available for the hydrogen codegen command:

Anchor to --codegen-config-path <value>
--codegen-config-path <value>
string

Specify a path to a codegen configuration file. Defaults to <root>/codegen.ts if it exists.

Anchor to --json-schema
--json-schema
env: SHOPIFY_FLAG_JSON_SCHEMA

Print the command's JSON schemas.

Anchor to --path <value>
--path <value>
string
env: SHOPIFY_HYDROGEN_FLAG_PATH

The path to the directory of the Hydrogen storefront. Defaults to the current directory where the command is run.

Anchor to --watch
--watch

Watch the project for changes to update types on file save.

Examples

hydrogen codegen

shopify hydrogen codegen [flags]

Was this page helpful?