how to get the top 10 products of the store with nodejs

Shopify Partner
8 0 0

Hi, I can't find an example on how to get the store products with nodejs, the only guide I found is this: .

Where is this code: 

const client = new shopify.clients.Storefront({
domain: '',
const data = await client.query({
data: `query getProducts($first: Int) {
products(first: $first) {
edges {
node {

Only when I try to run it by entering the correct parameters does it tell me that shopify doesn't exist, while other times it tells me that clients doesn't exist, does anyone know how to resolve this? I would also be fine with a method to get the first 10 products other than this, obviously always using nodejs, thanks to those who answer

Replies 2 (2)

Shopify Staff
2731 302 783

Hi Cerz01,


It's possible you might be facing this issue because the shopify module is not properly installed or imported in your project. Did you install the node-fetch module? EG with:


npm install node-fetch

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
8 0 0

Yes, I have installed all the packages, here I leave the package.json, maybe something is missing that I don't know, but when I click on the variable for the quick connection the file finds it for me, so I don't know what it could be, I hope you can help me help


  "name": "prova",
  "private": true,
  "scripts": {
    "build": "NODE_ENV=production remix build",
    "predev": "prisma generate && prisma migrate deploy",
    "dev": "shopify app dev",
    "config:link": "shopify app config link",
    "config:push": "shopify app config push",
    "generate": "shopify app generate",
    "deploy": "shopify app deploy",
    "config:use": "shopify app config use",
    "env": "shopify app env",
    "start": "remix-serve build/index.js",
    "docker-start": "npm run setup && npm run start",
    "setup": "prisma generate && prisma migrate deploy",
    "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
    "shopify": "shopify",
    "prisma": "prisma"
  "dependencies": {
    "@prisma/client": "^4.13.0",
    "@remix-run/node": "^2.0.0",
    "@remix-run/react": "^2.0.0",
    "@remix-run/serve": "^2.0.0",
    "@shopify/app": "3.50.0",
    "@shopify/app-bridge-types": "^0.0.3",
    "@shopify/cli": "3.50.0",
    "@shopify/polaris": "^11.1.2",
    "@shopify/shopify-api": "^8.0.2",
    "@shopify/shopify-app-remix": "^2.0.0",
    "@shopify/shopify-app-session-storage-prisma": "^2.0.0",
    "cross-env": "^7.0.3",
    "isbot": "latest",
    "node-fetch": "^3.3.2",
    "prisma": "^4.13.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "tiny-invariant": "^1.3.1"
  "devDependencies": {
    "@remix-run/dev": "^2.0.0",
    "@remix-run/eslint-config": "^2.0.0",
    "@types/eslint": "^8.40.0",
    "@types/node": "^20.6.3",
    "eslint": "^8.42.0",
    "eslint-config-prettier": "^8.8.0",
    "prettier": "^2.8.8",
    "typescript": "^5.2.2"
  "workspaces": [
  "author": "coses"


I also opened another ticket for something else, maybe you can help me with that too, thanks