A lead capture form built with Next.js and Supabase. Submitted leads are stored in a Supabase database and viewable at /leads.
Before you start, make sure you have the following installed:
- Node.js (version 18 or above)
- npm (comes with Node.js)
git clone <your-repo-url>
cd demo_webnpm installCreate a file called .env.local in the root of the project and add the following:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_publishable_key
SUPABASE_SECRET_KEY=your_supabase_secret_key
Where to find these values:
- Go to your Supabase dashboard
- Open your project → Connect → you will find the URL and keys there
NEXT_PUBLIC_SUPABASE_URL— your project URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY— the publishable (public) keySUPABASE_SECRET_KEY— the secret key (under Secret keys)
Note: Never commit
.env.localto Git. It is already excluded in.gitignore.
npm run devOpen http://localhost:3000 in your browser.
/— the lead capture form/leads— view all submitted leads
- User fills in the form and clicks Submit
- The form sends a POST request to
/api/leads - The server validates the data and inserts it into Supabase
- After saving, the server sends the lead data to a webhook endpoint
- The user sees a success message