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.
- Shopify partner account
- Shopify development store to install and test apps
- Ruby 2.5.1+
$ brew tap shopify/shopify $ brew install shopify-cli
- Download the .deb file from the releases page
- Install the downloaded file:
$ sudo apt install /path/to/downloaded/shopify-cli-x.y.z.deb
CentOS 8+/Fedora/Red Hat/SUSE Linux
- Download the .rpm file from the releases page
- 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.
- Create the app in your terminal.
$ shopify create
- Start it.
$ shopify serve
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.
create: Create a new project.
shopify create [ node | rails ]
logout: Log out of a currently authenticated partner organization and store, or clear invalid credentials
version: Prints version number.
deploy: Deploy the current Node project to a hosting service. Heroku is currently the only option, but more will be added in the future.
shopify deploy [ heroku ]
generate: Generate code in your Node project. Supports generating new billing API calls, new pages, or new webhooks.
shopify generate [ billing | page | webhook ]
open: Open your local development app in the default browser.
populate: Populate your Shopify development store with example customers, orders, or products.
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.
tunnel: Start or stop an http tunnel to your local development app using ngrok.
shopify tunnel [ auth | start | stop ]
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.