RLS for the owner

About 45 minutesYou need: adjoas-kitchen open in Cursor with npm run dev running, the Supabase MCP connected, the Supabase dashboard, and your owner User UID (in your password manager note from Lesson 9.2)
This video is in the full courseGet the course to watch every video and read every lesson in full. GHS 399, paid once.Get the course · GHS 399
Video · 17:51
Goal

Add database rules so only the signed-in owner can read and update orders, and prove it: as a stranger you see nothing and change nothing, and as Adjoa you see every order.

Why this matters

Your /admin page is locked. But the orders don't live in your Next.js app. They live in Supabase, and Supabase can be reached directly by anyone who has your project's public URL and publishable key. Every visitor's browser has both, because the menu and order form need them.

So the real question is: what does the database itself allow? In Module 7 you set the rules: the public may add orders but not read them. That's why /admin would show an empty list if you tried to load orders right now: nobody, not even Adjoa, has permission to read them yet.

In this lesson you give that permission to exactly one person, the signed-in owner, and to nobody else. Then you prove it from both sides. This is the lock that still holds if every other lock fails. It's also the lock that beginners most often get wrong, so you'll read every line before it runs.

In the full lesson

  1. The idea in plain English
  2. Do it
  3. Check it worked
  4. Understand what AI wrote
  5. Quick check
  6. What you can do now
Stage 2 · Make it workYou’ve seen the why. The how is in the course.

The step-by-step, the prompt to copy, the video and the check-it-worked list, for every lesson in all 15 modules. GHS 399 ($40), paid once by mobile money or card, yours to keep.

Get the course · GHS 399See what’s inside
Already have the course? Open the full lesson