Server-side lead capture
The /api/leads route validates submissions server-side. Integrations are optional — unset env vars disable each layer without breaking the site.
Request flow
Browser form → POST /api/leads → Zod validation → Notion (optional) → Resend (optional) → Supabase event (optional)
Honeypot and rate limiting run before any external call.
Notion CRM
When NOTION_API_KEY and NOTION_DATABASE_ID are set:
- Optional dedup against a clients database (
NOTION_CLIENTS_DATABASE_ID) - New row in the leads database with mapped properties
- Graceful fallback if Notion write fails (Resend-only path)
Resend notifications
RESEND_API_KEY=re_xxx
RESEND_FROM=Stack Demo <[email protected]v>
LEAD_NOTIFICATION_EMAIL=[email protected]
Transactional email notifies your team on each qualified lead.
Supabase analytics
Enable funnel tracking with SUPABASE_TRACKING_ENABLED and the SQL scripts in scripts/. Hashed visitor IDs — no raw PII in analytics tables.
Admin dashboard at /admin/metrics when ADMIN_METRICS_ENABLED=true.
Live demo sandbox
The homepage #live-demo section runs an isolated pipeline against demo Supabase and Notion projects — separate from production credentials. See docs/integrations.md for env setup.
Related: Production deploy guide