Skip to content
wp2next, home
Skip to the page

Environment variables

Every a wp2next site or the skill's scripts read.

Anything whose name starts with NEXT_PUBLIC_ is built into the pages and sent to every visitor's browser. Never put a token under that prefix.

Where values live

PlaceWhat goes there
Secret storeThe source of truth for every value below marked "store", secret or not, so every tool reads one place. Chosen with secrets.backend (config); written only with secrets.py put (value from a hidden prompt or a pipe, never as an argument). See Secrets.
VercelThe values the live site needs. secrets.py push-vercel copies them from the store: the Secret type (write-only) in Production and Preview, the Config type in Development and for every NEXT_PUBLIC_* name.
Local filesapps/web/.env.local (Next.js dev server) and apps/studio/.env (Sanity CLI and Studio), written by secrets.py env-file, gitignored, mode 600. Or skip the files and wrap commands: secrets.py run -- pnpm dev.
Your shellSettings for the skill's own scripts (the WP2NEXT_* names further down). Not secrets.

Public IDs that are not environment variables: the and GA4 measurement IDs, HubSpot form GUIDs and monday.com board, group and column IDs live in wp2next.json (config), not in env.

Column key: Where set = store (S), Vercel (V), local file (L), (sh). Required when says when the site or script fails or misbehaves without it.

The site (apps/web)

Core

NameWhere setSecret?Required whenUsed by
NEXT_PUBLIC_SITE_URLS, V (all environments), Lnoalwayslib/site.ts: canonical URLs, sitemap, Open Graph. Value https://<domain>, no trailing slash. Falls back to http://localhost:3000 for local builds
NEXT_PUBLIC_SANITY_PROJECT_IDS, V, LnoalwaysSanity client in the site
NEXT_PUBLIC_SANITY_DATASETS, V, LnoalwaysSanity client; usually production
NEXT_PUBLIC_SANITY_API_VERSIONS, V, Lnooptional (code default 2025-02-19)Sanity client
SANITY_REVALIDATE_SECRETS, Vyesalways (content updates go live through it)The revalidate route, which checks the Sanity webhook's signature. Generated with fsutil.py random-hex 32 inside the store pipeline, never shown
NEXT_PUBLIC_SITE_INDEXABLEV (Production), at go-livenoat go-live: set to trueSearch-engine switch. Unset means noindex plus robots.txt "disallow all", so previews and the pre-launch site stay out of search. Go live sets it in Production. /brand/ and /components/ stay noindex whatever it says
NEXT_PUBLIC_DISABLE_ANALYTICSS, Vnountil launch: 1Keeps analytics and tags off. Removed from Production at go-live, then redeploy. Analytics also never load outside a production build (NODE_ENV)
WP2NEXT_BRAND_ROUTEV, only where it differs from the defaultnoonly to override/brand/ guide switch: on or off. Unset = on in development and preview, off (404) in production. Mirrors routes.brand in wp2next.json. Server-only, read at build time: redeploy after a change
WP2NEXT_COMPONENTS_ROUTEV, only where it differsnoonly to overrideSame for /components/ (routes.components)

Forms

Set only the ones for the destinations in forms.destinations (see Forms and CRM).

NameWhere setSecret?Required whenUsed by
FORMS_SOURCES, Vnoalways/api/contact: the domain, shown in emails and webhook payloads
FORMS_DESTINATIONSV (usually Preview only)nooptionalOverrides forms.destinations per environment. Set resend on Preview when a CRM is configured, so test submissions stay out of the CRM
RESEND_API_KEYS, Vyesdestination resendlib/forms/resend.ts. A sending-only key restricted to the client's sending domain
FORMS_FROMS, Vnodestination resendSender, e.g. Acme Forms <forms@send.example.com>, on a domain verified in the client's Resend account. Never the visitor's address
FORMS_TOS, Vno (but personal data)destination resendRecipients, comma-separated, max 50. Comes from forms.recipients. To change who gets messages, change it in Vercel and redeploy
HUBSPOT_SKS, Vyesdestination hubspotlib/forms/hubspot.ts. A HubSpot service key (scopes forms, crm.objects.contacts.write; .read optional) or an existing legacy private-app token. The portal ID is read from it
HUBSPOT_FORMS_HOSTVnorarelyDefault api.hsforms.com. Whether EU HubSpot accounts need another host is Not yet confirmed
MONDAY_API_TOKENS, Vyesdestination mondaylib/forms/monday.ts. Token of a monday.com user the client owns
MONDAY_API_VERSIONVnoonly to change itDefault 2026-10, pinned in monday.ts on purpose
FORMS_WEBHOOK_URLS, Vyesdestination webhooklib/forms/webhook.ts. Anyone with the URL can post leads
FORMS_WEBHOOK_TOKENS, Vyesoptional, with webhookBearer token, if the endpoint wants one

