Skip to main content

About Shopify CLI for apps

Shopify CLI is a command-line interface tool that helps you build Shopify apps. It quickly generates Shopify apps and generates app extensions. You can also use it to automate many common development tasks.

This documentation explains how to use Shopify CLI for app development. To learn how to use Shopify CLI for other tasks, refer to the following documentation:


Shopify CLI accelerates your app development process with the following features:

  • Creates new apps using app templates
  • Generates app extensions in your app
  • Creates app records in the Partner Dashboard
  • Builds your app and extensions, and creates a tunnel to let you preview your work in a development store
  • Deploys your app configuration and app extensions
  • Lets you search the Shopify Dev Docs


Because Shopify CLI requires a conventional directory structure, you should run this command to initialize your app:

Terminal

shopify app init
Tip

You can specify the app template that you want to use with the --template flag. You can specify a Shopify app template, or pass a URL to a template hosted in GitHub.

If you have an existing app that wasn't built using Shopify CLI, you can migrate your app to Shopify CLI for a fully integrated development experience.

Refer to the following tutorials for additional details about creating an app that works with Shopify CLI, or to learn how to work on an existing app that uses Shopify CLI 3.0 or higher:


To offer a better and more integrated development experience, apps created using Shopify CLI follow a conventional directory structure. This structure allows you to serve and deploy your web app and app extensions at the same time, easily generate new app extensions, and manage all of your app's dependencies in one place.

Learn more about the structure of apps built with Shopify CLI.


Anchor to Using Shopify CLI for continuous integrationUsing Shopify CLI for continuous integration

If you have app configuration and extensions that you want to deploy to Shopify regularly, then you can integrate Shopify CLI into your CI/CD pipeline to programmatically deploy your app components using the deploy command.

Learn more about running Shopify CLI in a CI/CD pipeline.


Anchor to Migrate from a Partner Dashboard-managed appMigrate from a Partner Dashboard-managed app

If you've been using the Partner Dashboard to manage your app, then you should consider importing it and using Shopify CLI to manage it instead.


Anchor to Migrate to Shopify CLI 3.xMigrate to Shopify CLI 3.

To offer a better and more integrated development experience, apps created Shopify CLI 3.x follow a conventional directory structure and manage your Node-based dependencies for you.

If you have an app that was created using a previous version of Shopify CLI, or without Shopify CLI, then you can migrate your app so you can use the newest version of Shopify CLI.


Anonymous usage statistics are collected by default. To opt out, you can use the environment variable SHOPIFY_CLI_NO_ANALYTICS=1.


Anchor to Switch to a global executable or local dependencySwitch to a global executable or local dependency

Shopify CLI can be globally installed or used as a local dependency when working with Shopify apps. This following sections explains the reasons for using each installation method and the process for switching between them.

Anchor to Switch to a global Shopify CLI executableSwitch to a global Shopify CLI executable

Global installation is the default recommended approach for using Shopify CLI. Global installation has the advantage of a single install and upgrade point for all your Shopify app, theme, and Hydrogen development.

If you have an existing app which has Shopify CLI as a local dependency in its package.json, use the following steps to move to a global install:

  1. Use your package manager to delete @shopify/cli and (if present) @shopify/app from your dependencies:

Terminal

npm uninstall -D @shopify/cli @shopify/app
yarn remove -D @shopify/cli @shopify/app
pnpm remove -D @shopify/cli @shopify/app
  1. Install Shopify CLI as a global package.

  2. Invoke Shopify CLI directly when working in your app. For example:

Terminal

shopify app generate extension

Anchor to Switch an app to a local Shopify CLI dependencySwitch an app to a local Shopify CLI dependency

Adding Shopify CLI as a local dependency is useful if you wish to synchronize Shopify CLI versions within a team, or use different Shopify CLI versions across multiple apps in your development environment.

To switch an app to use Shopify CLI as a local dependency:

  1. Install the @shopify/cli package with one of the following commands.

Terminal

npm install -D @shopify/cli
yarn add -D @shopify/cli
pnpm add -D @shopify/cli
Note

As of Shopify CLI version 3.59.0, you no longer need to install the @shopify/app package as it is bundled with @shopify/cli.

  1. Invoke Shopify CLI commands with your package manager. For example:

Terminal

npm run shopify app generate extension
yarn shopify app generate extension
pnpm shopify app generate extension

  • Open a GitHub issue - To report bugs or request new features, open an issue in the Shopify CLI repository.
  • .dev Community - Visit our forums to connect with the community and learn more about Shopify CLI development.


Was this page helpful?