Environment Variables
Required and optional environment variables for Vercel Shop.
Required
| Variable | Description |
|---|---|
SHOPIFY_STORE_DOMAIN | Your Shopify store domain, e.g. your-store.myshopify.com. Found in Settings → Domains in your Shopify admin. |
SHOPIFY_STOREFRONT_ACCESS_TOKEN | Public Storefront API access token. Found in Settings → Apps and sales channels → Headless. |
NEXT_PUBLIC_SITE_NAME | The storefront's display name. Used in the nav logo, footer copyright, About page, page titles, SEO metadata, and the AI agent's system prompt. Falls back to "Vercel Shop" if unset. |
Feature flags
Both optional features are opt-in via explicit NEXT_PUBLIC_ENABLE_* flags. The NEXT_PUBLIC_ prefix is required so the conditional rendering matches between server and client under cache components.
| Variable | Description |
|---|---|
NEXT_PUBLIC_ENABLE_AUTH | Set to "1" to enable the auth UI and the /account/* routes. Requires the three Customer Authentication secrets below — next.config.ts throws at build time if any are missing. |
NEXT_PUBLIC_ENABLE_AGENT | Set to "1" to enable the AI shopping assistant button and the /api/chat route. |
Customer Authentication
Required when NEXT_PUBLIC_ENABLE_AUTH="1". Powers built-in customer authentication via better-auth and Shopify Customer Account API OIDC.
| Variable | Description |
|---|---|
BETTER_AUTH_SECRET | Secret for signing sessions. Generate with openssl rand -base64 32. |
SHOPIFY_CUSTOMER_CLIENT_ID | Customer Account API client ID. Found in Shopify Admin → Settings → Customer accounts → API clients. |
SHOPIFY_CUSTOMER_CLIENT_SECRET | Customer Account API client secret. Found in the same location as the client ID. |
Optional
| Variable | Description |
|---|---|
BETTER_AUTH_BASE_URL | Override the base URL for auth callbacks. Defaults to NEXT_PUBLIC_BASE_URL or the Vercel production URL. |
BETTER_AUTH_TRUSTED_ORIGINS | Comma-separated list of trusted origins for auth callbacks. |
CMS_DRAFT_MODE_SECRET | Secret token guarding the /api/draft route for CMS preview links. Generate with openssl rand -base64 32. |
DEBUG_SHOPIFY | Set to true to log every Shopify Storefront API request and response in the server console. |
NEXT_PUBLIC_BASE_URL | Absolute base URL used for sitemap entries, OG tags, and auth callbacks. Defaults to https://${VERCEL_PROJECT_PRODUCTION_URL} on Vercel. |
SHOPIFY_WEBHOOK_SECRET | Shared secret used to verify HMAC signatures on incoming Shopify webhooks at /api/webhooks/shopify. |
System variables auto-injected on Vercel that the build reads (VERCEL_PROJECT_PRODUCTION_URL, NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL, V0_CALLBACK_URL) are listed in turbo.json globalEnv so Turbo's strict-mode build sees them. You don't set these yourself.