Home / Playbooks

Playbook

Connect a website form to Supabase safely

For: Marketers and founders with a simple HTML site who want to collect leads without a backendTime: 20 to 30 minutesTools: Supabase, Your HTML page, Optional: Resend or Zapier for email alerts
In short

Create a free Supabase project, add a leads table, turn on Row Level Security and add one policy that lets the public anon role insert rows and nothing else. Paste the project URL and anon key into your page, test the form, and read submissions in the table editor. The anon key is meant to be public; the service_role key never goes in a page.

The steps

  1. Create the project

    Sign up for Supabase and create a free project with a name, a database password and a region close to your visitors. It takes about two minutes to be ready.

  2. Create the leads table

    In the SQL Editor create a table called leads with id, created_at, name, email, message, intent (subscribe, reach out or both), source and user_agent. Keep the fields to what you will actually use.

  3. Turn on Row Level Security

    Enable Row Level Security on the table. With RLS on, everything is denied unless a policy allows it.

  4. Add one insert only policy

    Add a single policy that lets the anon role insert rows. Do not add select, update or delete for anon. Visitors can now submit the form but cannot read, edit or delete anyone's data.

  5. Copy the right keys

    From Project Settings, API, copy the Project URL and the anon public key. Never use the service_role key in a web page: it bypasses every policy.

  6. Paste them into the page

    Put both values in the script block of your HTML file where the form sends its data. Until you do, a good setup falls back to opening the visitor's email app, so no lead is lost.

  7. Test it

    Submit the form yourself, check that the thank you message appears, then open Table Editor, leads, and confirm the row is there.

  8. Get notified and reduce spam

    For an email on every signup, add a database webhook that calls Resend, a Zapier webhook or an Edge Function. If spam appears, add a hidden honeypot field, Cloudflare Turnstile or hCaptcha, or a rate limit.

Common mistakes

  • Leaving Row Level Security off
  • Giving the anon role select access so the form can confirm duplicates
  • Pasting the service_role key into the page
  • Never testing the form after publishing

Where this comes from

This is the setup guide I gave attendees of my Claude 101 masterclass with GrowthX in June 2026, written for people who had never used a database. See more.

Ask me directly

Working on this right now?

Tell me what you are trying to grow or what your event needs. I read every message myself and reply within 48 hours.

Or see how I work with teams: consulting, advising and talks and workshops.

Please add your name
Please enter a valid email
Add a short note so I can reply with context
Message received

Thank you, it is in my inbox.