Written by: Geoffrey Callaghan

How To Create A Contact Form With Vercel

How To Create A Contact Form With Vercel

Creating a contact form on Vercel involves a few key steps. Here’s a simplified guide using HTML, JavaScript, and a third-party service like FabForm.io for handling form submissions:

1. Create a FabForm.io Account:

  • Sign up for a FabForm.io account (if you haven’t already) and create a new form. FabForm.io will provide you with a form endpoint URL.

2. Create a New Vercel Project:

  • If you don’t have a Vercel account, sign up for one.
  • Create a new Vercel project using your preferred framework or static site generator. If you don’t have an existing project, you can create a simple HTML project.

3. Add HTML Form:

  • In your project, create an HTML file with a form. For example:
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Contact Form</title>

  <form id="contactForm" action={process.env.FABFORM_ENDPOINT} method="POST">
    <label for="name">Name:</label>
    <input type="text" id="name" name="name" required>

    <label for="email">Email:</label>
    <input type="email" id="email" name="email" required>

    <label for="message">Message:</label>
    <textarea id="message" name="message" required></textarea>

    <button type="submit">Submit</button>


4. Deploy to Vercel:

  • Deploy your project to Vercel. Follow the instructions provided by Vercel for your specific project setup.

5. Add Environment Variable:

  • In your Vercel dashboard, go to “Settings” -> “Environment Variables.”
  • Add a variable named FABFORM_ENDPOINT and set its value to the form endpoint URL provided by FabForm.io.

6. Handle Form Submission (Optional):

  • You can add JavaScript to handle form submissions and provide user feedback. For example:
<!-- Add this script at the end of the body or in a separate JavaScript file -->
  const contactForm = document.getElementById('contactForm');

  contactForm.addEventListener('submit', async (e) => {

    const formData = new FormData(contactForm);
    const response = await fetch(process.env.FABFORM_ENDPOINT, {
      method: 'POST',
      body: formData,

    if (response.ok) {
      alert('Form submitted successfully!');
    } else {
      alert('Error submitting the form. Please try again later.');

7. Redeploy:

  • After adding the environment variable and any additional code, redeploy your project to Vercel.

Now, your contact form should be live on your Vercel site, and submissions will be sent to FabForm.io for processing. Users will receive a confirmation, and you can manage submissions through the FabForm.io dashboard.