Shopify CLI commands for apps
This reference lists the commands that you can use to build apps with Shopify CLI.
Command overview
Anchor link to section titled "Command overview"Topic | Command | Description |
---|---|---|
app | dev | Builds the app and lets you preview it on a development store. |
info | Displays information about your app. | |
scaffold | Creates additional components for your app. Right now, you can only scaffold app extensions. | |
build | Builds the app, including extensions. | |
deploy | Builds the app and deploys all of the extensions in your app to Shopify. | |
ngrok | auth | Saves a token to authenticate against Ngrok. |
auth | logout | Logs you out of your Shopify Partner account. |
none | help | Lists the available commands and describes what they do. |
version | Lists the version of Shopify CLI included in the project. | |
upgrade | Upgrades the @shopify/cli and @shopify/app packages to their latest versions. |
|
logs | Displays the last 5 MB of verbose CLI logs in the terminal. |
Command syntax
Anchor link to section titled "Command syntax"Shopify CLI commands should only be run in a project where Shopify CLI is installed.
You can run all Shopify CLI commands using the run
command:
You can also run some commands as scripts, which use an abbreviated syntax:
Some package managers require a separator to pass flags to the script:
Builds the app, and lets you preview your app on a development store.
To preview your app on a development store, Shopify CLI walks you through the following steps. If you've run dev
before, then your settings are saved and some of these steps are skipped:
- Associating your project with an app associated with your Partner account or organization, or creating a new app.
- Selecting a development store to use for testing. If you have only one development store, then this store is selected automatically.
- Installing your app on your development store using the provided install link.
Creating a tunnel between your local environment and the development store using ngrok.
You can use your own tunnel provider instead by passing your tunnel URL with the
--tunnel-url
flag.Updating the app URLs that are set in the Partner Dashboard.
Building and serving your app and app extensions.
You need to create an ngrok account and auth token to preview your app using Shopify CLI. To learn more about creating an auth token, refer to ngrok’s documentation.
Flag | Alias | Description |
---|---|---|
--tunnel-url |
The URL of a tunnel that you've started using a tunnel provider. Shopify recommends Cloudflare tunnel for use with Shopify CLI. Expected format: https://my-tunnel-url:port |
|
--store <store> |
-s <store> |
The development store that you want to use to preview your app. The --store flag accepts the following inputs:
|
--api-key <key> |
The API key of your app. Use this flag to specify the app that you want connect your project with. | |
--no-update |
Don't update the app URLs that are set in the Partner Dashboard. You might want to use this option if you're working on an app that's already deployed in one or more merchant stores. | |
--path <path> |
The path to your app directory. | |
--skip-dependencies-installation |
Skip checking and installing missing dependencies for your app. | |
--reset |
Reset all of your dev settings. |
|
--verbose |
Provide more detailed output in the logs. | |
--checkout-cart-url |
A partial link with a product variant ID and quantity to be used to create a test checkout for checkout UI extensions. If the flag isn't passed, then Shopify CLI auto-populates this value. To test with a specific product variant ID and quantity, you can provide the flag as --checkout-cart-url "/cart/12345:1" , where 12345 is the product variant ID and :1 is the quantity. |
|
--subscription-product-url |
A partial link with a product ID. Use this flag to specify the product to use when testing a purchase option extension. If the flag isn't passed, then Shopify CLI auto-populates this value. To test with a specific product ID, you can provide the flag as --subscription-product-url "/products/12345" , where 12345 is the product ID. |
Displays information about your app.
The information returned includes the following:
- The app and development store that's used when you run the
dev
command. You can reset these configurations usingdev --reset
. - The structure of your app project.
- The access scopes your app has requested.
- System information, including the package manager and version of Shopify CLI used in the project.
Flag | Description |
---|---|
--path <path> |
The path to your app directory. |
--verbose |
Provide more detailed output in the logs. |
--json |
Output the app info in JSON format. |
--web-env |
Display your API key, secret, and access scopes for use in a deployment pipeline. |
Creates additional components for your app. Right now, you can only scaffold app extensions. For a list of app extension types that you can scaffold using this command, refer to Supported extension types.
Each new app extension is created in a folder under extensions/
. To learn more about the extensions file structure, refer to App structure and the documentation for your extension type.
Flag | Alias | Description |
---|---|---|
--name <name> |
-n <name> |
The name of your extension. |
--type <type> |
-t <type> |
The extension type. See supported extension types. |
--path <path> |
The path to your app directory. | |
--verbose |
Provide more detailed output in the logs. | |
--template |
Choose the language of the template that you want to start with. This flag is only supported for post-purchase and subscription app extensions. Accepted values: vanilla-js or react |
Supported extension types
Anchor link to section titled "Supported extension types"Extension type | type flag value |
---|---|
Checkout UI | checkout_ui_extension |
Post-purchase UI | checkout_post_purchase |
Subscription UI | product_subscription |
Theme app extension | theme |
Web pixel | web_pixel_extension |
Order discount | order_discounts |
Product discount | product_discounts |
Shipping discount | shipping_discounts |
Builds the app, including extensions.
This command executes the build script specified in the element's TOML file. You can specify a custom script in the file. To learn about configuration files in Shopify apps, refer to App structure.
If you're building a theme app extension, then running the build
command runs Theme Check against your extension to ensure that it's valid.
Flag | Description |
---|---|
--api-key |
Specify the API key to use when building the app. This API key is set as an environment variable, which is used by App Bridge. This flag is only required when building your app for production. |
--skip-dependencies-installation |
Skip checking and installing missing dependencies for your app. |
--path <path> |
The path to your app directory. |
--verbose |
Increase the verbosity of the logs. |
Builds the app and deploys all of the extensions in your app.
If your app contains any versioned app extensions, then you need to navigate to your app in the Partner Dashboard to version and publish the extensions after you run this command.
This command doesn't deploy the contents of your web/
folder. When you're ready to deploy your app to production, you need to deploy the content under this folder to your own hosting solution, and update the App URLs in the Partner Dashboard to point to your production environment.
The deployment process includes the following steps. If you've run dev
or deploy
before, then some of these steps are skipped.
- Associating your project with an app associated with your Partner account or organization, or creating a new app.
- Registering any unregistered extensions with the app
- Building the app
- Bundling any app extensions and performing validations on the bundle
- Pushing the bundle to Shopify
Flag | Description |
---|---|
--reset |
Reset all of your deploy settings. |
--path <path> |
The path to your app directory. |
--verbose |
Provide more detailed output in the logs. |
Saves a token to authenticate against ngrok.
ngrok is used to create an HTTP tunnel to your local development environment. You need to create an ngrok account and auth token to use an ngrok tunnel with Shopify CLI. To learn more about creating an auth token, refer to ngrok’s documentation.
auth logout
Anchor link to section titled "auth logout"Logs you out of the Shopify account or Partner account and store.
Lists the available commands and describes what they do.
You can add a help flag to any command to learn more about it. Use --help
or -h
.
Lists the version of Shopify CLI included in the project.
If nothing is returned from this command, then your project isn't using Shopify CLI 3.0 or higher, and you might need to migrate.
Shopify CLI acts as a dependency of your app. This command upgrades the @shopify/cli
and @shopify/app
dependencies to their latest versions.
Flag | Description |
---|---|
--path <path> |
The path to your app directory. |
Displays the last 5 MB of verbose CLI logs in the terminal.
This command displays verbose logs even if you didn't run commands with a --verbose
flag.
You can dump the logs to a file for further processing: