Manage secrets
The Secrets view lists each secret’s name and creation date. Values are never shown.- Add secret opens a dialog where you can enter one or more name and value pairs.
- Remove deletes a secret. This cannot be undone; if a feature still needs the value, your app breaks until you add it again.
- Secrets are write-only: after you save a secret, its value can never be viewed again in Lovable, only replaced or deleted. If you lose a key, generate a new one at the service that issued it. Secrets are not copied when a project is remixed.
- Lovable: managed by Lovable and required for the platform to work. These cannot be deleted.
- Manage: added by a connector. The value is managed by the connection, and you delete it by removing the connection, not from the Secrets view.
- Not in use: another secret with the same name takes precedence at runtime.
LOVABLE_API_KEY secret, used by built-in AI, has a Rotate action. If you suspect the key has been exposed, rotate it: Lovable issues a new key and updates your Edge Function environment automatically. Rotating requires editor access or above.
Secrets vs. VITE_ environment variables
Lovable’s Secrets manager is for backend values only: values used by Edge Functions and server-side integrations. Anything prefixed with VITE_ is a build-time, browser-exposed value and must live in your project’s .env file instead, not in Secrets.
- Backend secrets (use Secrets):
STRIPE_SECRET_KEY,RESEND_API_KEY,OPENAI_API_KEY, third-party service credentials, and anything that must never reach the browser. - Frontend variables (use
.env): anything prefixed withVITE_, such asVITE_SUPABASE_URLandVITE_SUPABASE_PUBLISHABLE_KEY. These are embedded into the client bundle at build time and are safe to be public. You can find and edit them in the.envfile in Lovable’s code editor or in your synced GitHub repository.
VITE_-prefixed name in Secrets, Lovable rejects it with a message like “VITE_ prefixed variables are build-time browser values and should be defined in .env files, not in secrets.”
Reserved secret name prefixes
The following name prefixes are managed automatically by Lovable Cloud and cannot be created or overwritten in the Secrets UI:SUPABASE_: for exampleSUPABASE_URL,SUPABASE_ANON_KEY,SUPABASE_SERVICE_ROLE_KEY,SUPABASE_DB_URL. These are populated by Lovable when Cloud (or a connected Supabase project) is enabled.LOVABLE_: reserved for Lovable-managed values such as the Lovable API key used by built-in AI.
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")).
If your project uses an external Supabase connection instead of Lovable Cloud, secrets are managed in Supabase: the backend view shows a Manage secrets button that opens your Supabase project’s dashboard.
FAQ
Can I view a secret's value after saving it?
Can I view a secret's value after saving it?
No. Secrets are write-only: you can replace or delete a secret, but never read its value back. If you lose a key, generate a new one at the service that issued it.
Are secrets copied when I remix a project?
Are secrets copied when I remix a project?
Lovable-generated keys are recreated fresh in the remixed project. Manually added secrets are not copied over, so re-enter them in the new project.
Where do my secrets get used?
Where do my secrets get used?
Secrets are injected into your project’s Edge Functions and server-side integrations at runtime. They are never included in your frontend code or exposed to the browser.
Should I put my API key in a secret or in .env?
Should I put my API key in a secret or in .env?
If the value must stay private (payment keys, AI provider keys, service credentials), use Secrets. If it’s a
VITE_-prefixed build-time value that is safe to be public, it belongs in .env.