When you build with Supabase, the front end talks to your database through a public key. That key ships inside your JavaScript, so anyone can read it. The thing protecting your data is Row Level Security (RLS). With RLS on, a table returns nothing until you write a policy that says who may do what. 1. Turn it on 2. Write a policy This policy lets a signed in user read only their own rows. auth.uid() is the id of the person making the request. user id is a column on the table that stores who owns the row. 3. Allow inserts, but only as yourself using filters the rows you can see or change. with check validates the rows you are trying to write. 4. Use it from React No where clause is needed. The database applies the policy for you. Mistakes to avoid Mistake What happens RLS left off Anyone with the public key can read the whole table RLS on, no policy Nobody can read anything, which looks like a bug Using the service key in the browser It bypasses RLS completely, keep it on the server Test your policies by signing in as two different users and checking that neither sees the other's data.
Supabase Row Level Security in plain English
Anyone can call your Supabase API with the public key. Row Level Security decides which rows each user is allowed to see.