← All notes
Notes · Security

Your Lovable app probably has your API keys in the browser

How to check in five minutes whether your app is handing its secrets to anyone who opens developer tools — and what to do if it is.

By the Load Bearing crew 5 min read

If you built your app with an AI tool and you've never thought about where your "secret keys" live, this is worth five minutes. There's a good chance a couple of them are sitting in your app's front end, where anyone can read them — and the tool that built your app won't warn you.

This isn't a knock on Lovable, Base44, Replit, or Bolt. They're genuinely great at getting you from idea to working app fast. But "fast" and "safe to put in front of the public" are two different finish lines, and the gap between them is where this problem lives.

Here's the whole thing in plain language: why it happens, how to check your own app in about five minutes, and what to do if you find one.

What a "key" is, and why it leaks

An API key is a password your app uses to talk to another service — your database, your payment processor, an email sender, an AI model. Whoever holds the key can do whatever that service allows: read your data, send email as you, run up a bill on your account.

Every app has these keys. The question is where they're kept. There are two places code can run:

  • The front end — everything that happens in the visitor's browser. Anyone can look at it. This isn't a metaphor: the browser literally ships all of it to the user's machine.
  • The back end — code that runs on a server the visitor never sees. This is where secrets are supposed to live.

When you describe a feature to an AI builder — "let it email new users," "connect it to OpenAI" — the fastest way for the tool to make that work is often to wire the key straight into the front end. It runs. The demo looks perfect. And the key is now printed inside a page anyone can open.

If you can open your app, press F12, and read your own API key — so can everyone else.

The reason this slips through is that nothing breaks. An exposed key works exactly as well as a hidden one, right up until someone finds it. There's no error, no warning, no red screen — which is precisely why it's worth checking on purpose.

How to check your own app in five minutes

You don't need to be technical to do this. You're just going to watch what your app sends and look for anything that reads like a password. Open your live app in Chrome and follow along.

  1. Open Developer Tools. Right-click anywhere on your app and choose Inspect, or press F12 (on a Mac, Cmd+Option+I). A panel opens. Don't worry about most of it.
  2. Click the "Network" tab at the top of that panel. This shows every request your app makes behind the scenes.
  3. Use your app like normal — log in, load a page, trigger the feature you connected to an outside service. The Network list fills up with rows.
  4. In the little filter box, type key, then try token, then secret. Click a few of the rows that show up and skim the details for a long random-looking string.
  5. Also try the "Sources" tab. Press Cmd/Ctrl+F to search all your app's code at once, and search the same words: apiKey, secret, token.

If you find a long string like sk-a83f2... or AIza... sitting in plain view, that's a live key your app is handing to every visitor. Some values you'll see are safe to be public (things labeled "publishable," "public," or "anon" are usually meant to be seen). The dangerous ones are the opposite — anything marked secret, private, or service.

What we'd look for

Two that AI builders leak most often: a database "service" key (the master key that ignores all your access rules — far more dangerous than the public one), and an AI or email provider key that someone can use to run up thousands of dollars on your account overnight.

The tricky part isn't spotting an obvious key. It's knowing which of the harmless-looking values are actually fine and which quietly aren't — that's the judgment call, and it's the part worth a second set of eyes.

BROWSER SERVER request secret key sits here — visible to anyone safe: key belongs here
Fig. 1 — the key belongs on the server, not in the browser
What we'd look for

Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. This aside is where the crew would add the "here's what a professional checks that you might miss" note.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.

If you find one, don't panic — do this

An exposed key is a common, fixable problem, not a disaster. But treat it as live, because it is. In order:

  1. Rotate the key. Go to the service it belongs to (your database, OpenAI, your email provider) and regenerate it. This instantly turns off the exposed one — anyone who copied it now holds a dead password. Do this first, before anything else.
  2. Move the key to the back end. The real fix is that your app should never send the secret to the browser at all. The request goes to a small piece of server code, and that talks to the outside service. The key stays on the server.
  3. Check for a bill. Look at recent usage on that account. If a leaked AI or email key was used, you want to catch it early.

Step one you can do yourself in ten minutes, and you should, today, if you found something. Step two is where "vibe-coded" and "production" part ways — it's a real change to how the app is built, and it's the kind of thing our whole practice exists to handle.

The check above will catch the obvious cases. What it won't tell you is whether the non-obvious values are safe, whether your database rules actually hold, or what else is exposed that doesn't have the word "key" in it. That's the difference between a five-minute self-check and a real review — and it's exactly what we do.

Not sure if your app has this problem?

Send it over. The first look is free — we'll tell you what's exposed and what it'll take to close it.

Meet the team