Skip to content
wp2next, home
Skip to the page

Secrets: where wp2next keeps passwords and API keys

Your computer

Pick your computer's system. Steps that differ switch to it, and this browser remembers.

For people running migrations (freelancers, agencies, developers). Moving your own site? See the plain-language version.

A rebuild needs a handful of private values: API tokens, passwords and keys. This page explains where wp2next stores them, how to pick a manager, and how to set up each one it supports.

Short version: use the you already have. If it isn't on the list, use Vercel or a plain .env file, which both work everywhere. On a Mac, the built-in macOS Keychain is a free option too; on Windows there is no built-in option, so the free fallback is a .env file.

What counts as a secret

ValueWhat it's forSecret?
Sanity API tokens (editor, deploy)Writing content, deploying the editing app (Sanity Studio)Yes
SANITY_REVALIDATE_SECRETLets Sanity tell the site to refresh a pageYes
RESEND_API_KEY, HUBSPOT_SK, MONDAY_API_TOKEN, FORMS_WEBHOOK_URL, FORMS_WEBHOOK_TOKENSending contact-form messages by email, to HubSpot, to monday.com or to a webhook (only the ones your site uses; see Forms, email and CRM)Yes
FORMS_FROM, FORMS_TOThe email's sender and recipientsNo, but stored the same way so they reach Vercel
HubSpot form IDs, monday.com board, group and column IDsWhere form leads go in your CRMNo (saved in wp2next.json)
Vercel and GitHub tokensOnly if you use tokens instead of logging inYes
WordPress application passwordOnly for the REST-API export fallbackYes
NEXT_PUBLIC_SANITY_PROJECT_ID, GTM ID, GA4 IDPublic IDs that end up in the browser anywayNo

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

Two places secrets live

  1. Your secret store holds everything, including tokens you only need on your own machine (for example the Sanity editor token used to import content).
  2. Vercel hold the values the live site needs (forms, Sanity, revalidation).

wp2next writes deploy-time values to both. Vercel stores them as "" values that can't be read back later, so the copy in your secret store is the one you can recover.

Picking a manager

wp2next asks during /wp2next init and saves your choice as secrets.backend in your (~/.config/wp2next/config.json). Change it later with:

Terminal
python3 <skill-folder>/scripts/config.py set secrets.backend doppler

Your user config is C:\Users\<you>\.config\wp2next\config.json on Windows.

Prices and plan limits below were checked 2026-12. They change, so follow the links before you buy.

Backend (secrets.backend)ToolFree optionNotes
1passwordop CLI, optional MCP serverNo, 14-day trial (pricing⁠ (external site))Best fit for AI agents: its MCP server only ever returns names, never values
keeperksm (Keeper Secrets Manager)Business accounts, with a trial (docs⁠ (external site))Saving a value puts it on the command line (see warning below)
bitwardenbws (Bitwarden Secrets Manager)Yes: 2 users, 3 projects (plans⁠ (external site))Not the same as the Bitwarden password-manager app; saving puts the value on the command line
dopplerdopplerYes: 3 users, 10 projects (pricing⁠ (external site))Built for developer secrets
infisicalinfisicalYes: 5 identities (pricing⁠ (external site))Built for developer secrets
keychainmacOS security (built in)Yes, freeMac only; your own machine only. On Windows or Linux it stops with a clear error; pick another backend
vercelvercel CLIComes with VercelValues marked Secret can't be read back, so keep a copy somewhere
dotenvA plain fileYes, freeSimplest and least safe; fine for a solo project on your own laptop

Not supported as their own backend: Dashlane, Proton Pass and LastPass. Their either can't save values from a script or aren't well maintained. Windows Credential Manager isn't supported either. If you use one of them, pick vercel or dotenv and keep a manual copy in your password manager.

How wp2next uses your store

All secret handling goes through one small script in the , scripts/secrets.py. It's plain Python (standard library only), so the same commands work on macOS, Windows and Linux. Your AI assistant calls it for you; you can also run it yourself:

Terminal
python3 <skill>/scripts/secrets.py put RESEND_API_KEY

scripts/secrets.sh still exists as a three-line wrapper that runs secrets.py, so older notes that name it keep working where is available (macOS, Linux, Git Bash). The table below writes the script as secrets.py.

