Skip to content

Upgrade the storefront kit

This guide shows how to move a storefront to a newer @ecomweb/sdk and @ecomweb/storefront-kit. You need a storefront project that uses both packages, with a terminal in its folder. Stores that EcomWeb hosts with a ready-made theme need nothing, because EcomWeb keeps that build current. This guide is for storefronts you built, ejected or host yourself.

Every request the SDK sends carries an X-Ecomweb-Client header with the kit and SDK versions. The platform records the latest versions it has seen for your store, and compares them with two numbers for each package.

Number What it means
minimum_supported Below this version the dashboard and the CLI warn that your kit is no longer supported
security_minimum Below this version your kit has a known security issue. The dashboard shows a red banner and the store owner gets an email

You see the result in three places:

  • A banner in the store’s dashboard, titled Security update for your storefront kit, Your storefront kit is no longer supported or A storefront kit update is available. It shows the version you run, the latest version, the advisories the update fixes and the command to run.
  • A line in the CLI after any command run inside a storefront project, at most one check a day. ecomweb deploy prints a longer warning when you are below minimum_supported or security_minimum. Set ECOMWEB_NO_UPDATE_CHECK to turn the CLI notice and the deploy check off.
  • A warning during next build, from checkClientVersions in your next.config.mjs. Set ECOMWEB_SKIP_VERSION_CHECK=1 to turn it off. It waits 2 seconds at most and never fails the build.

Nothing refuses an old client by version. The deploy still goes ahead, and a kit keeps working unless an API change breaks it at one step, such as email verification, as the release notes below say. The 0.15.0 change is one of those: kits below 0.15.0 call cart, checkout and shopper routes with the publishable key. They fail: the old /public/ paths answer 404, and private routes answer 403 STOREFRONT_SECRET_KEY_REQUIRED. See 0.15.0. The platform also emails the store owner once each time security_minimum rises above a version the store was seen running in the last 30 days.

Run the CLI in the project folder. A dry run changes nothing and prints what is installed and what is latest.

Terminal window
ecomweb storefront upgrade --dry-run

You can also read the versions in package.json or node_modules/@ecomweb/storefront-kit/package.json. The platform’s current numbers are public. They need no key.

Terminal window
curl "https://apibase.ecomweb.app/api/v1/public/storefront-clients/versions"

The answer has packages with latest, minimum_supported and security_minimum for @ecomweb/storefront-kit and @ecomweb/sdk, then advisories and upgrade_guide_url. latest comes from the npm registry and is cached for an hour.

Upgrade both packages together and to the same version. They are released in lockstep.

  1. Run ecomweb storefront upgrade. It finds your package manager from the lockfile and adds the latest version of both packages. To do it by hand, run pnpm add @ecomweb/sdk@<version> @ecomweb/storefront-kit@<version>.
  2. Read What changed for every release between your version and the new one. Before 1.0, a minor release can break, so each of them matters.
  3. Run pnpm check, then pnpm build. Fix every type error the build reports.
  4. Deploy. For a store on EcomWeb hosting, run ecomweb deploy and wait for the build. See Hosting.

A project made from the Claude Code plugin has the /ecomweb:update command. It refreshes the project’s ecomweb skill, runs pnpm update on both packages, runs pnpm check and reports what changed. Because pnpm update keeps to your range, run ecomweb storefront upgrade first when you need a newer minor release. See Build your store with Claude Code.

The notes cover every minor release from 0.11.0 to 0.15.0, with the patch releases between them. The full changelogs are in the release notes.

