📚Academy
likeone
online
MODULE 1 · 260 XP

Supabase 101

Supabase gives you a Postgres database, auth, edge functions, and real-time subscriptions — all in one platform. It's the foundation of your stack.

Step 1: Understanding Tables

Every Supabase project is a Postgres database. Data lives in tables. Let's build one interactively.

Interactive Table Builder

brain_context

This table stores your AI agent's memory — key-value pairs with metadata.

Column NameTypeKey
PK

Step 2: SQL Sandbox

Supabase lets you run raw SQL. Practice querying your brain_context table.

This is a simulation — it runs against sample data in your browser, not a real database. In production, you'd run these same queries in the Supabase SQL Editor against your actual tables.

SQL Sandbox

Step 3: Build It Step by Step

1

Create the project

Go to supabase.com, create a new project. Pick a region close to your users. Save your project URL and anon key.

Project URL: https://<your-ref>.supabase.co
Anon Key: eyJhbGciOiJIUzI1NiIs... // public, safe for frontend
Service Key: eyJhbGciOiJIUzI1NiIs... // SECRET, only for backend
2

Create the brain_context table

Use the SQL editor in your Supabase dashboard. Paste the generated SQL from Step 1 above.

3

Enable Row Level Security (RLS)

RLS (Row Level Security) is a Postgres feature that controls who can read or write each row. Without it, anyone with your API key could access all data. Think of it like a bouncer for every row in your table.

This SQL turns on RLS and then creates a policy that says "only the service role (your backend) gets full access." Frontend users with the public anon key will be blocked unless you add more policies.

ALTER TABLE brain_context ENABLE ROW LEVEL SECURITY;

-- Allow service role full access
CREATE POLICY "service_role_all" ON brain_context
FOR ALL
TO service_role
USING (true);
4

Insert your first record

This SQL adds a single row to your brain_context table — a key called "identity.name" with the value "AI Stack Builder Student". It's like writing a sticky note your AI agent can read later.

INSERT INTO brain_context (key, value)
VALUES ('identity.name', '"AI Stack Builder Student"');
Key Concept

Why Supabase for AI Apps?

Supabase is Postgres with superpowers: Auth (user management), Edge Functions (serverless code that runs close to your users), Realtime (live subscriptions — your UI updates instantly when data changes), Storage (files/images), and pgvector (a Postgres extension that lets you store AI embeddings — numerical representations of text — so you can do similarity search, like "find memories related to this topic"). One tool covers database + backend + auth. That's why it's the foundation of most modern AI stacks.

Lesson Progress0%

Match Supabase Concepts

Tap one on the left, then its match on the right

Supabase Project Setup Order

Arrange these steps in the correct order to set up a new Supabase project

1Insert seed data and test queries
2Create access policies for each role
3Create tables using the SQL Editor
4Create project at supabase.com and save URL + keys
5Enable RLS on all tables
Supabase 101 — Console
Write a prompt

Write a prompt to generate a Supabase SQL migration for a 'projects' table with proper constraints, foreign keys, and row-level security.

Type a prompt below to get started.

Try:

Academy
Built with soul — likeone.ai