Skip to content

Environment variables

This list is generated from the code: every variable the theme and engine read, plus those in the README’s table. The container wiring for each is in docker-compose.yml of magenxcommerce-docker.

  • Build-time variables are inlined into the bundle by next build. Changing one needs a rebuild, not a restart. NEXT_PUBLIC_* variables end up in the browser: never put a secret in one.
  • Runtime variables are read by the running server and take effect on restart.

Magento connection

VariableWhenPurpose
MAGENTO_GRAPHQL_BUILD_ENDPOINTserver-only, build-time onlyMagento GraphQL URL used only while next build prerenders (CI/image builds usually can't reach the internal network) — point it at the deployed site's own /api/graphql. Deliberately separate from the runtime var above; do not reuse one value for both. Operations the proxy keeps off its allowlist (GetCmsBlocks, the blog queries, aggregations) cannot pass through it — those pages prerender empty, fill in at runtime, and log a short explanatory warning during the build Read in packages/engine/src/apollo/client.ts.
MAGENTO_GRAPHQL_ENDPOINTserver-only, runtimeInternal Magento GraphQL URL (e.g. http://nginx/graphql) for docker-compose deployments. Read on every request Read in apps/theme/src/app/api/downloads/[hash]/route.ts, apps/theme/src/app/api/graphql/_lib/constants.ts, apps/theme/src/instrumentation.ts and 3 more.

Bot protection (Turnstile)

VariableWhenPurpose
NEXT_PUBLIC_TURNSTILE_SITE_KEYbuild-time, publicRenders the Turnstile widget on protected forms Read in apps/theme/src/components/security/turnstile-config.ts, apps/theme/src/components/security/turnstile-widget.tsx.
TURNSTILE_ENABLEserver-only, runtimeEnables server-side Cloudflare Turnstile enforcement (off by default). TURNSTILE_ENABLE must be the bare 1 Read in apps/theme/src/app/api/graphql/_lib/turnstile.ts.
TURNSTILE_HOSTNAMESserver-only, runtimeComma-separated domains the widget may be served from. Required when TURNSTILE_ENABLE=1 — protected operations are rejected while it is unset Read in apps/theme/src/app/api/graphql/_lib/turnstile.ts.
TURNSTILE_SECRET_KEYserver-only, runtimeEnables server-side Cloudflare Turnstile enforcement (off by default). TURNSTILE_ENABLE must be the bare 1 Read in apps/theme/src/app/api/graphql/_lib/turnstile.ts.

Sign-in

VariableWhenPurpose
AUTH_GOOGLE_IDserver-only, runtimeNextAuth + the social-login bridge to Magento. Magento must also be configured with the same OAuth client ids (MAGENX_SOCIAL_LOGIN_GOOGLE_CLIENT_ID / ..._APPLE_CLIENT_ID), or it rejects every ID token the bridge relays
AUTH_GOOGLE_SECRETserver-only, runtimeNextAuth + the social-login bridge to Magento. Magento must also be configured with the same OAuth client ids (MAGENX_SOCIAL_LOGIN_GOOGLE_CLIENT_ID / ..._APPLE_CLIENT_ID), or it rejects every ID token the bridge relays
AUTH_SECRETserver-only, runtimeNextAuth + the social-login bridge to Magento. Magento must also be configured with the same OAuth client ids (MAGENX_SOCIAL_LOGIN_GOOGLE_CLIENT_ID / ..._APPLE_CLIENT_ID), or it rejects every ID token the bridge relays
AUTH_URLserver-only, runtimeThe storefront's public origin for Auth.js callbacks and redirects. Read in apps/theme/src/app/api/auth/magento-session/route.ts.
MAGENX_SOCIAL_LOGIN_SECRETserver-only, runtimeNextAuth + the social-login bridge to Magento. Magento must also be configured with the same OAuth client ids (MAGENX_SOCIAL_LOGIN_GOOGLE_CLIENT_ID / ..._APPLE_CLIENT_ID), or it rejects every ID token the bridge relays Read in apps/theme/src/app/api/auth/magento-session/route.ts.
NEXT_PUBLIC_SOCIAL_LOGIN_ENABLEDbuild-time, publicShows the "Continue with Google" button Read in apps/theme/src/components/auth/social-login-buttons.tsx.

Agentic commerce: UCP

VariableWhenPurpose
UCP_DELEGATED_PAYMENTserver-only, runtimeDeclares Stripe's UCP payment handler so agents can pay directly (off by default; needs the three STRIPE_* vars) Read in packages/engine/src/agentic/ucp/_lib/stripe.ts.
UCP_DISCOVERY_RATEserver-only, runtimeUncached platform-profile fetches per minute, per instance (default 60); over it, requests get 503 + Retry-After Read in packages/engine/src/agentic/ucp/_lib/platform-profile.ts.
UCP_ENABLEserver-only, runtimeEnables the UCP agentic-checkout API (off by default ⇒ every route 404s). Platforms authenticate by signing requests with a key from their own profile — nothing else to configure Read in packages/engine/src/agentic/ucp/_lib/constants.ts.
UCP_ORDER_WEBHOOKSserver-only, runtimeOrder-event webhooks: on whenever UCP and UCP_SIGNING_KEY are configured; 0 turns them off. Poll interval in seconds (default 60, min 15) Read in packages/engine/src/agentic/ucp/_lib/order-webhooks.ts.
UCP_ORDER_WEBHOOK_INTERVALserver-only, runtimeOrder-event webhooks: on whenever UCP and UCP_SIGNING_KEY are configured; 0 turns them off. Poll interval in seconds (default 60, min 15) Read in packages/engine/src/agentic/ucp/_lib/order-webhooks.ts.
UCP_PLATFORM_KEYSserver-only, runtimeOptional pre-shared API keys (label:secret,…), each bound to the UCP-Agent profile(s) it may claim (label=https://origin\|https://host/exact.json,…). An unbound key is refused (403) Read in packages/engine/src/agentic/ucp/_lib/auth.ts.
UCP_PLATFORM_PROFILESserver-only, runtimeOptional pre-shared API keys (label:secret,…), each bound to the UCP-Agent profile(s) it may claim (label=https://origin\|https://host/exact.json,…). An unbound key is refused (403) Read in packages/engine/src/agentic/ucp/_lib/auth.ts.
UCP_RATE_LIMITserver-only, runtimePer-platform requests/minute for the UCP API (default 120, per instance) Read in packages/engine/src/agentic/ucp/_lib/auth.ts.
UCP_REDIS_URLserver-only, runtimeRedis for UCP idempotency, cart tombstones, order ownership and webhooks, when it should differ from REDIS_URL. Read in packages/engine/src/agentic/ucp/_lib/idempotency.ts, packages/engine/src/agentic/ucp/_lib/order-webhooks.ts.
UCP_SIGNING_KEYserver-only, runtimePrivate key (PKCS#8 PEM, EC P-256 recommended) that signs every UCP response; its public half is published in /.well-known/ucp keys[]. Previous keys stay published during a rotation. Off when unset Read in packages/engine/src/agentic/ucp/_lib/signing.ts.
UCP_SIGNING_PREVIOUS_KEYSserver-only, runtimePrivate key (PKCS#8 PEM, EC P-256 recommended) that signs every UCP response; its public half is published in /.well-known/ucp keys[]. Previous keys stay published during a rotation. Off when unset Read in packages/engine/src/agentic/ucp/_lib/signing.ts.

Agentic commerce: ACP

VariableWhenPurpose
ACP_ENABLEserver-only, runtime1 enables the ACP agentic-checkout API. It also needs ACP_PLATFORM_KEYS, ACP_SIGNING_SECRET and the Stripe credentials; otherwise every ACP route returns 404. Read in packages/engine/src/agentic/acp/_lib/constants.ts.
ACP_ORDER_WEBHOOKSserver-only, runtimeACP order events (order_create / order_update) to the platform's receiver, HMAC-signed with the key it issued; on when ACP is on and URL + secret are set. Header defaults to Merchant-Signature; 0 turns events off; interval default 60 s Read in packages/engine/src/agentic/acp/_lib/order-events.ts.
ACP_ORDER_WEBHOOK_INTERVALserver-only, runtimeACP order events (order_create / order_update) to the platform's receiver, HMAC-signed with the key it issued; on when ACP is on and URL + secret are set. Header defaults to Merchant-Signature; 0 turns events off; interval default 60 s Read in packages/engine/src/agentic/acp/_lib/order-events.ts.
ACP_PLATFORM_KEYSserver-only, runtimeACP platform credentials, label:secret,…, sent as Authorization: Bearer. Read in packages/engine/src/agentic/acp/_lib/auth.ts.
ACP_RATE_LIMITserver-only, runtimePer-platform requests per minute for the ACP API, per instance. Read in packages/engine/src/agentic/acp/_lib/auth.ts.
ACP_REDIS_URLserver-only, runtimeRedis for ACP idempotency and order watching, when it should differ from REDIS_URL. Read in packages/engine/src/agentic/_lib/idempotency.ts, packages/engine/src/agentic/acp/_lib/idempotency.ts, packages/engine/src/agentic/acp/_lib/order-events.ts.
ACP_SHARED_PAYMENT_TOKENSserver-only, runtime1 lets ACP complete hand Stripe Shared Payment Tokens (spt_…) to Magento; set only once Magenx_StripeSharedPaymentTokens is enabled there. Off ⇒ spt_ tokens are refused before anything is charged Read in packages/engine/src/agentic/acp/_lib/payment.ts.
ACP_SIGNING_SECRETserver-only, runtimeShared secret for the HMAC-SHA256 request signature ACP platforms send (Signature + Timestamp). Read in packages/engine/src/agentic/acp/_lib/auth.ts.
ACP_WEBHOOK_SECRETserver-only, runtimeACP order events (order_create / order_update) to the platform's receiver, HMAC-signed with the key it issued; on when ACP is on and URL + secret are set. Header defaults to Merchant-Signature; 0 turns events off; interval default 60 s Read in packages/engine/src/agentic/acp/_lib/order-events.ts.
ACP_WEBHOOK_SIGNATURE_HEADERserver-only, runtimeACP order events (order_create / order_update) to the platform's receiver, HMAC-signed with the key it issued; on when ACP is on and URL + secret are set. Header defaults to Merchant-Signature; 0 turns events off; interval default 60 s Read in packages/engine/src/agentic/acp/_lib/order-events.ts.
ACP_WEBHOOK_URLserver-only, runtimeACP order events (order_create / order_update) to the platform's receiver, HMAC-signed with the key it issued; on when ACP is on and URL + secret are set. Header defaults to Merchant-Signature; 0 turns events off; interval default 60 s Read in packages/engine/src/agentic/acp/_lib/order-events.ts.

Stripe (agentic payments)

VariableWhenPurpose
STRIPE_MERCHANT_IDserver-only, runtimeStripe credentials for UCP delegated payment. Only the publishable key is ever published Read in packages/engine/src/agentic/ucp/_lib/stripe.ts.
STRIPE_PUBLISHABLE_KEYserver-only, runtimeStripe credentials for UCP delegated payment. Only the publishable key is ever published Read in packages/engine/src/agentic/ucp/_lib/stripe.ts.
STRIPE_SECRET_KEYserver-only, runtimeStripe credentials for UCP delegated payment. Only the publishable key is ever published Read in packages/engine/src/agentic/ucp/_lib/stripe.ts.

Redis and shared caches

VariableWhenPurpose
REDIS_URLserver-only, runtimeShared Redis/Valkey for state across storefront instances: the agentic APIs (idempotency, order ownership, order webhooks), the assistant's replay guard and rate limits, and with SF_CACHE_NEXT=1 the Next.js caches. Unset: per-process memory. Read in packages/engine/src/agentic/_lib/idempotency.ts, packages/engine/src/agentic/acp/_lib/idempotency.ts, packages/engine/src/agentic/acp/_lib/order-events.ts and 3 more.
SF_CACHE_CONTEXTserver-only, runtime1 shares signed-in shoppers' catalog answers in Valkey between the customers of one pricing context (Magento's X-Magento-Cache-Id: group, store, currency), purged like the guest answers. Needs SF_CACHE_NEXT=1 and REDIS_URL. Read in apps/theme/src/app/api/graphql/_lib/guest-cache.ts, apps/theme/src/app/api/graphql/route.ts.
SF_CACHE_GRAPHQLserver-only, runtime1 keeps guest GraphQL answers in Valkey, deleted by Magento's PURGE tags instead of expiring with nginx's 60 s TTL. Needs SF_CACHE_NEXT=1 and REDIS_URL. Read in apps/theme/src/app/api/graphql/_lib/guest-cache.ts, apps/theme/src/app/api/graphql/route.ts.

Observability and profiling

VariableWhenPurpose
GRAPHQL_PROFILEruntime / build-timeVerbose per-operation GraphQL timing logs (default on in dev, off in prod) Read in apps/theme/src/app/api/graphql/_lib/profiling.ts, packages/engine/src/apollo/timing-link.ts.
NEXT_PUBLIC_GRAPHQL_PROFILEruntime / build-timeVerbose per-operation GraphQL timing logs (default on in dev, off in prod) Read in packages/engine/src/apollo/timing-link.ts.
OTEL_EXPORTER_OTLP_ENDPOINTserver-only, runtimeEnables OpenTelemetry trace/metric/log export; unset = zero overhead Read in apps/theme/src/instrumentation.ts.
OTEL_SERVICE_NAMEserver-only, runtimeService name on traces, metrics and logs, for example magenx-storefront. Read in apps/theme/src/instrumentation.ts.

Storefront

VariableWhenPurpose
ANTHROPIC_API_KEYserver-only, runtimeClaude API key for the shopper assistant (/api/assistant, configured by assistant in magenx.config.ts). Unset ⇒ the route 404s Read in packages/engine/src/assistant/config.ts.
ASSISTANT_DISABLEDserver-only, runtime1 turns the shopper assistant off without a rebuild Read in packages/engine/src/assistant/config.ts.
ASSISTANT_SEAL_KEYserver-only, runtime32+ random characters. Encrypts the conversation state the browser holds between messages; rotating it ends open chats. Unset ⇒ the route 404s Read in packages/engine/src/assistant/config.ts, packages/engine/src/assistant/confirm.ts, packages/engine/src/assistant/handler.ts.
CACHE_WARM_ON_BOOTserver-only, runtimeOn start, purges the cache tags the build endpoint's allowlist kept next build from filling (CMS blocks, blog) and re-renders one page per locale. 0 disables Read in apps/theme/src/lib/cache-warm.ts.
CSP_EXTRA_IMG_HOSTSserver-only, runtimeExtra image hosts allowed by the Content Security Policy, space-separated (for example ad-network ccTLDs). Read in apps/theme/next.config.ts.
MAGENX_ABANDONED_RECOVERY_SECRETserver-only, runtimeVerifies abandoned-cart recovery links (/api/cart/recover). Must match the Recovery Link Secret set in Magento under Magenx > Abandoned Checkout Reminder > Email; while unset every recovery link is rejected Read in apps/theme/src/app/api/cart/recover/route.ts.
NEXT_PUBLIC_GOOGLE_MAPS_API_KEYbuild-time, publicEnables the Google Maps embed on the store-locator page Read in apps/theme/magenx.config.ts.
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATIONbuild-time, publicGoogle Search Console token Read in apps/theme/magenx.config.ts.
NEXT_PUBLIC_GTM_IDbuild-time, publicGoogle Tag Manager container id; unset disables analytics entirely Read in apps/theme/magenx.config.ts.
NEXT_PUBLIC_SITE_URLbuild-time, publicCanonical storefront URL (metadataBase, OG tags) Read in apps/theme/src/app/[locale]/auth/session/route.ts, apps/theme/magenx.config.ts.
PORTserver-only, runtimePort the Next.js server listens on (default 3000). Read in apps/theme/src/lib/cache-warm.ts.
STORE_DRIFT_CHECKserver-only, runtimeBoot-time comparison of the store views the image was built with against Magento's availableStores; logs [store-drift] … on a mismatch. Report-only. 0 disables Read in apps/theme/src/lib/store-drift.ts.