Skip to main content

hydrogen generate route

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.

Generates the selected route group from the starter template. Choose home, page, cart, products, collections, policies, blogs, account, search, robots, sitemap, or all.

The following flags are available for the hydrogen generate route command:

Anchor to --adapter <value>
--adapter <value>
string
env: SHOPIFY_HYDROGEN_FLAG_ADAPTER

React Router adapter used in the route. The default is react-router.

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

Print the command's JSON schemas.

Anchor to --locale-param <value>
--locale-param <value>
string
env: SHOPIFY_HYDROGEN_FLAG_ADAPTER

The param name in Remix routes for the i18n locale, if any. Example: locale becomes ($locale).

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 --typescript
--typescript
env: SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT

Generate TypeScript files

Anchor to -f, --force
-f, --force
env: SHOPIFY_HYDROGEN_FLAG_FORCE

Overwrites the destination directory and files if they already exist.

Examples

hydrogen generate route

shopify hydrogen generate route <routeName> [flags]

Was this page helpful?