You asked Bolt to connect your app to an AI provider, a payment service or an email sender, and it asked you for an API key. That is a long password your app uses to prove who it is to another service. You pasted it in. Was that okay? The honest answer is: it depends on which key, and where it ended up. This post gives you a way to tell.
Two kinds of keys
Services hand out two kinds of keys. Public keys are made to be seen by everyone, so they can sit in a web page. Secret keys must stay hidden, because they open everything on your account. Stripe's documentation is a clear example: a publishable key (starting pk_) can go in front-end code, which is the part of your app that visitors download and see, while a secret key (starting sk_) has unrestricted permissions and must stay on your back end. The back end is the part of your app that runs on the service's computers, where visitors cannot look. Supabase, the service that keeps your app's data, draws the same line between its publishable key and its secret key.
So putting a Supabase publishable key or a Stripe publishable key in your app is normal. Putting an AI provider key, a Stripe secret key, a Supabase secret key or an email provider key in code that every visitor downloads is not. A browser is the program people use to open websites, such as Chrome or Safari. Anyone who opens the page in a browser can read what it received, including a key.
Why "it is in an environment variable" is not enough
An environment variable is one named setting, kept in a settings file where an app stores its keys. Bolt apps are usually built with Vite, a tool that packages the app. Vite's documentation says that any variable whose name starts with VITE_ is included in the code sent to the browser and is visible to anyone using the app. It advises against giving that prefix to sensitive values, and says VITE_ variables should not contain things like API keys. Many people feel safe because the key sits in a settings panel or a settings file (an env file), then name it with the VITE_ prefix and publish it to the world.
Bolt's support glossary describes environment variables as configuration values such as API keys kept outside your code, and warns that putting sensitive values directly in project files exposes them. That is useful, but the prefix still decides whether the value reaches every visitor.
How to check your own app in five minutes
- Open your published app in a browser, open the developer tools Sources tab (or View Source), and search for "sk_", "secret", "key" and the name of any service you connected. Developer tools are a panel built into the browser that shows the code it received.
- Look at your environment variable names. Any secret with a VITE_ prefix is exposed.
- Check that .env files are not committed to your repository. A repository is the folder that holds your app's code and its history, often kept on GitHub, and to commit is to save a change into that history. GitHub secret scanning looks for credentials across your Git history and alerts you if it finds one.
- Look at your payment and AI calls. If the page calls the provider directly with a secret, move that call to a server-side function.
Where secret keys should live
Keys that must stay secret belong on the service's computers, where visitors cannot look: a serverless function (a small piece of code that runs only when called), an edge function (the same, run close to the visitor), or your host's secrets store. Your page then calls your function, and your function calls the provider. Vite's documentation suggests this pattern: a backend server or serverless or edge functions for production secrets.
A practical way to ask Bolt for this: "Move every call that uses a secret key into a server-side function, and make the page call that function instead. Do not use a VITE_ prefix for any secret." Then re-check the page source as above, because a request is not proof.
If a secret key has already been exposed
Assume it has been copied. Replace it: create a new key, put it where only your server can read it, then turn the old one off. GitHub's documentation says to rotate an affected credential immediately, and notes that cleaning Git history is slow and often unnecessary once the credential is revoked. Check the provider's usage logs for activity you do not recognise.
Questions people ask
Is my Supabase anon key a secret? No, it is made to be seen by everyone, but your table rules must be right, because that key is the one every visitor holds. A table rule is the database's own rule about who may read or change each record. Does a private repository make a key safe? No. The key is still sent to every visitor in the built page. Is a test key a problem? A test-mode key is far less risky than a live one, but treat it the same way so the habit carries over to launch day.
A note on mobile and desktop apps
The same rule applies outside the browser. Code shipped inside a phone app or a desktop app can be unpacked by anyone who downloads it, so a secret key inside it is as exposed as one on a web page. Route those calls through a server you control as well.
What to write down after the fix
Keep a short list of every service your app talks to, which key each one uses, and where that key lives. When something goes wrong, or when a teammate joins, that page saves hours. Next to each key, note whether it is public by design or secret, and the date you last replaced it. Replacing secret keys every few months is a cheap habit that limits how long any old copy stays useful.
It also helps to give each key the smallest power that does the job. Where a service lets you create a restricted key, use one, so a leak can do less damage.
A second pair of eyes
Nordik App Audit is an AI-performed audit of your app's code. It explains what it found in plain words and gives you a fix instruction for each finding. It is not a pentest (a test that tries to break into the running app), and like any review it can miss things. It supports every platform: any app can order, whatever it is built with. The current price and terms are on the Nordik home page. Finding keys that reach every visitor's browser is a standard part of what it looks for. The free scan accepts apps from any platform and points you at where to look first. It is a starting point, not a verdict.