Self-hosting
Run Motivation Form on your own Vercel and Supabase project.
This guide covers deploying Motivation Form to your own infrastructure. You will need a Vercel account and a Supabase project.
Prerequisites
- Vercel account
- Supabase account
- Node.js 18+
- Git
1. Fork the repository
Fork Motivation-Labs/motivation-form on GitHub, then clone your fork:
git clone https://github.com/YOUR_ORG/motivation-form.git
cd motivation-form
npm install2. Create a Supabase project
- Go to supabase.com and create a new project
- Note your project URL and API keys (found in Project Settings → API)
- Apply the database schema:
# Install Supabase CLI
npm install -g supabase
# Link to your project
supabase link --project-ref YOUR_PROJECT_REF
# Push migrations
supabase db pushThe migrations in supabase/migrations/ create the forms, submissions, form_views, and api_keys tables with RLS policies.
3. Configure environment variables
Copy .env.example to .env.local and fill in your values:
cp .env.example .env.local# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
# Resend — get a key at resend.com
RESEND_API_KEY=re_...
RESEND_FROM=forms@yourdomain.com
# Cloudflare Turnstile — get keys at dash.cloudflare.com
NEXT_PUBLIC_TURNSTILE_SITE_KEY=0x...
TURNSTILE_SECRET_KEY=0x...
# App URL — your Vercel deployment URL
NEXT_PUBLIC_APP_URL=https://forms.yourdomain.com4. Test locally
npm run devOpen http://localhost:3001. The public form page is at /[slug], the dashboard at /dashboard/[slug].
5. Deploy to Vercel
npm install -g vercel
vercelOr connect your GitHub fork to a Vercel project via the Vercel dashboard. Add all environment variables from .env.local to your Vercel project settings.
6. Configure a custom domain
In Vercel project settings → Domains, add your domain (e.g. forms.yourdomain.com). Update NEXT_PUBLIC_APP_URL in your Vercel environment variables to match.
7. Configure email sender domain
In Resend, add and verify your sender domain. Update RESEND_FROM to use an address on that domain.
8. Set up Cloudflare Turnstile
- Go to Cloudflare Dashboard → Turnstile
- Create a new site widget with your deployment domain
- Copy the site key and secret key into your environment variables
Updating
Pull the latest changes from the upstream repo and push:
git remote add upstream https://github.com/Motivation-Labs/motivation-form.git
git fetch upstream
git merge upstream/main
git pushVercel deploys automatically on push.
Notes
- The
SUPABASE_SERVICE_ROLE_KEYis never exposed to the client — it is used only in server-side API routes - Turnstile verification runs server-side before any submission is written to the database
- RLS policies enforce row-level access control at the database level