Environment variables and secrets
Store configuration and credentials outside your code. Values are encrypted at rest and injected into your app.
Set variables from the CLI
$ deployxa env set API_KEY sk_live_123 $ deployxa env list $ deployxa env remove API_KEY
env commands act on the linked project. To target another project without linking, use the positional form deployxa env <projectId> KEY VALUE.Set variables in the dashboard
Open a project and its Environment tab. Table mode lets you add, reveal, copy and delete single values; bulk mode accepts a pasted .env file. The new-project wizard has the same editor, so you can add variables before the first build.
When changes take effect
Treat a variable change as needing a new deployment. After changing values, run:
$ deployxa redeploy
Frameworks that inline variables at build time (for example NEXT_PUBLIC_* in Next.js or VITE_* in Vite) need a rebuild, not just a restart. Those values end up in browser code, so never put secrets in them.
.env file format
# comments are ignored DATABASE_URL=postgres://user:pass@host:5432/app REDIS_URL=redis://host:6379 SESSION_SECRET=change-me
env push splits each line at the first = and trims whitespace. It does not strip quotes, so write KEY=value, not KEY="value", unless the quotes are part of the value. Multi-line values are not supported by push; set them in the dashboard.
Security
- Values are stored encrypted.
deployxa secretslists names without values;env listandenv pulldecrypt them, so run those only where it is safe. - Organizations can require a name prefix for variables.
deployxa teamshows the rule if one is set. - Add
.env,.env.localand.deployxa/to.gitignore. - CLI 1.0.4 uploads the whole folder on
deployxa deploy, including.envfiles. Remove them from the folder, or deploy from Git, so secrets live only in project variables. - Shared projects and environment variables across a team are part of the Team plan and above.
Using variables in code
// Node.js const db = process.env.DATABASE_URL;
# Python import os db = os.environ["DATABASE_URL"]
// PHP / Laravel
$db = env('DATABASE_URL');