On this article, I’ll information you thru the method of deploying Vue Storefront 2 utility with Shopify integration to Heroku in 5 minutes!
What’s Vue Storefront?
Vue Storefront is Lightning-Quick Frontend Platform for Headless Commerce. Enhance your website efficiency, form the shopper journey and free your developer’s creativity with Vue Storefront, the final frontend you’ll ever want.
Code
Very first thing we would wish to do to be able to generate a brand new Vue Storefront 2 venture is to run the CLI with a following command:
npx @vue-storefront/cli init
The CLI will ask you concerning the title of your venture and your required integration.
For this tutorial, I’ve chosen Shopify as indicated by the next screenshot:
The venture construction ought to look roughly like the next:
Now, let’s set up all of the required depedencies by working:
yarn
And run the venture in improvement mode to see if it really works as anticipated:
yarn dev
Once you open a browser tab with http://localhost:3001
you need to see following outcome:
The very last thing that we have to change to ensure that our utility to work is to exchange the atmosphere variable from APP_PORT
to PORT
in nuxt.config.ts
:
server: 3001, // Beforehand course of.env.APP_PORT
host: '0.0.0.0'
,
This may permit Heroku to construct the venture appropriately and serve it on appriopriate port.
Heroku
As a way to deploy Vue Storefront to Heroku, we would wish to put in heroku CLI that’s described here
Within the meantime, we may setup required atmosphere variables for our Heroku occasion:
I’ll copy them beneath for simpler testing:
BASE_URL=vsf-heroku.herokuapp.com
HOST=0.0.0.0
SHOPIFY_DOMAIN=vsf-next-pwa.myshopify.com
SHOPIFY_STOREFRONT_TOKEN=03f21475b97c18fa05c0ab452c368af4
Subsequent, we have to login from our Vue Storefront venture with the next command:
heroku login
Let’s add a distant git for heroku with the title that we like:
heroku git:distant -a vsf-heroku
Lastly if we’re prepared, we are able to push new code to the heroku department:
git push heroku major
If every part went as anticipated, we must always see the next outcome when visiting the https://vsf-heroku.herokuapp.com/
:
Abstract
Effectively performed! You’ve got simply deployed and hosted a Vue Storefront 2 Utility on Heroku! Proper now, I like to recommend you to take a look at the Vue Storefront docs to see how one can lengthen your utility with integrations and modules.