Is it safe to put an API key in a Bolt app?
An API key is a long password your app uses to prove who it is to another service. Public keys, such as a Supabase publishable key or a Stripe publishable key, are made to be seen by everyone. Secret keys, such as a Stripe sk_ key or a Supabase secret key, are not.
Bolt apps usually use Vite, whose documentation says variables (named settings) starting with VITE_ are bundled into the browser code and should not contain API keys. The browser is the program people use to open websites, such as Chrome or Safari. Move calls that need a secret into a server-side function, which runs on the service's computers, where visitors cannot look.
If a secret has been in your published code, treat it as copied and replace it: make a new one and turn the old one off.
Sources
- Vite documentation, Env variables and modes, accessed 2026-11-16
- Stripe documentation, API keys, accessed 2026-11-16
- Supabase documentation, API keys, accessed 2026-11-16