Questions? hello@viberation.devGet supportBlogDocsChangelog
Get started
← All walkthroughs

Walkthrough · Project build

beginner

Add a database with Supabase

Step 3 of 5 · linear, one-off

0 of 12 done

  1. Plan
  2. Project
  3. 3Table
  4. 4Connect
  5. 5Go live

Table

Make the table and lock it down, in one paste.

You could click a table together in the Table Editor, but pasting one script is faster and gets the security right first time. 1. In your project, open SQL Editor from the left sidebar. 2. Click New query (or the + button), paste the script below, and click Run.

sql

create table public.notes (
  id bigint generated always as identity primary key,
  message text not null check (char_length(message) between 1 and 280),
  created_at timestamptz not null default now()
);

-- Let the website read and add notes. Nothing else.
grant select, insert on public.notes to anon;

-- Row Level Security: block everything, then allow only what the policies say.
alter table public.notes enable row level security;

create policy "Anyone can read notes"
  on public.notes for select to anon
  using (true);

create policy "Anyone can add a note"
  on public.notes for insert to anon
  with check (true);

What you should see

Success. No rows returned. That is good news: the script creates things rather than reading rows, so there is nothing to show.

3. Check it worked. Open Table Editor from the sidebar and click notes. Click Insert, then Insert row, type a message such as hello from the dashboard, and save. You now have one row.

Pick a prompt and ask your AI tool

I followed a Supabase guide that created this table and its security rules: [paste the SQL script from this step] Rewrite it for my app instead. My idea: [your one-sentence idea]. Keep the same pattern: explicit grants to anon only for what visitors truly need, row level security enabled, and one policy per action. Explain each policy in one plain sentence.

Open it in your AI tool. Clicking copies the prompt, and ChatGPT and Grok open with it already filled in.

More tools

Code editors on your computer. Open app only works once it is installed, so use Get it first if you do not have it.

Want the full list? Browse all app builders and coding editors (IDEs).

  • Ran the script and saw Success
  • Added a test row in the Table Editor
  • Sign in to tick these off and pick up where you left them.

Tools used in this build

Everything this walkthrough reaches for, with the directory entry for each.

  • CLIs

    Claude Code

    Anthropic's agentic coding tool in your terminal.

    Paid
  • Frameworks

    Next.js

    The React framework most AI tools generate best.

    Open source
  • Skills

    Postgres Best Practices

    Supabase's rules for schemas, migrations and queries.

    Open source
  • Tools

    Supabase

    Postgres, auth, storage and row-level security in one box.

    Freemium
  • MCP Servers

    Supabase MCP Server

    Let your agent query and migrate your Supabase project.

    Free
  • Hosting

    Vercel

    Deploy Next.js with a preview URL per pull request.

    Freemium