splitforms.com

Contact form · Vite

Contact form for Vite apps

Vite's fast HMR and zero-config bundling pair well with splitforms. Whether you're building vanilla, React, Vue, Svelte, or Solid on top of Vite, the same fetch-based pattern works — read your access key from import.meta.env, POST to splitforms.

  • 500 free / month
  • One endpoint
  • No backend code
Vite contact form — copy-paste code for splitforms

Key benefits

No backend code

No server, API route, or SDK. Your Vite form posts straight to one endpoint.

Straight to your inbox

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it reaches you.

Design without limits

It's your own Vite markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.

Copy-paste ready

Your Vite contact form, ready to paste.

Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the javascript you already write.

contact.html
// .env
// VITE_SPLITFORMS_KEY=YOUR_ACCESS_KEY

// src/contact.js
const form = document.querySelector("#contact");
const status = document.querySelector("#status");

form.addEventListener("submit", async (e) => {
  e.preventDefault();
  status.textContent = "Sending…";

  const formData = new FormData(form);
  formData.append("access_key", import.meta.env.VITE_SPLITFORMS_KEY);

  try {
    const res = await fetch("https://splitforms.com/api/submit", {
      method: "POST",
      body: formData,
    });
    const data = await res.json();
    status.textContent = data.success ? "Thanks!" : "Error — try again.";
    if (data.success) form.reset();
  } catch {
    status.textContent = "Network error.";
  }
});

// index.html
// <form id="contact">
//   <input name="name" required />
//   <input name="email" type="email" required />
//   <textarea name="message" required></textarea>
//   <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" />
//   <button type="submit">Send</button>
// </form>
// <p id="status"></p>

How to add it

How to add a contact form to a Vite website.

To add a contact form to a Vite website you need three things: a free splitforms access key, the javascript snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.

  1. Get your free splitforms access key

    Sign up at splitforms.com, verify your email, and copy your access key from the dashboard. No credit card required.

  2. Drop the Vite snippet into your project

    Copy the Vite code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.

  3. Receive submissions in your dashboard

    Submissions arrive in the splitforms dashboard within seconds. Free includes owner email notification attempts; Pro adds Slack, Discord, Sheets, or any signed webhook URL.

Where submissions go

Where do your Vite form submissions go?

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.

  • 500 submissions a month, free to start
  • Honeypot + automatic spam scoring on every plan
  • Signed webhooks to Slack, Discord, your server
Vite contact form submissions in the splitforms dashboard

No backend needed

Do you need a backend for a Vite form? No.

Your Vite form posts standard FormData to one URL. Splitforms validates the access key, runs its spam checks, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.

  • Works with every Vite framework (React, Vue, Svelte, Solid, vanilla)
  • Access key read from import.meta.env — never hardcoded
  • No server route — Vite's static output deploys anywhere
How splitforms processes a Vite form submission

Best practices

What a production-ready Vite form needs.

The difference between a form that works in the demo and one that survives launch traffic — the production-tested defaults, in priority order.

  • Lock the access key to your domains. The dashboard accepts a list — anyone copying the key from your bundle can't replay it from another origin.
  • Add the hidden honeypot input. Bots fill every field; humans don't see it. Splitforms rejects any submission that has it set.
  • Show submit state visually. Disable the button and label it 'Sending…' while the request is in flight — users hammer submit on slow networks otherwise.
Production-ready Vite contact form best practices

Questions

Vite contact form questions.

Anything missing? Email us, we read every message.

A person reading answers to common questions
Is splitforms really free?

Yes. You get 500 free submissions every month with no credit card, plus unlimited forms, spam filtering, the dashboard, and owner email delivery. The 500 resets every month. Pro is $5/mo for 5,000 submissions a month and adds signed webhooks, exports, integrations, and retained uploads when Storage is connected.

Do I need to install anything?

No. Splitforms is API-only. There's no SDK, no plugin, no PHP. Your form posts standard FormData to one URL.

How do you handle spam?

A hidden honeypot field catches the obvious bots. A rule-based filter scores everything else (links, spam phrases, disposable emails, gibberish) and quarantines what looks like spam to a separate Spam tab, so your inbox stays clean and nothing is lost.

Can I keep my access key out of the bundle?

Yes — use a server-side environment variable and post from a server route or server action. Or expose it client-side and rely on per-domain locking. Either path is supported.

View all FAQs

Ship your Vite contact form in 60 seconds.

Free to start on 500 submissions a month. Need Slack alerts, signed webhooks, or file uploads? Pro unlocks them for $5/mo — so you only pay once you outgrow free.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form