Rafael Corrêa Gomes

Shopify App CLI

Start to create and develop your Shopify Apps in NodeJS or Ruby on Rails
Shopify CLI to NodeJS and Ruby

If you are going to start developing Shopify Apps the Shopify CLI is one of the tools that will optimize a lot your workflow, mainly if you are creating a NodeJS or Ruby on Rails app. If you’re planning to run it in your machine and develop it using VSCode I recommend checking the article about how To Setup Dev Container In VSCode To Develop Shopify NodeJS Apps too.

You can install it on Linux, macOS, or Windows 10, I used it in my MacOs via Homebrew, if you use Linux or macOS these descriptions below will be exactly what you need to know, on Windows you might have some headaches because you will need to install RubyInstaller for Windows or some VM.

Installing Shopify CLI ⚡️

The process to install it and configure it is very simple, as soon as you have the requirements you can set it up in minutes.

Requirements

macOS

$ brew tap shopify/shopify
$ brew install shopify-cli

Debian/Ubuntu Linux

  1. Download the .deb file from the releases page
  2. Install the downloaded file:
$ sudo apt install /path/to/downloaded/shopify-cli-x.y.z.deb

CentOS 8+/Fedora/Red Hat/SUSE Linux

  1. Download the .rpm file from the releases page
  2. Install the downloaded file:
$ sudo yum install /path/to/downloaded/shopify-cli-x.y.x.rpm

Start to use it 👨‍💻

The first step is to create our app automatically via the Shopify CLI, the CLI will ask you some questions, like what’s store that you would like to install it, which Shopify Partner account would you like to use. As soon as you have your base app created you can access the app folder and run the command to start the local server to test it.

  1. Create the app in your terminal.
$ shopify create
  1. Start it.
$ shopify serve

Core commands

These below are all the commands available to you to use after creating the NodeJS app like mine.

connect: Connect (or re-connect) an existing project to a Shopify partner organization and/or a store. Creates or updates the .env file, and creates the .shopify-cli.yml file.

Usage: shopify connect

create: Create a new project.

Usage: shopify create [ node | rails ]

logout: Log out of a currently authenticated partner organization and store, or clear invalid credentials

Usage: shopify logout

version: Prints version number.

Usage: shopify version

deploy: Deploy the current Node project to a hosting service. Heroku is currently the only option, but more will be added in the future.

Usage: shopify deploy [ heroku ]

generate: Generate code in your Node project. Supports generating new billing API calls, new pages, or new webhooks.

Usage: shopify generate [ billing | page | webhook ]

open: Open your local development app in the default browser.

Usage: shopify open

populate: Populate your Shopify development store with example customers, orders, or products.

Usage: shopify populate [ customers | draftorders | products ]

serve: Start a local development node server for your project, as well as a public ngrok tunnel to your localhost.

Usage: shopify serve

tunnel: Start or stop an http tunnel to your local development app using ngrok.

Usage: shopify tunnel [ auth | start | stop ]

Thank you

Let me know what do you think of this CLI if you have used it, if you had some difficulties you can check the original Shopify documentation about it.

About me

Rafael Corrêa Gomes

Rafael Corrêa Gomes

Senior e-commerce developer and architect based in Montreal, Canada. More than ten years of experience developing e-commerces, saas products and managing teams working with Magento, Shopify, PHP, JavaScript, and NodeJS.