Skeleton code on using shopify-api for nodejs

Topic summary

A developer is building a public Shopify app using the Node.js shopify-api library (v9.3.1) to query store orders across multiple installations, currently testing on a development store.

Main Issue:

  • Finding the official documentation confusing and lacking proper code examples
  • Seeking guidance on correct implementation patterns

Code Shared:
The developer provided their app.js skeleton code showing:

  • Basic setup with @shopify/shopify-api package
  • Configuration using Client ID and Secret from Partners panel
  • Session creation with offline session ID
  • REST client initialization
  • Attempt to fetch products as a test query
  • Scopes include read_customers and read_orders
  • Using ngrok for local development

Current Status:
The post appears incomplete (code snippet is partially corrupted/reversed text), but the developer is actively seeking working examples and best practices for implementing the Shopify API authentication and data retrieval flow for a multi-store public app. No responses or solutions have been provided yet.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

I am trying to develop an app to query a store’s orders. The app is a public app ie will be installed by many stores but I am currently testing it on a development store.

The documentation is somewhat confusing and is very limited with no proper examples. Therefore, I wanted to report this here with the hope of getting some guidance.

Below is my app.js for a node application using “@shopify/shopify-api”: “^9.3.1”

require('@shopify/shopify-api/adapters/node');
const { shopifyApi, Session } = require('@shopify/shopify-api');

const shopify = shopifyApi({
    apiKey: 'The Client ID that I got from partners panel',
    apiSecretKey: 'The Client key that I got from partners panel',
    scopes: ['read_customers', 'read_orders'],
    hostName: 'https://XXXXXXXXX.ngrok-free.app',
});

const sessionId = shopify.session.getOfflineId("mystore_address.myshopify.com");

const session = new Session({
    id: sessionId,
    shop: "mystore_address.myshopify.com",
    isOnline: false,
    accessToken: 'permanentAccessToken',
});

const client = new shopify.clients.Rest({ session: session });

client.get({
    path: 'products',
}).then((val) => {
    console.log(val);
});

I keep getting the following example and I would be grateful if you could share any guidance you might have.

errors: ‘[API] Invalid API key or access token (unrecognized login or wrong password)’