Add a contact form to a site hosted on Vercel without writing a serverless function.
Vercel can run serverless functions, but you do not need one for a contact form. Point the form at Formcask and deploy the site as static files, or as a framework project that still posts from the browser.
<form action="https://formcask.com/f/f_YOUR_FORM_ID" method="POST">
<label>Name <input type="text" name="name" required></label>
<label>Email <input type="email" name="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<input type="hidden" name="_redirect" value="https://yoursite.com/thanks">
<button type="submit">Send</button>
</form>
This works with plain HTML, Hugo, Eleventy, Astro (output: 'static'), and a Next.js page that renders a standard form. You do not need a Route Handler or api/ route for the basic case. For a same-page success state, use the JSON fetch snippet:
const res = await fetch("https://formcask.com/f/f_YOUR_FORM_ID", {
method: "POST",
headers: { "content-type": "application/json", accept: "application/json" },
body: JSON.stringify({ name, email, message }),
});
const data = await res.json(); // { ok: true } on success
If you later move off Vercel, the same form keeps working. See also the Netlify Forms alternative if you are comparing hosts.
Related: Netlify · Astro · Plain HTML