Environment variables
Every environment variable 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
| Place | What goes there |
|---|---|
| Secret store | The 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. |
| Vercel | The 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 files | apps/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 shell | Settings for the skill's own scripts (the WP2NEXT_* names further down). Not secrets. |
Public IDs that are not environment variables: the GTM container 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), shell (sh). Required when says when the site or script fails or misbehaves without it.
The site (apps/web)
Core
| Name | Where set | Secret? | Required when | Used by |
|---|---|---|---|---|
NEXT_PUBLIC_SITE_URL | S, V (all environments), L | no | always | lib/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_ID | S, V, L | no | always | Sanity client in the site |
NEXT_PUBLIC_SANITY_DATASET | S, V, L | no | always | Sanity client; usually production |
NEXT_PUBLIC_SANITY_API_VERSION | S, V, L | no | optional (code default 2025-02-19) | Sanity client |
SANITY_REVALIDATE_SECRET | S, V | yes | always (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_INDEXABLE | V (Production), at go-live | no | at go-live: set to true | Search-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_ANALYTICS | S, V | no | until launch: 1 | Keeps analytics and tags off. Removed from Production at go-live, then redeploy. Analytics also never load outside a production build (NODE_ENV) |
WP2NEXT_BRAND_ROUTE | V, only where it differs from the default | no | only 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_ROUTE | V, only where it differs | no | only to override | Same for /components/ (routes.components) |
Forms
Set only the ones for the destinations in forms.destinations (see Forms and CRM).
| Name | Where set | Secret? | Required when | Used by |
|---|---|---|---|---|
FORMS_SOURCE | S, V | no | always | /api/contact: the domain, shown in emails and webhook payloads |
FORMS_DESTINATIONS | V (usually Preview only) | no | optional | Overrides forms.destinations per environment. Set resend on Preview when a CRM is configured, so test submissions stay out of the CRM |
RESEND_API_KEY | S, V | yes | destination resend | lib/forms/resend.ts. A sending-only key restricted to the client's sending domain |
FORMS_FROM | S, V | no | destination resend | Sender, e.g. Acme Forms <forms@send.example.com>, on a domain verified in the client's Resend account. Never the visitor's address |
FORMS_TO | S, V | no (but personal data) | destination resend | Recipients, comma-separated, max 50. Comes from forms.recipients. To change who gets messages, change it in Vercel and redeploy |
HUBSPOT_SK | S, V | yes | destination hubspot | lib/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_HOST | V | no | rarely | Default api.hsforms.com. Whether EU HubSpot accounts need another host is Not yet confirmed |
MONDAY_API_TOKEN | S, V | yes | destination monday | lib/forms/monday.ts. Token of a monday.com user the client owns |
MONDAY_API_VERSION | V | no | only to change it | Default 2026-10, pinned in monday.ts on purpose |
FORMS_WEBHOOK_URL | S, V | yes | destination webhook | lib/forms/webhook.ts. Anyone with the URL can post leads |
FORMS_WEBHOOK_TOKEN | S, V | yes | optional, with webhook | Bearer token, if the endpoint wants one |
Optional features
| Name | Where set | Secret? | Required when | Used by |
|---|---|---|---|---|
INDEXNOW_KEY | V (Production only) | no (public by design) | seo.indexNow is true | Served 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_TOKEN | V | no (public phc_… token) | analytics posthog | PostHog loader. Personal API keys are secrets and never go here |
NEXT_PUBLIC_POSTHOG_HOST | V | no | analytics posthog | PostHog API host, e.g. https://us.i.posthog.com |
Set by the platform (don't set these)
| Name | Set by | Used by |
|---|---|---|
VERCEL_ENV | Vercel, 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_ENV | Next.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_SECRET | Vercel, on its own builds | See scripts below. Don't push-vercel it |
VERCEL_OIDC_TOKEN | vercel link, in a repo-root .env.local | Nothing in wp2next. Delete that file; secrets live in the store |
Older sites (before 2.0)
| Name | Status |
|---|---|
FORMS_PROVIDER | Still 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)
| Name | Where set | Secret? | Required when | Used by |
|---|---|---|---|---|
SANITY_STUDIO_PROJECT_ID | S, L (apps/studio/.env); not Vercel | no | always for the Studio | sanity.cli.ts, Studio, seed-upsert.ts and content scripts |
SANITY_STUDIO_DATASET | S, L | no | always for the Studio | Same; usually production |
SANITY_AUTH_TOKEN | S only | yes | deploying the Studio | Sanity 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_TOKEN | S only | yes | importing or editing content from scripts | seed-upsert.ts and content scripts (role Editor), always under secrets.py run -- |
PSI_API_KEY | S only | yes | optional | lighthouse.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 secret.
| Name | Config key | Default | What it does |
|---|---|---|---|
WP2NEXT_SECRETS_BACKEND | secrets.backend | dotenv | Which secret store |
WP2NEXT_SECRETS_NAMESPACE | secrets.namespace | wp2next/{code} | Item, project or folder name in the store |
WP2NEXT_CODE | code | none | Fills {code} when there is no wp2next.json |
WP2NEXT_SECRETS_ACCOUNT | secrets.account | none | 1Password account (sign-in address or ID) |
WP2NEXT_SECRETS_VAULT | secrets.vault | your default vault | 1Password vault |
WP2NEXT_SECRETS_ENVIRONMENT_ID | secrets.environmentId | unset | 1Password Environment ID (switches to Environments mode) |
WP2NEXT_SECRETS_PROJECT | secrets.project | none | Bitwarden project ID, Doppler project or Infisical project ID |
WP2NEXT_SECRETS_CONFIG | secrets.config | dev | Doppler config |
WP2NEXT_SECRETS_ENV | secrets.env | dev | Infisical environment |
WP2NEXT_SECRETS_RECORD | secrets.record | none | Keeper record UID |
WP2NEXT_DOTENV_STORE | none | ${XDG_CONFIG_HOME:-~/.config}/wp2next/secrets/<namespace>.env | Store file for the dotenv backend |
WP2NEXT_VERCEL_ENVIRONMENTS | none | production preview development | Environments push-vercel (and the vercel backend) write to |
WP2NEXT_VERCEL_SCOPE | vercel.team | the linked project's team | vercel --scope |
WP2NEXT_ALLOW_UNIGNORED | none | unset | 1 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 Secrets Manager 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
| Name | Secret? | Used by | What it does |
|---|---|---|---|
WP2NEXT_CONFIG | no | config.py (and every script that reads config) | Path of the user config file, instead of the default |
XDG_CONFIG_HOME | no | config.py, secrets.py | Base folder for the user config and the dotenv store (default ~/.config) |
WP2NEXT_REPO | no | version.py, report.py | GitHub owner/repo to check for updates and to open report issues in (default the public wp2next repo) |
WP2NEXT_BRANCH | no | version.py | Branch for raw files (default main) |
WP2NEXT_OFFLINE | no | version.py | 1 = never touch the network (same as --offline) |
XDG_STATE_HOME, CLAUDE_CODE_PLUGIN_CACHE_DIR, CODEX_HOME | no | version.py | Read only to find where wp2next is installed |
CLAUDECODE, CODEX_*, CURSOR_* | no | report.py | Read only to guess your AI tool when agent.primary is unset |
Scan and measure scripts
| Name | Secret? | Used by | What it does |
|---|---|---|---|
VERCEL_AUTOMATION_BYPASS_SECRET | yes | lighthouse.mjs, seo-scan.mjs, compliance-scan.mjs, redirect-audit.mjs, capture.ts | Lets 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_KEY | yes | lighthouse.mjs --psi | See above |
CHROME_PATH | no | lighthouse.mjs | Chrome or Chromium binary, when --chrome is not given |
PLAYWRIGHT_BROWSERS_PATH, LOCALAPPDATA (Windows) | no | lighthouse.mjs | Where to look for Playwright's Chromium |
NODE_PATH | no | lighthouse.mjs | Extra 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 command line.
redirect-audit.mjs --ignore-https-errors sets NODE_TLS_REJECT_UNAUTHORIZED=0 for its own process
(for Local's self-signed .local certificates). Don't set it yourself.
Other tools you may meet
| Name | Notes |
|---|---|
VERCEL_TOKEN | For 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_TELEMETRY | off turns off the Vercel plugin's telemetry in your AI tool. See companion skills |
Related
- Secrets: picking and setting up a store
- Configuration:
wp2next.jsonand the user config - Scripts:
secrets.pyverbs and the scan scripts - Agent references:
references/secrets.md (external site),references/forms.md (external site),references/infra.md (external site)