hydrogen preview
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.
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.
Runs a server in your local development environment that serves your Hydrogen app's production build. Build first with shopify hydrogen build, or pass --build.
Anchor to flagsFlags
The following flags are available for the hydrogen preview command:
- Anchor to --build--build--build
Builds the app before starting the preview server.
- Anchor to --codegen--codegen--codegen
Automatically generates GraphQL types for your project’s Storefront API queries.
- Anchor to --codegen-config-path <value>--codegen-config-path <value>--codegen-config-path <value>stringstring
Specifies a path to a codegen configuration file. Defaults to
<root>/codegen.tsif this file exists.- Anchor to --debug--debug--debugenv: SHOPIFY_HYDROGEN_FLAG_DEBUGenv: SHOPIFY_HYDROGEN_FLAG_DEBUG
Enables inspector connections to the server with a debugger such as Visual Studio Code or Chrome DevTools.
- Anchor to --entry <value>--entry <value>--entry <value>stringstringenv: SHOPIFY_HYDROGEN_FLAG_ENTRYenv: SHOPIFY_HYDROGEN_FLAG_ENTRY
Entry file for the worker. Defaults to
./server.- Anchor to --env <value>--env <value>--env <value>stringstring
Specifies the environment to perform the operation using its handle. Fetch the handle using the
env listcommand.- Anchor to --env-branch <value>--env-branch <value>--env-branch <value>stringstringenv: SHOPIFY_HYDROGEN_ENVIRONMENT_BRANCHenv: SHOPIFY_HYDROGEN_ENVIRONMENT_BRANCH
Specifies the environment to perform the operation using its Git branch name.
- Anchor to --env-file <value>--env-file <value>--env-file <value>stringstring
Path to an environment file to override existing environment variables. Defaults to the '.env' located in your project path
--path.- Anchor to --inspector-port <value>--inspector-port <value>--inspector-port <value>stringstringenv: SHOPIFY_HYDROGEN_FLAG_INSPECTOR_PORTenv: SHOPIFY_HYDROGEN_FLAG_INSPECTOR_PORT
The port where the inspector is available. Defaults to 9229.
- Anchor to --json-schema--json-schema--json-schemaenv: SHOPIFY_FLAG_JSON_SCHEMAenv: SHOPIFY_FLAG_JSON_SCHEMA
Print the command's JSON schemas.
- Anchor to --path <value>--path <value>--path <value>stringstringenv: SHOPIFY_HYDROGEN_FLAG_PATHenv: 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 --port <value>--port <value>--port <value>stringstringenv: SHOPIFY_HYDROGEN_FLAG_PORTenv: SHOPIFY_HYDROGEN_FLAG_PORT
The port to run the server on. Defaults to 3000.
- Anchor to --verbose--verbose--verboseenv: SHOPIFY_HYDROGEN_FLAG_VERBOSEenv: SHOPIFY_HYDROGEN_FLAG_VERBOSE
Outputs more information about the command's execution.
- Anchor to --watch--watch--watch
Watches for changes and rebuilds the project.
hydrogen preview
Examples
Hydrogen preview
hydrogen preview
shopify hydrogen preview [flags]