Environment variables
View, add, edit, and delete the project's .env from the app, then restart the preview.
- Environment Variables
- View, add, edit, delete
- Confirm if a preview is running
- Only if one was already running
No more SSH-ing in to edit a .env file by hand. From a session's settings, open Environment Variables to see every variable in the project's .env, add new ones, edit existing values, or delete rows — values are masked by default, with a per-row reveal when you need to check one. Save, and if a preview is already running, CodeAgent offers to restart it so the change takes effect immediately.
Existing values are hidden until you reveal them row by row — new rows you add start revealed so you can check what you typed.
Saving rewrites the .env file safely, so a crash or interrupted write can't leave it half-written.
If a preview is running when you save, CodeAgent asks to restart it so the dev server picks up the new values.
It only needs a connected session — Preview doesn't have to have run first.
- 1Open session settings
From a session, open the kebab menu and tap Environment Variables.
- 2View or edit
Reveal a masked value, edit it in place, add a new row, or delete one.
- 3Save
If a preview is running, confirm the restart prompt — otherwise it's saved straight away.
- 4Preview restarts (if needed)
The dev server restarts with the updated variables; a success toast confirms the save.
Comments in the .env file are not preserved — saving rewrites the file from the variable list, so keep notes elsewhere.
FAQ
Related
Ready to try it?