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
| Variable | When | Purpose |
|---|---|---|
MAGENTO_GRAPHQL_BUILD_ENDPOINT | server-only, build-time only | Magento 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_ENDPOINT | server-only, runtime | Internal 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)
| Variable | When | Purpose |
|---|---|---|
NEXT_PUBLIC_TURNSTILE_SITE_KEY | build-time, public | Renders 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_ENABLE | server-only, runtime | Enables 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_HOSTNAMES | server-only, runtime | Comma-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_KEY | server-only, runtime | Enables 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
| Variable | When | Purpose |
|---|---|---|
AUTH_GOOGLE_ID | server-only, runtime | NextAuth + 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_SECRET | server-only, runtime | NextAuth + 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_SECRET | server-only, runtime | NextAuth + 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_URL | server-only, runtime | The 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_SECRET | server-only, runtime | NextAuth + 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_ENABLED | build-time, public | Shows the "Continue with Google" button Read in apps/theme/src/components/auth/social-login-buttons.tsx. |
Agentic commerce: UCP
| Variable | When | Purpose |
|---|---|---|
UCP_DELEGATED_PAYMENT | server-only, runtime | Declares 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_RATE | server-only, runtime | Uncached 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_ENABLE | server-only, runtime | Enables 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_WEBHOOKS | server-only, runtime | Order-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_INTERVAL | server-only, runtime | Order-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_KEYS | server-only, runtime | Optional 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_PROFILES | server-only, runtime | Optional 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_LIMIT | server-only, runtime | Per-platform requests/minute for the UCP API (default 120, per instance) Read in packages/engine/src/agentic/ucp/_lib/auth.ts. |
UCP_REDIS_URL | server-only, runtime | Redis 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_KEY | server-only, runtime | Private 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_KEYS | server-only, runtime | Private 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
| Variable | When | Purpose |
|---|---|---|
ACP_ENABLE | server-only, runtime | 1 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_WEBHOOKS | server-only, runtime | ACP 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_INTERVAL | server-only, runtime | ACP 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_KEYS | server-only, runtime | ACP platform credentials, label:secret,…, sent as Authorization: Bearer. Read in packages/engine/src/agentic/acp/_lib/auth.ts. |
ACP_RATE_LIMIT | server-only, runtime | Per-platform requests per minute for the ACP API, per instance. Read in packages/engine/src/agentic/acp/_lib/auth.ts. |
ACP_REDIS_URL | server-only, runtime | Redis 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_TOKENS | server-only, runtime | 1 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_SECRET | server-only, runtime | Shared secret for the HMAC-SHA256 request signature ACP platforms send (Signature + Timestamp). Read in packages/engine/src/agentic/acp/_lib/auth.ts. |
ACP_WEBHOOK_SECRET | server-only, runtime | ACP 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_HEADER | server-only, runtime | ACP 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_URL | server-only, runtime | ACP 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)
| Variable | When | Purpose |
|---|---|---|
STRIPE_MERCHANT_ID | server-only, runtime | Stripe credentials for UCP delegated payment. Only the publishable key is ever published Read in packages/engine/src/agentic/ucp/_lib/stripe.ts. |
STRIPE_PUBLISHABLE_KEY | server-only, runtime | Stripe credentials for UCP delegated payment. Only the publishable key is ever published Read in packages/engine/src/agentic/ucp/_lib/stripe.ts. |
STRIPE_SECRET_KEY | server-only, runtime | Stripe 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
| Variable | When | Purpose |
|---|---|---|
REDIS_URL | server-only, runtime | Shared 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_CONTEXT | server-only, runtime | 1 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_GRAPHQL | server-only, runtime | 1 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
| Variable | When | Purpose |
|---|---|---|
GRAPHQL_PROFILE | runtime / build-time | Verbose 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_PROFILE | runtime / build-time | Verbose per-operation GraphQL timing logs (default on in dev, off in prod) Read in packages/engine/src/apollo/timing-link.ts. |
OTEL_EXPORTER_OTLP_ENDPOINT | server-only, runtime | Enables OpenTelemetry trace/metric/log export; unset = zero overhead Read in apps/theme/src/instrumentation.ts. |
OTEL_SERVICE_NAME | server-only, runtime | Service name on traces, metrics and logs, for example magenx-storefront. Read in apps/theme/src/instrumentation.ts. |
Storefront
| Variable | When | Purpose |
|---|---|---|
ANTHROPIC_API_KEY | server-only, runtime | Claude 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_DISABLED | server-only, runtime | 1 turns the shopper assistant off without a rebuild Read in packages/engine/src/assistant/config.ts. |
ASSISTANT_SEAL_KEY | server-only, runtime | 32+ 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_BOOT | server-only, runtime | On 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_HOSTS | server-only, runtime | Extra 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_SECRET | server-only, runtime | Verifies 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_KEY | build-time, public | Enables the Google Maps embed on the store-locator page Read in apps/theme/magenx.config.ts. |
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION | build-time, public | Google Search Console token Read in apps/theme/magenx.config.ts. |
NEXT_PUBLIC_GTM_ID | build-time, public | Google Tag Manager container id; unset disables analytics entirely Read in apps/theme/magenx.config.ts. |
NEXT_PUBLIC_SITE_URL | build-time, public | Canonical storefront URL (metadataBase, OG tags) Read in apps/theme/src/app/[locale]/auth/session/route.ts, apps/theme/magenx.config.ts. |
PORT | server-only, runtime | Port the Next.js server listens on (default 3000). Read in apps/theme/src/lib/cache-warm.ts. |
STORE_DRIFT_CHECK | server-only, runtime | Boot-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. |