A Shopify app staging environment is a second app, with its own client ID, linked to the same repository through a second config file such as shopify.app.staging.toml. shopify app config link creates the file, --config staging points any Shopify CLI command at it, and each app needs its own service account token before CI can deploy it.
Flag names and config file handling below were checked on Shopify CLI 5.1.0, the npm latest release on 29 November 2026, without logging in to an account. What Shopify does after a deploy is taken from its docs. Shopify’s hosting guide gives the advice in one line: “We recommend that developers have one configuration for development, and a separate one for production.”
Why does staging need a second app?
shopify app deploy builds an app version, which the docs call “a snapshot of your app configuration and all extensions”, and then releases it. Releasing “replaces the current active version that’s served to stores that have your app installed”. The pages we read describe no way to release a version to some stores and not others, so scopes, webhook subscriptions, the app proxy and every extension go out together.
With Shopify managed installation, the configuration reference says scopes “are automatically requested when the app is installed on a store or when you update the scopes value”. A released scope change is therefore requested from every store that has the app, which is one reason to keep new scopes optional until they are needed.
shopify app dev covers local work. The same reference says TOML changes “are applied automatically during app dev for your chosen development store”. That is one developer’s preview on one dev store. A staging environment adds what the preview lacks: a hosted copy of the server and a released app version, on a store that testers share.
How do you create the staging config?
Run shopify app config link in the app’s root. The command can link an existing app or create a new one, and the guide to managing config files says that when a shopify.app.toml already exists you are asked for a name and get shopify.app.{your-config-name}.toml. We could not run config link without a login, so the staging file below is written by hand from the reference’s example:
# shopify.app.staging.toml
name = "Acme Reviews (staging)"
client_id = "22222222222222222222222222222222"
application_url = "https://reviews-staging.example.com"
embedded = true
[access_scopes]
scopes = "read_products"
[auth]
redirect_urls = ["https://reviews-staging.example.com/auth/callback"]
[webhooks]
api_version = "2026-10"
[[webhooks.subscriptions]]
topics = ["app/uninstalled"]
uri = "/webhooks/app/uninstalled"
[build]
automatically_update_urls_on_dev = false
Only the name, the client_id and the URLs differ from production. The webhook uri is a relative path, which the reference allows, so the subscription block is identical in both files. An app proxy url works the same way: “If you use a relative path, then Shopify CLI adds your application_url in front of it.”
Commit the file. The client_id is described as the app’s public identifier, and the client secret is not in the TOML. shopify app env show --config staging is the documented way to print the values the staging server needs: SHOPIFY_API_KEY, SHOPIFY_API_SECRET and SCOPES. Give that server its own database as well. A stored session holds an access token issued to one app, so staging cannot borrow production’s session storage.
Which config does a command use?
We tested this on CLI 5.1.0 with two made-up apps and the network switched off, so each command stopped at login, after it had chosen a file.
The --config flag wins. With staging saved as the default, a deploy run with --config missing failed with Couldn't find shopify.app.missing.toml, so the flag was read first. The SHOPIFY_FLAG_APP_CONFIG environment variable beat the saved default in the same way and lost to the flag.
Without either, the CLI used the default saved by shopify app config use staging. With no saved default it looked for shopify.app.toml.
The saved default does not travel with the repository, because config use writes nothing to it. On macOS the choice went into ~/Library/Preferences/shopify-cli-app-nodejs/config.json, keyed by the project’s absolute path. It belongs to one machine and one checkout. A colleague, a second clone and a CI runner do not have it, and each of them falls back to shopify.app.toml.
That fallback is the reason to name both files. If the unnamed shopify.app.toml is the production app, a bare shopify app deploy on a fresh clone is aimed at production. Name both deployed apps instead: shopify.app.staging.toml and shopify.app.production.toml. In a folder holding only those two, shopify app deploy with no --config stopped with Couldn't find shopify.app.toml before it reached login. That run was non-interactive, as CI is. We did not try it at an interactive prompt.
How do you deploy each app from CI?
Shopify’s CI/CD guide asks for a SHOPIFY_SERVICE_ACCOUNT_TOKEN variable and a deploy command with --config and --allow-updates. Service accounts need CLI 5.0.0 or higher, and one line in their docs shapes a two-app pipeline: “A service account can deploy and manage one app at most.” Staging and production therefore need two service accounts and two CI secrets.
# Every merge to main
node scripts/check-app-config.mjs \
shopify.app.staging.toml shopify.app.production.toml
SHOPIFY_SERVICE_ACCOUNT_TOKEN="$STAGING_TOKEN" \
shopify app deploy --config staging --allow-updates
# Later, from the same commit, after someone has tested staging
SHOPIFY_SERVICE_ACCOUNT_TOKEN="$PRODUCTION_TOKEN" \
shopify app deploy --config production --allow-updates
Tokens expire. You pick 30, 90 or 180 days when you create one, and an account can hold two active tokens so that a rotation has no gap. The older SHOPIFY_CLI_PARTNERS_TOKEN could reach several apps; the docs say new ones can no longer be created and the rest expire by 6 February 2027.
Keep --allow-deletes out of the default job. The guide warns that any extension missing from the checkout being deployed is removed, and that deleting an extension also deletes its data on stores with the app installed. It recommends --allow-updates for the pipeline and --allow-deletes for a manual run.
deploy does not ship your server. The staging host is your own deployment, with its own SHOPIFY_APP_URL, and it has to go out alongside the app version.
A bad production release can be reversed. Per the docs, shopify app versions list --config production shows the version names and shopify app release --config production --version <name> releases an older one. That makes the older config and extensions active again. Your server and database are still yours to roll back.
What stops the two files drifting apart?
Nothing we found in the CLI or its docs. The guide’s way to move a change between apps is to “copy and paste your blocks of configuration to any of your other configuration files”. A scope pasted into one file and forgotten in the other gives you a production app running code that expects a permission it never requested. The same applies to anything else declared in the file, including metafield definitions in TOML.
We would treat the two files as one config with a short list of per-app values. Staging is ahead of production in time, because it deploys first, and never in content. This script fails the build when the files differ anywhere else:
import { readFileSync } from 'node:fs';
import { isDeepStrictEqual } from 'node:util';
import { parse } from 'smol-toml';
// The only keys allowed to differ between the two apps.
const perApp = new Set([
'name',
'handle',
'client_id',
'application_url',
'auth.redirect_urls',
'build',
]);
function flatten(table, prefix = '', out = new Map()) {
for (const [key, value] of Object.entries(table)) {
const path = prefix ? `${prefix}.${key}` : key;
if (perApp.has(path)) continue;
const isTable =
value !== null && typeof value === 'object' && !Array.isArray(value);
if (isTable) flatten(value, path, out);
else out.set(path, value);
}
return out;
}
const [fileA, fileB] = process.argv.slice(2);
if (!fileA || !fileB) {
console.error('Usage: node check-app-config.mjs <a.toml> <b.toml>');
process.exit(2);
}
const a = flatten(parse(readFileSync(fileA, 'utf8')));
const b = flatten(parse(readFileSync(fileB, 'utf8')));
const drift = [...new Set([...a.keys(), ...b.keys()])]
.filter((path) => !isDeepStrictEqual(a.get(path), b.get(path)))
.sort();
if (drift.length > 0) {
console.error(`${fileA} and ${fileB} differ at:`);
for (const path of drift) console.error(` ${path}`);
process.exit(1);
}
console.log(`${fileA} and ${fileB} match outside the per-app keys.`);
On Node 24.12.0 with smol-toml 1.9.1 it exits 0 for the staging file above and its production twin, and exits 1 naming access_scopes.scopes when a scope is added to one file only. Arrays are compared whole and in order, so an absolute webhook uri that differs per app fails the check. Relative paths avoid that.
When is a Shopify app staging environment worth it?
For any app with a server and more than one installed store, we would set this up before the next scope or webhook change. That means two named files, --config on every scripted command, one service account per app and the drift check in CI.
We would skip it for an extension-only app with a single developer and no hosted server. app dev on a dev store already shows the extension, and a second app would mostly add a second token to rotate. The point to revisit that is the first time someone other than the developer needs to test a build.