Supabase Security for Beginners: The One Setting That Protects Your Users' Data
Your AI-built app uses Supabase. Here's what Row Level Security is, why it matters, and how to check it, explained for people who've never coded.
By the Prototilt team
If you built your app with Lovable, Bolt or another AI tool, there's a good chance your data lives in Supabase. You may never have opened it. That's fine, until real people start signing up.
There's one setting in Supabase that decides whether your users' data is private or not. It's called Row Level Security, usually shortened to RLS. This post explains it without any code.
It's also one of the most common launch blockers in apps built with AI, for a simple reason: your app works perfectly even when the rules are wrong. Everything looks fine, because you're the only one using it. It's the clearest example of the gap between "it works" and "it's ready".
Your database is reachable from the internet, by design
Here's the part that surprises most first-time builders. With Supabase, the app running in your visitor's browser talks to the database directly. To do that, it uses a key that's included in your app's code. That key is called the anon key or public key, and it's meant to be public. Anyone can find it.
That sounds alarming, but it's how Supabase is designed to work. The key isn't what protects your data. The rules are.
RLS is the set of rules
Think of your database as a filing cabinet in a public hallway. Anyone can walk up to it. Row Level Security is the lock on each drawer, plus a list of who can open which drawer.
For each table (users, orders, messages, whatever your app stores), you can turn RLS on and write policies like:
- "A person can read their own orders, and nobody else's."
- "A person can only edit a profile if it's theirs."
- "Anyone can read published posts, but only the author can change them."
With RLS on and good policies, the public key is harmless. With RLS off, anyone holding that public key can read, and sometimes change, everything in that table.
How to check yours
The quickest way: ask your coding tool. You don't have to read or write rules yourself. Paste this into Lovable, Bolt or whatever you used:
"List every Supabase table in this app. For each one, tell me whether Row Level Security is on and, in plain English, who can read, add, change and delete rows. Then fix any table where a user could see or change another user's data."
Then look for yourself, in the Supabase dashboard:
- Open your project and go to the table editor, or the authentication policies page.
- For each table, check that RLS is enabled. Supabase flags tables that don't have it.
- For each table with RLS on, read the policies. Each one should say who can do what in a sentence you can follow.
- Run Supabase's built-in security advisor, which lists common problems, and read what it says.
The three mistakes we see most
RLS turned off. Often on a table that was added later, after the first version worked. Every table needs it, not just the first one.
RLS on, but with a policy that lets everyone in. A rule like "anyone can read anything" makes the lock decorative. It's common, because it makes errors disappear while you build.
The service role key in the browser. Supabase gives you a second, secret key, often called the service role key, that skips RLS entirely. It must only ever be used on a server. If it's in your front-end code, treat it as exposed and follow the steps in what to do if your API key is exposed.
Test it like a stranger would
Settings are only half the story. The real test is behaviour. Make two accounts and check that neither can see the other's data, including by changing IDs in the address bar. We walk through that in can users see each other's data?
The one thing to remember
The public key isn't the security. The rules are. RLS is what stands between "my app works" and "everyone can see everyone else's data."
Database rules are one item on a longer list. See the rest in the security checklist for vibe-coded apps.
Get your full launch plan. Prototilt asks you a few questions about the app you built and shows you the whole map from "it works" to "launched": every step, in order, marked launch blocker, should do or nice to have, with the prompts to use in your coding tool.
See your plan's steps for free →By the Prototilt team. Written with AI tools and reviewed by Aline Sadate, Prototilt's founder.