A .env file is a plain text file that holds an app's settings, one per line, in the form NAME=value. It usually contains the addresses of the services the app uses and the keys and passwords for them. The name starts with a dot, which hides the file in most folder views.
What it is for
Settings change between a developer's machine, a test server and the live site, and secrets should not be written into the code. The .env file solves both: the code reads a name such as DATABASE_URL, and each place the app runs has its own file with the right value. Variants such as .env.local and .env.production let one project keep several sets side by side.
The file is meant to stay where the app is built or run. It is normally listed in .gitignore, so that it is never committed to version control, and it is not part of what is published.
Public by design, and public by mistake
Some values in a .env file are meant to end up in the browser. In a project built with Vite, every variable whose name starts with VITE_ is compiled into the JavaScript the browser receives, as the Vite guide on env variables explains. Next.js does the same with NEXT_PUBLIC_. The publishable Supabase key belongs here, because it is designed to be public.
The rest are secrets: a database password, a payment provider's secret key, a service role key. When the file itself is copied to the public site, by uploading a whole folder or by a build step that copies everything in the root, anyone can open it at the app's address with /.env added to the end.
How to check and what to do
Open /.env, /.env.local and /.env.production on the live site and look at what comes back. A single-page app answers every unknown address with its own page and status 200, so a successful answer is not proof. A real settings file is plain text with lines of NAME=value.
If one is there, take it down, and then replace every secret in it at the service that issued it. The file has been readable for as long as it was published, and removing it does not change what was already copied. Three files that should not be on a live site covers this together with the version history and source maps.