Getting started with Shopify CLI
Shopify CLI helps you build Shopify themes and apps. It quickly generates Node.js apps, Ruby on Rails apps, app extensions, and Shopify themes. It also automates many common development tasks.
This documentation explains how to use Shopify CLI for app development. To learn how to use Shopify CLI for theme development, refer to Shopify CLI for themes.
How it works
In Shopify CLI, scaffolded directories of code are called projects.
There are two types of app projects that can be created and managed with the CLI:
Each project type creates a Shopify app with similar features. However, the development experiences are different because of their different programming languages and frameworks.
Before you start
Before you start using Shopify CLI to develop themes, do the following:
- Install Shopify CLI.
- Create a Shopify partner account if you haven't already
- Create a development store to install and test apps
shopify login to log into your Partner account.
- In a terminal, type
- In your browser window, log into your Partner account.
2. Create a new project
shopify node create or
shopify rails create to scaffold a new Node.js app or Rails app in a subdirectory. These commands also create your app in the Partner Dashboard.
After the command finishes executing, the following instructions display in your terminal:
3. Start a local development server
After your app is created, you can work with it immediately by running
shopify node serve or
shopify rails serve to start a local development server.
Shopify CLI uses ngrok to create a tunnel. ngrok chooses a unique URL for your app.
4. Install your app on your development store
With the server running, open a new terminal window and run the following command to open your app in your browser and install it on a development store.
For a Rails app:
For a Node app:
5. Populate test data
Shopify CLI helps with the process of adding example data (such as products, customers, or draft orders) to test your app's behavior. To populate test data, run the following command:
This command asks you to confirm that you want to populate resources for the store that you're logged into.
6. Deploy your app
Using Shopify CLI, you can deploy your app to an external platform. Currently, the only available platform is Heroku. To deploy your app, run the following command. Be sure to specify the project type in the command.
To deploy a rails app:
To deploy a node app:
Read the complete reference documentation of the commands available for the different project types.