How access tokens work in this template and when they get invalidated.

How token acquisition works

You run a local Express server exposed via an HTTPS tunnel. Opening the Shopify-generated install link for the app triggers the OAuth flow - Shopify redirects back to your callback, the server exchanges the code for an access token, and stores it in a local SQLite database via Prisma. After that the server is never needed again.

image.png

How scripts use the token

Every script reads the token directly from the SQLite database and attaches it as an X-Shopify-Access-Token header on each request to the Admin GraphQL API. No server, no session management - just a direct authenticated request from your terminal.

How the server handles incoming requests

The server has three routes, each with a clear responsibility:

image.png

Why Authorization Code Grant

Shopify offers three OAuth flows for getting an access token. Two were ruled out:

That leaves Authorization Code Grant - the standard OAuth flow for non-embedded apps. It works with any store, but requires standing up a server to handle the callback. This template provides that server so you only run it once. Shopify docs

Why SQLite + Prisma

The token could live in .env, a JSON file, or be hardcoded. SQLite + Prisma was chosen because: