.env file, so your dev server and production build can read them at runtime.
Viewing variables
Switch to Code view, then click the ENV tab in the left sidebar. The panel shows two sections:System variables (read-only)
These are set automatically by the platform and cannot be changed. A common example isVITE_CONVEX_URL, which is injected whenever your project has a Convex backend configured. Your app can read these like any other env variable.
User variables
Variables you add yourself. These are persisted with the project and restored every time you open the workspace.Adding a variable
In the ADD VARIABLE section at the bottom of the ENV panel:- Enter the key (automatically uppercased, e.g.
STRIPE_SECRET_KEY). - Enter the value.
- Optionally check Mark as secret — secret values are masked in the UI after saving and never shown in plaintext again.
- Click + Add.
.env and picked up on the next dev server start or build. Already-running processes need to be restarted to see the change.
The
.env file is regenerated from this panel each time you save, start the dev server, or deploy — so manage your variables here rather than editing .env by hand, since hand edits will be overwritten.Bulk import
Click the upload icon at the top of the ENV panel to paste in a.env file’s contents all at once. The format is standard dotenv:
Exporting variables
Click the download icon to export all user variables as a.env file. Secrets are excluded from the export for security.
How variables are used
- Dev server — variables are written to the sandbox’s
.envfile before the dev server starts. Your Vite or Next.js app can read them viaimport.meta.env.VITE_*orprocess.env.*. - Deploy — when you publish to Cloudflare Pages, user variables are bundled into the build environment. Secrets are passed as encrypted Cloudflare environment variables.
- AI agent — the agent does not read variable values, only their keys. This means the agent can reference
VITE_CONVEX_URLin generated code without ever seeing the actual URL.
Environment variables reference
System-injected variables
These variables are set automatically by the platform based on your project configuration:| Variable | Description | Injected when |
|---|---|---|
VITE_CONVEX_URL | Convex backend URL for web projects | Project has Convex configured |
VITE_UPLOADTHING_TOKEN | UploadThing file upload token | Project uses UploadThing |
Framework-specific prefixes
Different frameworks expose environment variables to client-side code differently: Vite projects:- Prefix with
VITE_to expose to browser code - Example:
VITE_API_URL→ accessible viaimport.meta.env.VITE_API_URL - Without prefix: only available in Node.js/server code via
process.env
- Prefix with
NEXT_PUBLIC_to expose to browser code - Example:
NEXT_PUBLIC_API_URL→ accessible viaprocess.env.NEXT_PUBLIC_API_URL - Without prefix: only available on the server via
process.env
Usage examples
Vite + React:Security
- Secrets are stored encrypted in Botflow’s database and are never included in exports or logs.
- Non-secret variables are stored in plaintext and visible to anyone with access to the project.
- Never put production secrets (payment keys, database passwords) in non-secret variables.
- Best practice: Use different keys for development and production. Rotate keys if you suspect exposure.