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.
You need to use Node.js to install Shopify CLI and manage its dependencies. However, you can use any technology stack to build your app's functionality.
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 extensions to the Partner Dashboard
Requirements
Anchor link to section titled "Requirements"Getting started
Anchor link to section titled "Getting started"Shopify CLI is managed as a set of Node.js packages:
If you're building a Shopify app, then you don't need to install Shopify CLI globally. Instead, these packages should be added as dependencies of your app. Using Shopify CLI this way enables a consistent development experience across environments.
Because Shopify CLI requires a conventional directory structure, if you're creating a new app, then you should run one of the following commands to initialize your app:
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:
Command reference
Anchor link to section titled "Command reference"Refer to the Shopify CLI app command reference to explore the commands available to build apps with Shopify CLI.
App structure
Anchor link to section titled "App structure"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 app and its 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.
Using Shopify CLI for continuous integration
Anchor link to section titled "Using Shopify CLI for continuous integration"If you have an app extension 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.
Upgrade Shopify CLI
Anchor link to section titled "Upgrade Shopify CLI"To upgrade Shopify CLI 3.x to the latest version, use the upgrade
command:
To check your CLI version, use the version
command:
If the version
command doesn't return a version number, or the upgrade
command fails, then you might be using the previous version of Shopify CLI. To work on an existing app with the newest version of Shopify CLI, you need to migrate your app. Alternatively, you can create a new app that uses Shopify CLI as a dependency.
Migrate to Shopify CLI 3.x
Anchor link to section titled "Migrate to Shopify CLI 3.x"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.
Pre-release CLI versions
Anchor link to section titled "Pre-release CLI versions"If you want to preview functionality from the next release of Shopify CLI, then you can install a pre-release version.
To create a new app with the pre-release CLI version, execute one of the following commands:
To update an existing app with the pre-release Shopify CLI version, execute one of the following commands:
Usage reporting
Anchor link to section titled "Usage reporting"Anonymous usage statistics are collected by default. To opt out, you can use the environment variable SHOPIFY_CLI_NO_ANALYTICS=1
.
Contributing to Shopify CLI
Anchor link to section titled "Contributing to Shopify CLI"Shopify CLI is open source. Learn how to contribute to our GitHub repository.
Where to get help
Anchor link to section titled "Where to get help"- Open a GitHub issue - To report bugs or request new features, open an issue in the Shopify CLI repository.
- Shopify Community Forums - Visit our forums to connect with the community and learn more about Shopify CLI development.