Supabase: The Complete Guide
Setup, the Mental Model & Your First Secure App
Where the backend went, the request journey, the local stack, publishable vs secret keys, Postgres roles, and a vertical slice where you watch RLS deny a stranger.
SQL I: Asking Questions of Data
SELECT, WHERE, NULL and three-valued logic, ordering and keyset pagination, aggregates, GROUP BY, run against a real Postgres in your browser.
SQL II: Tables, Types & Constraints
CREATE TABLE, the data-type traps, keys, constraints, writes, upserts, and why a table you create in SQL is wide open until you close it.
SQL III: Relationships & Joins
Foreign keys and ON DELETE, one-to-many, many-to-many, INNER vs LEFT, anti-joins, the accidental Cartesian product, subqueries.
Composing Queries: CTEs & Window Functions
Name a step with a CTE, aggregate without collapsing rows, and answer the top-N-per-group question interviewers love.
Correct & Fast
Transactions, MVCC and bloat, the lost update, B-trees, indexing in practice, GIN and JSONB, reading a plan, security_invoker views.
Functions & Triggers in the Database
PL/pgSQL, SECURITY INVOKER vs DEFINER, search_path pinning, triggers and firing order, and an audit log that maintains itself.
Schema as Code
Forward-only migrations, declarative schemas and drift, seeding, safe migrations that don't lock production, branching, CI, and a typed client.
Auth: Who Is Asking?
Profiles and the new-user trigger, every login flavor, the JWT, server sessions (getClaims, never getSession), signing keys, MFA and RBAC.
RLS: The Core
The heart. Deny by default, USING vs WITH CHECK, the failure-mode matrix (what throws and what silently returns nothing), and GRANT vs RLS.
RLS at Scale
Cross-table policies and infinite recursion, multi-tenant isolation, policy performance, pgTAP negative tests, and the launch security sweep.
The Data API & Your Next.js App
PostgREST and exposure, queries and embeds, the N+1 trap, error codes, RPC, then wire it into Next.js with Server Components, Server Actions and proxy.ts.
Services
Realtime (and why broadcast-from-the-database beats postgres_changes), storage with RLS on files, Edge Functions, scheduled jobs, and search.