What is the process to deploy an app for production?

What is the process to deploy an app for production?

joeyzhao
Shopify Partner
5 0 4

I am reading a doc about how to setup an app in shopify: https://shopify.dev/apps/getting-started/create. But it only shows how to do that in development mode which is using ngrok as the backend entry url. If I deploy my backend for production, what is the way to integrate with shopify? I can't find some document relate to that. The app created by shopify cli hides many detailed information, like what each entry point mean in the express application.

Is there a doc about how to do the formal production deployment/release?

Replies 8 (8)

AlexKokobane
Shopify Partner
11 0 2

Try to to think of a Shopify app like any web app except it uses Shopify APIs to extent the functionality of the platform.

 

You can host an Express app almost everywhere but most devs love Heroku for its ease of use (look into it).

 

If you're relatively new to web development, the CLI might be too high level for you to understand the platform (it was in my case), I recommend you check out the tutorial from their NodeJs API library on Github https://github.com/Shopify/shopify-node-api

Alex here, the Creator of Windfall, an app for creating giveaways and awarding shop discount vouchers as prizes. Feel free to DM or email me at alex@makamuta.com if you'd like to know more about how Windfall can help you increase your revenue.
joeyzhao
Shopify Partner
5 0 4

I understand it is a regular app. But what entry point I should implement in my express server? For example, I may need to define some `POST` entry point to let shopify call my service. What is the API spec shopify expects? how many entry points do I need to support a simple app running in shopify?

AlexKokobane
Shopify Partner
11 0 2

Oh for that you need an authentication 'GET' API endpoint in your app, could be anything but it's commonly '/auth'. This is the endpoint that needs to be specified in your partner dashboard's app set up. It will be the first endpoint that gets called when a merchant installs your app from the app store. This auth process is where you'll be able to create your session token for your app to be able to communicate with the API on a merchant's behalf. That's what they mean by entry point.

Alex here, the Creator of Windfall, an app for creating giveaways and awarding shop discount vouchers as prizes. Feel free to DM or email me at alex@makamuta.com if you'd like to know more about how Windfall can help you increase your revenue.
joeyzhao
Shopify Partner
5 0 4

yes, it is exactly what I mean by entry point. Thanks for your info. The question is where I can find the document about all the entry points I need to setup for the requests from shopify. Like `/auth` is one example, I can see there is some webhook related paths. What are the others and the spec definition for them.

AlexKokobane
Shopify Partner
11 0 2

There isn't any documentation specific to Express, most of them are all over the place, I personally learn most concepts incrementally but what made everything fall into perspective for me has to be this readme https://github.com/Shopify/shopify-node-api/tree/main/docs on Node API library, it has vanilla Node and Express examples. The tutorial covers just about everything you need to get started.

 

But I doubt there's one such tutorial specific to the CLI app template since this template is always changing drastically, so they presume we know what fits where in most cases (which much like you I found frustrating).

Alex here, the Creator of Windfall, an app for creating giveaways and awarding shop discount vouchers as prizes. Feel free to DM or email me at alex@makamuta.com if you'd like to know more about how Windfall can help you increase your revenue.
den232
Shopify Partner
223 8 57

Sadly, your readme is no longer in existence.  jb

PriyankaGadhiya
Shopify Partner
1 0 0

Hello @joeyzhao 

Have you got any answer? How we can deploy our app for production?

btrain-004
Shopify Partner
12 0 3

What @AlexKokobane said is correct. Once you begin the act of deploying, this is merely an express app, and depending on which cloud provider you are utilizing, instructions could drastically change. 

 

However, I'll tell you my specific solution. 

When running Shopify app dev, there is a wrapper around your environment that provides a global 

configuration for the following:

 

  apiKey: 'APIKeyFromPartnersDashboard',
  apiSecretKey: 'APISecretFromPartnersDashboard',
  scopes: ['read_products'],
  hostName: 'ngrok-tunnel-address',

 

So when you deploy you'll need to provide that directly into the API parameters. 

 

I am currently using Shopify cli 3.47.5 and I didn't really make that many core changes. So if you are following my current version it should look the same.

 

With in my "/web/shopify.js" I have the following

 

 

 

const shopify = shopifyApp({
  api: {
    apiKey: process.env.SHOPIFY_API_KEY,
    apiSecretKey: process.env.SHOPIFY_API_SECRET,
    hostName: process.env.SHOPIFY_APP_URL.replace(/https?:\/\//, ""),
    apiVersion: LATEST_API_VERSION,
    restResources,
    billing: undefined, // billingConfig,
  },
  auth: {
....

 

 

 

Since I am using Heroku. I followed Shopify's instructions on how to deploy to heroku.

But I also had to add a "start" script in my package.json

 

It looks something like this.

 

 

...
  "start": "cd web && npm run serve",
...

 

 

 

Hope this helps!