Secrets: where wp2next keeps passwords and API keys
Note
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 password manager 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.
Your secret store holds everything, including tokens you only need on your own machine (for
example the Sanity editor token used to import content).
Vercel environment variables hold the values the live site needs (forms, Sanity, revalidation).
wp2next writes deploy-time values to both. Vercel stores them as "Secret" values that can't be read
back later, so the copy in your secret store is the one you can recover.
Mac only; your own machine only. On Windows or Linux it stops with a clear error; pick another backend
vercel
vercel CLI
Comes with Vercel
Values marked Secret can't be read back, so keep a copy somewhere
dotenv
A plain file
Yes, free
Simplest and least safe; fine for a solo project on your own laptop
Not supported as their own backend: Dashlane, Proton Pass and LastPass. Their CLIs 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.
All secret handling goes through one small script in the skill,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
POWERSHELL
py <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 bash is available (macOS, Linux, Git Bash). The table below writes the
script as secrets.py.
Command
What it does
secrets.py put KEY
Saves a value. It reads the value from a hidden prompt or from piped input, never from the command line
secrets.py has KEY
Says 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 list
Lists 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 info
Shows which store and namespace the project uses and where values live. Never shows values
secrets.py help
Shows 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.
Linux: add 1Password's package repository, then install 1password-cli.
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.
Check it works: op whoami.
Optional, recommended for Claude Code: the 1Password MCP server (beta). It lets your assistant create
and fill a 1Password Environment without ever seeing the values.
Code
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 commit before
mounting.
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)).
macOS and Linux: download the binary from Keeper's GitHub releases page.
In Keeper, create an application and a "Client Device". Copy the one-time token it shows.
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.
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 login, then infisical init in the project folder. That writes .infisical.yaml.
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)).
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 -wlast. Then security prompts for the value. If you type the value right after -w,
it goes into your shell history.
Choose this if you don't use a password manager and want values in one place online.
Install and log in: npm i -g vercel, then vercel login.
Link the project folder: vercel link.
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.
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.
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.
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 AI assistant'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.