Skip to main content
Vibe Code Forum

Article: Stay safe from day one: keys, data and costs

Most vibe coding disasters are not bugs. They are leaked keys, exposed user data and bills nobody expected. Ten minutes here prevents nearly all of them.

1. Treat API keys like passwords

An API key lets anyone who has it use a service on your account, and you pay. So:

  • Never paste keys into a public forum post, screenshot or chat you share.
  • Never put a secret key in front-end code. Anything that runs in the browser can be read by anyone. In many frameworks, variables starting with NEXT_PUBLIC_ or VITE_ are sent to the browser on purpose; never put secrets in those.
  • Keep keys in environment variables, and keep the .env file out of Git. See Environment variables and .env files.
  • If a key leaks, revoke it at the provider first, then clean up. See I pushed my API key to GitHub.

2. Protect your users' data

If people sign up, you hold their email and whatever they type. AI tools often build a working app with the database wide open:

  • If you use Supabase, turn on Row Level Security for every table and write policies so users can only read their own rows. Ask your tool to explain the policies it wrote.
  • Never trust the browser: checks like "only admins can delete" must happen on the server or in database rules, not only by hiding a button.
  • Only collect what you need. Less data, less to leak.

3. Cap your costs

  • Set spending limits or alerts on every service that bills by use: AI APIs, hosting, databases.
  • Watch for loops: an app that calls a paid API on every page load, or an agent left running, can burn through credits overnight.
  • See Keep costs under control.

4. Keep a way back

Save working versions (Git or the tool's history) before big changes. An AI can rewrite fifty files in a minute; you want to be able to undo that.

5. Check before you trust

AI tools sometimes invent packages that don't exist, or suggest old ones with known problems. Before installing something new, check it exists, is popular and is still maintained.

You do not need to be a security expert. You need these habits, and the willingness to ask "is this safe?" before you share a link.

More in Start here