Guide To Build a Shopify App with Node.js & Express?

If you’re a developer and want to build a Shopify app , this article is perfect for you.

In this guide, we’ll go through the steps of Build a Shopify App with Node.js & Express!

  1. What is a Shopify App

A Shopify App is a tool that helps store owners manage their businesses. It can create and manage orders, track inventory, and manage customer data.

  1. Why Build a app for Shopify

If you’re a developer and you want to build a Shopify App then there are a few reasons why you might want to do this:

  1. The Shopify platform is increasing, and there’s a lot of potential for growth in the Shopify app market.
  2. The Shopify platform is very user-friendly, and it’s easy to create apps that integrate with it.
  3. Shopify store owners are generally pleased with the platform, and they’re willing to pay for apps that can help them run their businesses more effectively.
  4. If you’re thinking about build a Shopify app, these are all great reasons to do it!
  1. What You’ll Need

Before we get started, there are a few things you’ll need in order to build a Shopify app:

  1. A text editor. We recommend using Visual Studio Code, which is free and available for download here.
  2. Node.js and npm installed on your computer. You can find instructions for doing this here.
  3. A Shopify development store. You can create one for free here.
  4. A development tunnel, such as ngrok (which is also free). This will allow you to connect your local development server to your Shopify store.

Once you have all of these things, you’re ready to get started!

Step 1: Create a New Node.js Project

The first thing you’ll need to do is create a new Node.js project. To do this, open up your terminal and type the following command:

npm init -y

This will create a new package.json file in your project directory. Next, you’ll need to install some dependencies. We recommend using Express and Mongoose, which are both available on npm. To install them, simply type the following command:

npm install express mongoose –save

Once the dependencies have been installed, you’ll need to create a new file called app.js. This is where we’ll write our Node.js code.

Build a Shopify App

Step 2: Connect your App to your Shopify Development Store

The next step is to connect your app to your Shopify development store. To do this, you’ll need to generate a new API key and API secret key from your Shopify development store. You can do this by going to Apps > Manage private apps in the Shopify admin panel.

Once you’ve generated your API keys, you’ll need to add them to your app.js file. You can do this by adding the following code:

const SHOPIFY_API_KEY = ‘your-API-key’;

const SHOPIFY_API_SECRET_KEY = ‘your-API-secret-key’;

Next, you’ll need to use these keys to generate a new access token for your app. You’ll need to make a POST request to the Shopify OAuth endpoint to do this. The endpoint for this is

You can make this request using the following code:

const accessTokenRequestUrl = ‘https://’ + shopName + ‘/admin/oauth/access_token’;

const accessTokenPayload = {

“client_id”: SHOPIFY_API_KEY,

“client_secret”: SHOPIFY_API_SECRET_KEY,

“code”: code

};, { json: accessTokenPayload })

.then((response) => {

const accessToken = response.access_token;

// use access token to make API call to ‘shop’ endpoint


Once you’ve made this request, you should receive a response that looks something like this:


“access_token”: “your-access-token”,

“scope”: “read_products”


You can then use this access token to make authenticated API calls to the Shopify API.

Step 3: Authenticate with the Shopify API

Now that you have an access token, you can use it to authenticate with the Shopify API. To do this, you’ll need to create a new file called shopify.js in your project directory. In this file, you’ll need to add the following code:

const SHOPIFY_API_KEY = ‘your-API-key’;

const SHOPIFY_API_SECRET_KEY = ‘your-API-secret-key’;

const shopifyApi = new Shopify({

shopName: ‘your-shop-name’,




module.exports = shopifyApi;

This code will create a new instance of the Shopify API client and authenticate it with your Shopify store. You can then use this instance to make API calls to the Shopify API.

Step 4: Create a Route to Display Products

Now that you’ve authenticated with the Shopify API, you can start making API calls. For this tutorial, we’re going to create a route that will fetch and display products from our Shopify store. To do this, we’ll need to add the following code to our app.js file:

const express = require(‘express’);

const mongoose = require(‘mongoose’);

const shopifyApi = require(‘./shopify’);

const app = express();

// fetch and display products route

app.get(‘/products’, (req, res) => {


.then((products) => {



.catch((err) => {




// app listening on port 3000

app.listen(3000, () => {

console.log(‘App listening on port 3000!’);


In this code, we’ve imported the Express and Mongoose dependencies, as well as the Shopify API client that we created in the previous step. We’ve then created a route that fetches products from our Shopify store and returns them as JSON.

Step 5: Run the App

Now that our app is complete, we can run it on our local server. To do this, we’ll need to open a terminal window and navigate to our project directory. Once we’re in the project directory, we can start our app by running the following command:

node app.js

If everything goes well, you should see the following output in your terminal window: App listening on port 3000!

You can then access your app in your web browser at http://localhost:3000/. If you visit this URL, you should see a JSON response that includes a list of products from your Shopify store.

Conclusion: Now that you have a basic understanding of how to create a Shopify app with Node.js and Express, you can start build a Shopify app means your own apps using these technologies. In this tutorial, we’ve shown you how to authenticate with the Shopify API and fetch products from your store. You can use this information to create your own routes and displays for product data. We encourage you to experiment with these technologies and build something awesome!

Leave a Comment

Your email address will not be published. Required fields are marked *