Optional features

NameWhere setSecret?Required whenUsed by
INDEXNOW_KEYV (Production only)no (public by design)seo.indexNow is trueServed at /indexnow-key.txt and sent with each IndexNow ping. 8–128 characters [a-zA-Z0-9-], generated once with fsutil.py random-hex 16 (checked 2026-12, IndexNow FAQ⁠ (external site))
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENVno (public phc_… token)analytics posthogPostHog loader. Personal API keys are secrets and never go here
NEXT_PUBLIC_POSTHOG_HOSTVnoanalytics posthogPostHog API host, e.g. https://us.i.posthog.com

Set by the platform (don't set these)

NameSet byUsed by
VERCEL_ENVVercel, at build and run time: production, preview or development (checked 2026-12, Vercel system environment variables⁠ (external site))Internal-route switches, IndexNow ping (production only). What a Vercel custom environment (e.g. "staging") reports is Not yet confirmed, so set the route switches explicitly there
NODE_ENVNext.js (production for next build)Analytics load only in production builds; internal routes are on outside production when VERCEL_ENV is absent (a local next build && next start counts as production)
VERCEL_AUTOMATION_BYPASS_SECRETVercel, on its own buildsSee scripts below. Don't push-vercel it
VERCEL_OIDC_TOKENvercel link, in a repo-root .env.localNothing in wp2next. Delete that file; secrets live in the store

Older sites (before 2.0)

NameStatus
FORMS_PROVIDERStill read when FORMS_DESTINATIONS is unset, and it overrides forms.destinations. wp2next upgrade removes it
HUBSPOT_PORTAL_ID, HUBSPOT_FORM_GUID, HUBSPOT_FORM_GUID_<TYPE>Read by nothing in 2.0 (the portal comes from HUBSPOT_SK, GUIDs from forms.hubspot.forms). Kept until upgrade replaces them

Sanity Studio and content tools (your machine)

NameWhere setSecret?Required whenUsed by
SANITY_STUDIO_PROJECT_IDS, L (apps/studio/.env); not Vercelnoalways for the Studiosanity.cli.ts, Studio, seed-upsert.ts and content scripts
SANITY_STUDIO_DATASETS, Lnoalways for the StudioSame; usually production
SANITY_AUTH_TOKENS onlyyesdeploying the StudioSanity CLI deploy (role deploy-studio). Created with sanity tokens create inside the store pipeline (checked 2026-12, Sanity CLI tokens⁠ (external site))
SANITY_DEV_API_TOKENS onlyyesimporting or editing content from scriptsseed-upsert.ts and content scripts (role Editor), always under secrets.py run --
PSI_API_KEYS onlyyesoptionallighthouse.mjs --psi field data from PageSpeed Insights. Without it, field data may hit the shared quota or be skipped

The WordPress application password (REST export fallback) and any personal GitHub or Vercel tokens also live only in the store, under names you choose.

Skill scripts

secrets.py settings

An env var wins over the matching config key. None of these is a .

NameConfig keyDefaultWhat it does
WP2NEXT_SECRETS_BACKENDsecrets.backenddotenvWhich secret store
WP2NEXT_SECRETS_NAMESPACEsecrets.namespacewp2next/{code}Item, project or folder name in the store
WP2NEXT_CODEcodenoneFills {code} when there is no wp2next.json
WP2NEXT_SECRETS_ACCOUNTsecrets.accountnone1Password account (sign-in address or ID)
WP2NEXT_SECRETS_VAULTsecrets.vaultyour default vault1Password vault
WP2NEXT_SECRETS_ENVIRONMENT_IDsecrets.environmentIdunset1Password Environment ID (switches to Environments mode)
WP2NEXT_SECRETS_PROJECTsecrets.projectnoneBitwarden project ID, Doppler project or Infisical project ID
WP2NEXT_SECRETS_CONFIGsecrets.configdevDoppler config
WP2NEXT_SECRETS_ENVsecrets.envdevInfisical environment
WP2NEXT_SECRETS_RECORDsecrets.recordnoneKeeper record UID
WP2NEXT_DOTENV_STOREnone${XDG_CONFIG_HOME:-~/.config}/wp2next/secrets/<namespace>.envStore file for the dotenv backend
WP2NEXT_VERCEL_ENVIRONMENTSnoneproduction preview developmentEnvironments push-vercel (and the vercel backend) write to
WP2NEXT_VERCEL_SCOPEvercel.teamthe linked project's teamvercel --scope
WP2NEXT_ALLOW_UNIGNOREDnoneunset1 lets env-file write a file git would commit (with a warning). Avoid

Sign-in for some stores is an env var you set up yourself, outside wp2next: BWS_ACCESS_TOKEN (Bitwarden machine account) and KSM_CLI_TOKEN (Keeper one-time token at setup). Both are secrets: keep them in your password manager, never in chat. See Secrets.

Config, version and report scripts

NameSecret?Used byWhat it does
WP2NEXT_CONFIGnoconfig.py (and every script that reads config)Path of the user config file, instead of the default
XDG_CONFIG_HOMEnoconfig.py, secrets.pyBase folder for the user config and the dotenv store (default ~/.config)
WP2NEXT_REPOnoversion.py, report.pyGitHub owner/repo to check for updates and to open report issues in (default the public wp2next repo)
WP2NEXT_BRANCHnoversion.pyBranch for raw files (default main)
WP2NEXT_OFFLINEnoversion.py1 = never touch the network (same as --offline)
XDG_STATE_HOME, CLAUDE_CODE_PLUGIN_CACHE_DIR, CODEX_HOMEnoversion.pyRead only to find where wp2next is installed
CLAUDECODE, CODEX_*, CURSOR_*noreport.pyRead only to guess your AI tool when agent.primary is unset

Scan and measure scripts

NameSecret?Used byWhat it does
VERCEL_AUTOMATION_BYPASS_SECRETyeslighthouse.mjs, seo-scan.mjs, compliance-scan.mjs, redirect-audit.mjs, capture.tsLets the scripts see a protected Vercel preview before DNS moves. When it is in the environment (run under secrets.py run --), each script sends it as the x-vercel-protection-bypass header to the scanned deployment's own host only; never printed or written. --no-vercel-bypass turns that off. You create it in Vercel (Deployment Protection → Protection Bypass for Automation; all plans, checked 2026-12, Vercel docs⁠ (external site)) and store it with secrets.py put. handoff regenerates it when the client takes over
PSI_API_KEYyeslighthouse.mjs --psiSee above
CHROME_PATHnolighthouse.mjsChrome or Chromium binary, when --chrome is not given
PLAYWRIGHT_BROWSERS_PATH, LOCALAPPDATA (Windows)nolighthouse.mjsWhere to look for Playwright's Chromium
NODE_PATHnolighthouse.mjsExtra places to look for the lighthouse and chrome-launcher packages

--header 'Name: env:VAR' on the scan scripts reads a header value from any variable you name, so a secret never appears on the .

redirect-audit.mjs --ignore-https-errors sets NODE_TLS_REJECT_UNAUTHORIZED=0 for its own process (for 's self-signed .local certificates). Don't set it yourself.

Other tools you may meet

NameNotes
VERCEL_TOKENFor automation, the Vercel CLI reads a token from this variable. Never pass a token with --token on the command line. See MCP and CLI
VERCEL_PLUGIN_TELEMETRYoff turns off the Vercel plugin's telemetry in your AI tool. See companion skills