Skip to main content

Shop Health Check

Before your theme calls any other endpoint, it must confirm the shop is active. This is the single most important pattern to get right — if you skip it, customers may see broken pages or raw API errors instead of a clean coming-soon screen.

The health endpoint

GET /access/api/v1/settings/health

Call this first, on every initial page load. On success:

{
"status": "ok",
"name": "My Shop",
"id": "69ac75f878a9512e92b56fb5"
}

On any error, the response follows the standard error envelope with a code. Treat every non-200 response the same way: redirect to your branded coming-soon or maintenance page.

The customer does not need to know whether the shop is in maintenance, has a billing issue, or has dev mode off. From their perspective, the shop is simply unavailable.

async function checkHealth() {
const res = await fetch(`${BASE_URL}/settings/health`, {
headers: { "x-api-key": API_KEY },
});

if (!res.ok) {
redirect("/coming-soon");
return;
}

return res.json(); // { status: 'ok', name, id }
}

The gate pattern

After a successful health check, store a flag in your global state to indicate the shop is ready. No other hook, component, or data fetch should run until this flag is set.

The concept:

1. App loads
2. Call /settings/health
→ error → redirect to branded coming-soon page, stop
→ success → set shopReady = true, store shop name + id
3. All other API calls check shopReady before running
→ not ready → do nothing
→ ready → fetch data

This is framework-agnostic. In Redux you'd use a store slice. In Zustand, a store. In React context, a provider. The implementation is your choice — what matters is the discipline: nothing fetches data before the health check completes.

Why this matters

Without the gate, a page component that fetches products could fire before the health check resolves, race ahead, fail with SHOP_UNDER_DEVELOPMENT, and leave the customer on a broken page. The gate prevents that entire class of bugs.

What the coming-soon page must show

The coming-soon page is the only page that renders without a healthy shop. It must:

  • Render without any API calls (no products, no settings fetch, nothing)
  • Show a clean branded message
  • Optionally show contact info if it's hardcoded in the theme (not fetched from API)

Do not attempt to call /settings or any other endpoint from the coming-soon page.