Skip to content
Interactive demoDataAdvanced

Lead capture with attachments

A public form that takes photos from a stranger safely: guest uploads bound to a cookie, stored before any email is sent.

Built withServer ActionsR2 presigned uploadsZodResend

Before you try it

What it needs

RESEND_API_KEYWithout them: The inquiry is stored and the notification prints to the console.

Mode right now

FallbackThis deployment runs the plain path, so what you try here costs nothing and reaches no provider.

A safe failure to try

Submit with the message empty: the form refuses field by field, and nothing is saved or sent.

A public form that accepts photos from someone with no account. The interesting part is not the fields — it is that a stranger’s upload is bound to an httpOnly cookie, can be completed and claimed only by their own submission, and is deleted if no submission ever claims it. Submissions land in the admin inbox before any email is sent. The same form is mounted at /quote for a fork that wants it as a real page.

0 / 4000 characters — at least 20 needed.

Photos can be attached once file storage is configured for this site. Describe the work for now, and photos can follow by email.

What this demonstrates

  • A guest's upload is bound to an httpOnly cookie, so only their own submission can claim it
  • Store the request first, mail second: a provider outage delays a notification, it never loses a lead
  • An unclaimed attachment is swept with its bytes after a day, so storage cost from strangers is bounded
  • The same form is mounted at /quote for a fork that wants it as a real page

Where the code lives

src/experiments/lead-capture/demo.tsx

Registered in src/experiments/registry.ts and loaded on demand by loader.tsx.