Bolt: API keys in front-end code
Anything in your front-end code is downloaded by every visitor. Keys for OpenAI, Stripe secret keys, email services and similar must live on a server.
Free scan: check my app Just your web address. Results in seconds. No signup, no card.
Why it matters for your Bolt app
Bolt.new apps often connect to Supabase, and the code runs in the browser unless you ask for a server function.
Someone copies your key and runs up your bill, sends email as you, or reads your payment data.
How to check in five minutes
- On your live site press F12 and search the loaded files for “sk-”, “sk_live”, “key” and “secret”.
- Check any variable starting with VITE_, NEXT_PUBLIC_ or REACT_APP_. These are public by design.
- Rotate any secret you find, then move it.
What PeekLok’s scan checks
PeekLok’s scan searches your page and the scripts it loads from your own site for common secret key formats: OpenAI, Anthropic, Stripe live secret, AWS, GitHub and Google API keys, plus private key blocks. It can’t recognise every kind of key, so still do the check above.
Fix prompt to paste into the Bolt chat
Find every secret API key used in front-end code, including any VITE_, NEXT_PUBLIC_ or REACT_APP_ variable that holds a secret. Move each call that needs a secret into a server function, store the key as a server secret, and have the front end call that function instead. List the keys I must rotate. (This is a Bolt app using Supabase. Keep secrets in environment variables in your Supabase or hosting dashboard.)
After the AI makes changes, test again with two accounts. AI fixes can look right and still miss a table or route.
Sources
Related
- Bolt: Supabase RLS turned off
- Bolt: Exposed anon or service role key
- Bolt: Open database tables
- Bolt: Missing auth on endpoints
- Bolt: Missing security headers
- Bolt: One customer can see another’s data
Same issue in other builders:
All Bolt security guides · API keys in front-end code explained
Get a free scan
PeekLok checks your live app for secret keys in the page code, a Supabase service or anon key showing, Supabase tables anyone can read with the public key, and five browser security headers. If your app uses Supabase login, you can add two test logins and it checks whether one user can see the other’s data. Only scan apps you own. First scan free. Weekly re-checks will be $12 US a month once payments open.