CommandWhat it does
secrets.py put KEYSaves a value. It reads the value from a hidden prompt or from piped input, never from the command line
secrets.py has KEYSays whether a value exists, without showing it
secrets.py run -- <command>Runs a command with all the project's secrets available to it
secrets.py env-file <path>Writes a private, gitignored file for tools that insist on a file. It updates only its own keys and keeps your other lines. Values are quoted so Next.js reads them back exactly, including $ signs and line breaks (tested with Next.js 16.4.6, checked 2026-12). A value containing a single quote, a backtick and a double quote, or ending in a backslash, can't be written safely: the command names it and you use run for it instead
secrets.py listLists names only
secrets.py push-vercel [KEY...]Copies values (all of them, or the keys you name) into the linked Vercel project's environment variables, without printing them. Run it in the folder you linked with vercel link
secrets.py infoShows which store and namespace the project uses and where values live. Never shows values
secrets.py helpShows these commands. Works in any folder

Secrets for one site are grouped under a namespace, wp2next/<code> by default (secrets.namespace in config). <code> is the short site code you pick in migrate.

push-vercel copies the values the live site needs (Sanity IDs, form settings, tokens) into Vercel; your store stays the master copy. If you chose vercel as your store, there is nothing to copy.

Some stores need one extra setting per site, which migrate asks for: Keeper needs the record ID, Bitwarden the project ID, Doppler the project and config, Infisical the project and environment. These are saved in the site's wp2next.json, not in your personal defaults, so two sites never share one record.

There is deliberately no get or "print this value" command. Assistants are told never to display secret values or open .env files.

Setting up each manager

1Password

  1. Install the CLI (guide⁠ (external site)):
    • macOS: brew install 1password-cli
    • Windows: winget install 1password-cli
    • Linux: add 1Password's package , then install 1password-cli.
  2. In the 1Password desktop app, turn on Settings > Developer > Integrate with 1Password CLI. You then unlock with Touch ID or Windows Hello instead of typing your password.
  3. Check it works: op whoami.
  4. Optional, recommended for Claude Code: the 1Password (beta). It lets your assistant create and fill a 1Password Environment without ever seeing the values.
    Code
    /plugin marketplace add 1Password/1password-claude-plugin
    /plugin install 1password@1password
    Restart Claude Code and check with /mcp. In the Claude desktop app, add the marketplace 1Password/1password-claude-plugin under Customize → Plugins instead, or run the two /plugin lines' CLI equivalents (claude plugin marketplace add …, claude plugin install …) once in a terminal; the app shares CLI plugins. In Codex, add a server under MCP servers with 1password-mcp as the command (Mac and Linux only). In Cursor, install the "1Password Developer Tools" plugin. (docs⁠ (external site))

How wp2next uses it:

  • With the MCP server: it creates an Environment for the site and can mount it as the project's .env files. A mounted file is a pipe, not a real file on disk, so nothing is written in plain text (Mac and Linux only). 1Password asks you to approve the first read.
  • Without it: it stores values as fields on a vault item and runs commands with op run.

Things to know:

  • On business accounts, an admin has to turn on the Environments feature first. Whether Environments are included in the Individual plan wasn't confirmed (checked 2026-12).
  • After you approve a mounted .env once, any program on your machine can read it until 1Password locks again.
  • Tools that watch files for changes can loop on a mounted .env. Tell them to ignore it.
  • If the .env path was ever committed to git, remove it from git (git rm --cached) and before mounting.

Keeper

wp2next uses Keeper Secrets Manager (ksm), not Keeper's password-manager CLI (Commander). Secrets Manager is a Business-account feature and an admin has to enable it (checked 2026-12, docs⁠ (external site)).

  1. Install (guide⁠ (external site)):
    • Any system with .10+: pip3 install 'keeper-secrets-manager-cli[keyring]'
    • Windows: winget install KeeperSecurity.KeeperSecretsManager
    • macOS and Linux: download the binary from Keeper's GitHub releases page.
  2. In Keeper, create an application and a "Client Device". Copy the one-time token it shows.
  3. Run ksm profile init, and supply the token through the KSM_CLI_TOKEN environment variable rather than typing it after --token, so it stays out of your shell history.

Warning: ksm only accepts a new value as part of the command itself, which means other programs on the machine and your shell history can briefly see it. secrets.py warns before doing this. On a shared machine, paste values into the Keeper app instead.

Bitwarden