Storefront secret keys. This is a breaking change for ejected and self-hosted storefronts. A store on EcomWeb hosting with a ready-made theme needs nothing.

  • Cart, checkout, payments, orders, shopper accounts and the other private calls need a storefront secret key. The kit signs server calls with ECOMWEB_SECRET_KEY (single store) or PLATFORM_SECRET_KEY (shared app), set in the server’s environment only. Server-side PLATFORM_API_KEY is retired.
  • Every private browser call goes through your site’s backend route at /api/backend/[...path], which must exist. In the shared app and in hand-built apps the file is app/api/backend/[...path]/route.ts. In a project from ecomweb storefront init or an ejected theme it is app/(shop)/api/backend/[...path]/route.ts. The proxy locks it to the private routes the kit lists, the served store and requests from your own site.
  • createEcomwebSdk returns the catalog and content classes only. cart, orders, payments, customers, addresses and the private review, shipping quote, promotion code and blog comment methods are on createEcomwebServerSdk({ ..., secretKey }) and createEcomwebProxiedSdk({ publicHttp, proxyHttp }). Server code uses createEcomwebServerSdk or getServerSdk(). Browser code uses createStoreSdk(storeRef). The kit entry points export the EcomwebSdk and EcomwebServerSdk types.
  • The kit refuses a NEXT_PUBLIC_ variable that holds a value starting sk_, and the new ecomweb-check-client-bundle command fails a build that leaks a storefront secret key.
  • Shopper-side methods on getServerSdk() fail with SDK_SHOPPER_CALL_ON_SERVER.
  • The SDK calls /api/v1/storefront/...; the API no longer serves /api/v1/public/stores/..., /api/v1/tenant/stores/... or /api/v1/stores/<ref>/cart. Change every URL your own code builds by hand (an ejected theme has three: lib/blog/api-client.ts, lib/sitemap/api-client.ts and components/web-vitals-reporter.tsx).

To move an ejected storefront to 0.15.0, follow the steps under Ejected or copied storefronts.

  • Every SDK request sends X-Ecomweb-Client. createEcomwebSdk takes an optional clientInfo, and the SDK exports SDK_VERSION, SDK_CLIENT_TOKEN, CLIENT_HEADER, clientHeaderValue() and withClientHeader().
  • New checkClientVersions({ phase, apiUrl }) in @ecomweb/storefront-kit/config. Ejected storefronts must change next.config.mjs to export an async function that calls it to get the build warning. New projects already do:
import { checkClientVersions } from "@ecomweb/storefront-kit/config";
export default async function config(phase) {
await checkClientVersions({ phase, apiUrl: process.env.ECOMWEB_API_URL });
return nextConfig;
}
  • No breaking changes.
  • Security, fixed in 0.13.1, advisory ECW-2026-11-01 (high). Email verification and email change links are bound to the browser that asked for them, and checkout sends the promotion code with the promotion. Kits below 0.13.1 fail email verification, email change and discount codes at checkout against the current API. Upgrade to 0.13.1 or later.
  • The auth route keeps the verification_binding and confirmation_binding in httpOnly cookies. AuthApi.verifyEmail(token, binding?) and confirmEmailChange(token, binding?) take the binding. CreateOrderRequest has promotion_code?.
  • Breaking in 0.13.0: orders.lookupGuest() returns the order, or null when nothing matches, and no longer a { order, found } object. GuestOrderLookupResult is removed. Update code that read .order or .found.
  • cart.merge() is typed CartApiResponse | { merged: false }. Store.user_id is optional. BlogComment.author_email is optional.
  • errorCopy has text for PROMOTION_IDENTITY_REQUIRED. Coming soon previews are more reliable.
  • The subdomain redirects to a custom domain only after the domain is verified. StoreConfig has an optional verified.
  • Signing in moves the guest cart into the account instead of losing it. Cart lines keep the order they were added in. A buildStoreUrl fix stops signed-out shoppers going to //login.
  • New useBankTransferDetails, shouldShowBankTransferDetails and pickBankTransfer. AUTH_ACCOUNT_DISABLED is a known AuthErrorCode. errorCopy has text for PROMOTION_USAGE_LIMIT_REACHED and BLOG_COMMENTS_DISABLED.
  • StoreSettings has optional blog_description, posts_per_page and allow_comments.
  • No breaking changes.
  • Coming soon stores. A store its merchant has not opened shows a coming soon page. Your app owns app/coming-soon/page.tsx. Call resolveComingSoonStore() and return comingSoonStoreMetadata(name). Kits below 0.11.0 show a 404 or error page instead.
  • New exports: isStoreComingSoonError, comingSoonStoreNameOf, STORE_COMING_SOON_REDIRECT_PATH, resolveComingSoonStore and readStorePreviewToken. StorefrontKitProvider takes storePreviewToken and onStorePreviewRenew.
  • Previews are read-only. placeOrder and cart writes are refused in a preview.
  • stores.getByDomain and stores.getById take optional request options. No breaking changes.

