Skip to content

Deploying

The starter is a Node server. Any host that runs Node 26 or newer works.

  1. Add your production origin to the storefront’s allowed origins in Settings → Custom storefronts, for example https://shop.example.

  2. Set the environment variables on the host. npm start doesn’t read .env. Set SEVIGRAM_STOREFRONT_TOKEN and APP_ORIGIN=https://shop.example, plus SEVIGRAM_STOREFRONT_PRIVATE_TOKEN as a secret if you use it. Don’t set the SEVIGRAM_DEMO_* variables.

  3. Build and start:

    Terminal window
    npm ci
    npm run build
    npm start

    npm start listens on PORT, default 3000. Put your host’s HTTPS in front of it.

  4. Tell the app about your proxy. With a private token, the server forwards each shopper’s IP so rate limits apply per shopper. Behind a load balancer or CDN, either:

    • set TRUST_PROXY to the number of proxies that append to X-Forwarded-For, usually 1; or
    • set CLIENT_IP_HEADER to the header your platform sets, such as cf-connecting-ip or fly-client-ip, with TRUST_PROXY=1.
  5. Check it. Run npx loom check --env <file> against a file with the production values, or open the site and walk through a checkout.

APP_ORIGIN must equal the exact public origin, meaning scheme, host and port, that shoppers use. Otherwise customer sign-in, sign-out and signed-in checkout answer 403.

To try the production build locally, run npm run build, then npm run preview. Preview reads .env and listens on APP_ORIGIN’s port.

The app code uses no Node built-ins. On a worker runtime without process.env, such as Cloudflare Workers without Node compatibility, change readConfig in app/lib/storefront.server.ts to read your platform’s environment bindings.

  • A “Connect your storefront” page. A setting is missing or malformed. The page names each variable and the problem.
  • network_error. The request never reached the API. Check the network, DNS, firewall and SEVIGRAM_API_BASE_URL.
  • npm run dev works but npm start doesn’t. npm start ignores .env. Set the variables in the host’s environment.
  • The demo banner is still shown after connecting. SEVIGRAM_STOREFRONT_TOKEN still holds the demo token. Replace it and restart the server.
  • An API error. Every error has a code; see Requests and errors. The starter’s error page shows the request ID to quote when you contact support.