wp2next uses Bitwarden Secrets Manager (bws). It is a separate product from the Bitwarden password manager and is turned on per organization.

  1. Install (guide⁠ (external site)):
    • macOS and Linux: curl https://bws.bitwarden.com/install | sh
    • Windows (): iwr https://bws.bitwarden.com/install | iex
  2. In the Bitwarden web app, create a project for the site and a machine account with access to only that project. Create an access token for it.
  3. Make the token available as BWS_ACCESS_TOKEN (for example, keep it in your password manager and load it when you start work).

Warning: like Keeper, bws secret create takes the value on the command line. secrets.py warns first.

Doppler

  1. Install (guide⁠ (external site)):
    • macOS: brew install gnupg && brew install dopplerhq/cli/doppler
    • Windows: winget install doppler.doppler
    • Linux: Doppler's apt, yum or apk repository.
  2. doppler login, then doppler setup inside the project folder to pick the project and config.

Doppler reads new values from piped input, so nothing lands on the command line. Free plan: 3 users, 10 projects, 4 environments; extra users $8/month each (checked 2026-12, pricing⁠ (external site)).

Infisical

  1. Install (guide⁠ (external site)):
    • macOS: brew install infisical/get-cli/infisical
    • Windows: winget install infisical
    • Any system with Node: npm i -g @infisical/cli
  2. infisical login, then infisical init in the project folder. That writes .infisical.yaml.
  3. wp2next runs commands with infisical sm run --env=dev --path=/ -- <command>.

Free plan: 5 identities (people and machines both count), unlimited projects. Pro is $20 per identity per month billed yearly, $23 billed monthly (checked 2026-12, pricing⁠ (external site)).

macOS Keychain

Built into every Mac. Nothing to install. Mac only: on Windows and Linux choose another backend. Good for a solo maker working on one machine; it doesn't sync to Vercel or to teammates.

wp2next saves each value as a "generic password" named wp2next/<code>/KEY. To add one by hand:

Terminal
security add-generic-password -a "$USER" -s "wp2next/acme/RESEND_API_KEY" -U -w

Keep -w last. Then security prompts for the value. If you type the value right after -w, it goes into your shell history.

Vercel as the source of truth

Choose this if you don't use a password manager and want values in one place online.

  1. Install and log in: npm i -g vercel, then vercel login.
  2. Link the project folder: vercel link.
  3. wp2next adds values with vercel env add NAME --environment production --sensitive, feeding the value from a file or pipe. It runs local commands with vercel env run -- <command>, which writes nothing to disk.

Things to know (docs⁠ (external site), checked 2026-12):

  • Production and Preview values default to the Secret type, which can't be read back, not even by you. If you might need a value again (for local work, or to move hosts), keep a copy somewhere else.
  • The --environment option on env add, list, remove and update needs Vercel CLI 64.6.0 or later. Run vercel --version to check.

Plain .env files

The fallback that always works. wp2next keeps the values in a store file in your user folder (~/.config/wp2next/secrets/<namespace>.env by default; set WP2NEXT_DOTENV_STORE to move it), and writes apps/web/.env.local and apps/studio/.env when a tool needs a file, with permissions that only you can read, and makes sure git ignores them. Deploy-time values still go to Vercel.

On Windows, "only you can read" comes from the folder: files under C:\Users\<you> are normally readable only by your account and administrators. The Unix-style "mode 600" doesn't apply there.

Back the values up in your password manager. A .env file lives on one laptop and is gone if that laptop is.

Pitfalls

  • Shell history. Typing KEY=value command, echo value | ... or --password=value saves the value in your shell history and shows it to other programs. Let secrets.py put prompt you instead. In zsh, running setopt HIST_IGNORE_SPACE once means commands that start with a space aren't saved. PowerShell keeps its own history file (PSReadLine), so the same rule applies there.
  • Committed .env files. wp2next adds .env, .env.* (except .env.example) to .gitignore before the first commit. If a secret was ever committed, treat it as leaked: rotate it, don't just delete the file.
  • Pasting values into chat. Don't paste tokens into your 's chat. Use secrets.py put or your manager's app. Anything in a chat transcript may be stored.
  • Leftover files. Temporary files that held a value should be deleted straight away. secrets.py does this for you.
  • Too-powerful tokens. Use the smallest permission that works: a Sanity Editor token, not Admin; a fine-grained GitHub token; a Bitwarden machine account or Keeper device that sees one project. Rotate tokens after launch.
  • Secret values on Vercel can't be pulled back. vercel env pull writes a placeholder for them. If your local site breaks after a pull, the value needs to come from your secret store.