For how the SDK reports these states, see Errors in the SDK.

A storefront that you ejected or copied from a template has its own copy of the template’s code, such as pages, components and next.config.mjs. Upgrading the packages does not change that code. When a release says new projects already have a change, port it by hand. Compare your files with a freshly generated project:

Terminal window
ecomweb storefront init ../fresh-copy

Look at next.config.mjs, proxy.ts, the two route handlers and your layout. Then walk the notes above and apply each item that touches code you own, such as the next.config.mjs change in 0.14.0 and the coming soon page in 0.11.0. Run pnpm check and pnpm build after each batch so a type error points at one change.

To move to 0.15.0, do these steps in order:

  1. Create a storefront secret key (sk_storefront_...) in Settings › API Keys, in the Storefront secret keys section. See Create a storefront secret key.
  2. Set it as ECOMWEB_SECRET_KEY at run time, in the server’s environment only. Never set it as a NEXT_PUBLIC_ variable, a Dockerfile ARG or ENV, a next.config env entry or a committed .env file. The build needs no secret, and the ejected template stops at start without one. On EcomWeb hosting, the hosted environment already holds the key. See Hosting.
  3. Delete PLATFORM_API_KEY from your environment and code. It is retired.
  4. Check that the route for /api/backend/[...path] exists and exports createBackendProxy(), and that the route for /api/auth/[...route] exports createAuthRoutes(). In a project from ecomweb storefront init or an ejected theme the files are app/(shop)/api/backend/[...path]/route.ts and app/(shop)/api/auth/[...route]/route.ts. In a hand-built app they are app/api/backend/[...path]/route.ts and app/api/auth/[...route]/route.ts. Do not add a second route at the same path, because two routes at one URL break next build. Compare them with a fresh project from ecomweb storefront init. See Wire the provider and middleware.
  5. Change every URL your own code builds by hand: /api/v1/public/stores/... and /api/v1/tenant/stores/... become /api/v1/storefront/stores/..., and the signed-in cart /api/v1/stores/<ref>/cart becomes /api/v1/storefront/stores/<ref>/customers/cart. An ejected theme has three files that build URLs by hand: lib/blog/api-client.ts, lib/sitemap/api-client.ts and components/web-vitals-reporter.tsx (it posts to /storefront/stores/<ref>/web-vitals through the proxy).
  6. Add the bundle check to the build script: "build": "next build && ecomweb-check-client-bundle".
  7. Move every sdk.cart, sdk.orders, sdk.payments, sdk.customers and sdk.addresses call, and the private sdk.reviews (invitations, submissions), sdk.shipping.calculate, sdk.promotions.validate and sdk.blog.submitComment calls, off the module sdk. In client code use createStoreSdk(storeRef). In server components and route handlers use await getServerSdk() from @ecomweb/storefront-kit/server. Left on sdk, they are type errors. Calls that need the signed-in shopper work only through createStoreSdk in the browser. On getServerSdk() they fail with SDK_SHOPPER_CALL_ON_SERVER.
  8. Run pnpm check and pnpm build, then deploy.

For why each key does what it does, see Publishable and storefront secret keys.

Not by version: nothing refuses a request because the kit is old. But some API changes break old clients. Kits below 0.15.0 call cart, checkout and shopper routes with the publishable key. Those calls fail: the old /public/ paths answer 404, and private routes answer 403 STOREFRONT_SECRET_KEY_REQUIRED. See 0.15.0. The 0.13.1 advisory is another example.

Run ecomweb storefront upgrade --dry-run, or read latest from the versions endpoint above.

Upgrade both together. The kit depends on the SDK and the two are released with the same version.