Deploying to Vercel

In this final section of our tutorial, we are going to be learning how to deploy our Next.js and Shopify application live to Vercel.

First, if you do not already have a free account with Vercel, you will need to create one at https://vercel.com/signup. We recommend using your GitHub account to do so.

Once you are logged in, click on the “New Project” button. You will then be presented with a screen where you can import your Git Repository.

screencapture-vercel-new-2022-05-09-15_48_28.png

Find your repo and click the blue “Import” button next to it.

screencapture-vercel-new-2022-05-09-15_45_28.png

For the “Framework Preset” select “Next.js”

Since this is a “monorepo” we have to tell Vercel which directory we wish to deploy. Click on the “EDIT” button next to the “Root Directory.” Then select the “site” directory.

Screen Shot 2022-05-09 at 3.49.59 PM.png

Since we are in a monorepo, we have to override the build command with the following:

cd .. && yarn build

Finally, we need to add all of the environment variables from our site/.env.local file.

Here is what all of my settings look like.

screencapture-vercel-new-import-2022-05-10-09_59_33.png

Click on the “Deploy” button.

If you have done everything correctly, you should be presented with a Congratulations screen.

screencapture-vercel-new-success-2022-05-10-10_01_28.png

After clicking on the “Go to Dashboard” button you will be taken to the dashboard of your application.

You can then click on the “Visit” button to see your live application.

Wrap Up

In this tutorial, we learned how to create a custom Next.js front-end using Shopify as our back-end. We also learned how to test our app with Cypress. We then learned how to run our tests against each Pull Request with GitHub Actions. We then integrated the Cypress dashboard to have all of our tests run in parallel. Finally, we deployed our application live to Vercel.