How to secure an app built with Bolt.new
Last updated
Treat everything in a Bolt front end as public: keep secret keys out of VITE_ variables, move payments, AI calls and admin actions to Supabase Edge Functions or another server, turn on row level security for every table, and scan the published URL for leaked keys, exposed files and missing headers.
What Bolt generates
Bolt typically produces a Vite and React single-page app, often with Supabase for data and auth. Everything Vite builds, including any variable prefixed VITE_, ends up in JavaScript that every visitor downloads.
That means the security of the app lives in two places you cannot see in the preview: the database rules and whatever server code you add. If there is no server code, there is nothing to stop a visitor calling your database or AI provider directly.
The checklist
- Search the project for VITE_ variables and confirm none of them hold a secret key.
- Move calls that need a secret (payments, AI, email, admin) into Supabase Edge Functions or an API route, and call those from the browser instead.
- Turn on row level security for every Supabase table and test it with only the anon key.
- Enforce plan limits and roles in the server code or RLS policies, not by hiding buttons.
- Make sure the published site serves a real 404 page and does not expose source maps or .env files.
- Add a privacy policy and terms before collecting emails or payments.
- Scan the published URL and fix critical and high findings before you share it.
Questions
- Are VITE_ environment variables secret?
- No. Vite replaces them in the client bundle at build time, so any visitor can read them.
- Do I need a backend for a Bolt app?
- You need server-side code for anything that uses a secret key or must be enforced, such as payments, AI calls with your key, and admin actions. Supabase Edge Functions are a common choice.
Related Defexity checks
Sources
Defexity reports potential risks it can see from outside your app. It is not a guarantee of security and not legal advice.