Supabase and databases
Tables, rows, SQL, sign-in and row level security: the back end most vibe-coded apps run on.
Databases in one picture
A database is like a set of very strict spreadsheets. Each table holds one kind of thing (users, posts, orders). Each row is one item; each column is one detail (name, email, created date). Every row has a unique id, and tables point at each other with those ids (a post has an author_id that matches a user).
SQL (Structured Query Language) is the language for asking a database questions and changing it: 'select all orders from this week'. Postgres (PostgreSQL) is one of the most trusted open-source databases, and it speaks SQL.
What Supabase is
Supabase is a back-end platform built on Postgres. One project gives you a hosted database plus the pieces most apps need around it, so you don't build them yourself:
- Database: full Postgres, with a table editor in the dashboard.
- Auth: sign-up, sign-in, magic links, social logins and user management.
- Instant APIs: your tables become an API the app can call.
- Storage: files like profile photos and PDFs.
- Edge Functions: small pieces of server code for jobs that need secrets, like calling a payment or AI API.
- Realtime: live updates, for chat or dashboards.
Row level security (RLS): the most important switch
Your app's public key (often called the anon or publishable key) ships inside the front end, so anyone can find it. That's fine only if the database itself decides who can see each row. That's row level security: rules (policies) such as 'a user can read and edit only their own notes'.
Security researchers auditing vibe-coded apps have repeatedly found tables with RLS switched off, meaning anyone with the public key could read every row. The fix is simple: turn RLS on for every table, deny by default, then add the smallest policies the app needs. The service role (secret) key bypasses RLS and must only ever live on the server.
Migrations: changing the database safely
A migration is a saved, ordered script that changes the database structure (add a table, add a column). Keeping migrations in Git means every environment can be built the same way and changes can be reviewed like code. Test changes on a development or branch database before production, and back up first.
Key terms
- Database
- Organised storage for everything an app must remember.
- Table
- One kind of thing in a database, like users or orders.
- Row
- One item in a table, like one user.
- Column
- One detail stored for every row, like email.
- SQL
- The language for asking a database questions and changing it.
- Postgres (PostgreSQL)
- A trusted open-source SQL database. Supabase is built on it.
- Supabase
- A back-end platform on Postgres with auth, instant APIs, storage, edge functions and realtime.
- Row level security (RLS)
- Database rules that decide which rows each user may read or change.
- Policy (RLS)
- One row level security rule, like 'users can read their own notes'.
- Anon / publishable key
- Supabase's public key that ships in the front end; safe only with RLS on.
- Service role key
- Supabase's secret key that bypasses RLS. Server only, never in the browser.
- Migration
- A saved, ordered script that changes the database structure.
- Edge function
- A small piece of server code that runs close to users, often to use secrets safely.
- Storage bucket
- A folder in file storage for images, PDFs and uploads, with its own access rules.
Try it
Lock a table the right way
- Create a free Supabase project and a table called notes with columns id, user_id, body.
- Turn on row level security for the table and confirm nobody can read it.
- Add a policy: users can select rows where user_id equals their own id (Supabase's policy templates help).
- Ask an AI to explain each line of the policy until you could explain it to a friend.
Ask an AI tutor about this guide
Copy a prompt into ChatGPT, Claude or Gemini to go deeper. Check what it tells you against the guide.
- Explain it like I'm 12
- Quiz me (5 questions, one at a time)
- Show me a real example for my situation
- What do beginners get wrong?
Knowledge check
Five questions. Get 4 right to earn the Data Keeper badge. You can retake it as often as you like.
Question 1 of 5
Finished the How software works guides? Take the How software works track test for ten mixed questions.
My notes
Write what clicked, what confused you, and what you want to try. Saved in this browser only.
Learn it live
Digital Builders University runs small live workshops where you build something real with an instructor beside you, starting with Vibe Coding 101.
See workshopsPractise it
- Build Challenge: Club sign-up list with admin view (Builder, 2 to 3 hours)
- Build Challenge: Booking request form for a local business (Builder, 3 hours)
- Build Challenge: Habit tracker with streaks (Builder, 3 hours)
- Game: Error Detective (read real error messages and pick the fix)
Official sites
- Supabase (opens in a new tab)
- Supabase docs: Row Level Security (opens in a new tab)
- PostgreSQL (opens in a new tab)
Last reviewed November 25, 2026. AI tools change fast; check each tool’s own site for current features, plans and prices.
