Guide
Shutting down or replacing an old Lovable / Supabase / vibe-coded app: rotate these keys
Turning the site off does not erase a key that already shipped. The old JavaScript and the git history still have it. Rotate at the provider, then delete the deploys that served the old bundle.
The old bundle still has the key
A key that was in client code is in every build that included it. Preview deploys, a cached file on a CDN, a fork, and a zip someone downloaded all count. Deleting today’s production URL does not edit those copies.
Git is the same. A committed .env or a hardcoded string stays in history after you delete the line on the latest commit. Rewriting history is a separate decision, and it does not help if someone already cloned the repo. Treat the value as public and rotate it.
Which names were public to begin with is covered in the env variable guide. A NEXT_PUBLIC_, VITE_, or Astro PUBLIC_ prefix meant the bundler copied the value into the browser. A SvelteKit variable marked public: true is the same idea. The mark was never a runtime guard.
Supabase: secret key, service_role, JWT secret
Rotate a leaked secret key or legacy service_role key by creating a new secret key, pointing every server component at it, then retiring the old one. Supabase’s steps are in Rotate a leaked or compromised API key. Fix the leak first, or the new key leaves the same way.
Legacy anon and service_role keys are JWTs. Supabase’s leaked-key guide says retiring a legacy service_role key deactivates both legacy keys, so move the browser to a publishable key before you do that. The anon key is meant to be public. Rotating it matters when you are turning the legacy pair off, not because the anon key was a secret.
The legacy JWT secret is what signed those JWTs. Supabase’s signing-keys guide says revoking that secret means the project no longer trusts JWTs it signed, which is why anon and service_role have to be disabled first. Their troubleshooting note also says that regenerating the legacy JWT secret invalidates the current API secrets immediately. Prefer the new secret-key rotation above unless you know the JWT secret itself leaked. Sources: JWT signing keys and Rotating anon, service, and JWT secrets.
Stripe, AI providers, and email
Roll any Stripe secret key (sk_), restricted key (rk_), or webhook signing secret that was in the app, in git, or in an old deploy. Stripe documents key types and rolling in API keys. A publishable key (pk_) is meant for the browser. Roll it too if you are closing the Stripe integration and do not want the old client to keep creating tokens against that account.
Revoke AI provider keys in that provider’s dashboard. OpenAI’s help article says to keep keys private. Anthropic keys are created in the Claude Console and sent as request credentials, so a leaked one is retired there, not by deleting the app. Sources: OpenAI API key safety and Anthropic getting started. Do the same for the email provider. A Resend, SendGrid, or similar API key sends mail as you until it is revoked there. Deleting the Lovable project does not revoke it.
If a database URL with a password was in the bundle or the repo, rotate that database password. The old string keeps working until you do.
Delete or disable the old project and the old deploys
After the new keys are in use, delete or disable the old Lovable project, the old Supabase project if you are not keeping the data, and the host project that served the app (Vercel, Netlify, or wherever the publish went). Turn off preview deploys that still build the old commit. A project you only “pause” can still be one setting away from serving the old bundle.
If the replacement app has a public URL, run the free check on that URL. It reads what a visitor can already fetch. It does not read git history, and it does not test row level security. The Launch Report opens that same pass. It does not scan anything new. Monitor, €9 a month, repeats the same passive check each week and when a deploy hook fires. It will not notice a key sitting in an old commit.
auth.uid() if you leave Supabase
Policies written as auth.uid() = user_id call a function Supabase installs. Supabase’s row level security guide describes auth.uid() as the id of the user from the JWT. Source: Row Level Security. Plain Postgres does not include that function. A dump of the tables does not bring Supabase Auth with it.
Copying the function into the new database is not enough. It returns a user id only when the request carries the same JWT context Supabase Auth sets. If the new app signs users in some other way, rewrite the policy for that system. Until you do, either the policy errors, or it does not mean what it meant. This scan cannot see those policies on the old project or the new one.
Questions
Does deleting the Lovable project invalidate keys that were in the bundle?
No. Deleting the project stops that host from serving the app. Copies of the JavaScript, and any key committed to git, still contain the old value until you rotate the key at the provider.
Do I need to rotate the Supabase anon key when I shut the app down?
Rotate any key that can bypass row level security: the secret key or the legacy service_role key. The anon key is public by design. If you are retiring the project, follow Supabase’s leaked-key guide for a secret that leaked. Deactivating legacy keys turns off both anon and service_role.
Will auth.uid() policies work if I move the database to plain Postgres?
Not by themselves. auth.uid() is a Supabase function. Plain Postgres does not have it, and it only returns a user id when the request carries a Supabase Auth JWT. Those policies need a replacement for whatever auth the new database actually uses.
Does ShipShape Scan find keys in git history?
No. The free check fetches the public URL. It does not read your git history, your host’s environment dashboard, or old deploys that are no longer linked from that URL. It does not test row level security.