ViteVite contact form without a backend
Add a Vite contact form with @formsreach/js. Import submitForm in a vanilla JS or TS module. No API route and no custom server. Deliver submissions by email with spam filtering and to WhatsApp in seconds, metered with monthly credits.
Vite is a bundler and dev server, not a form backend. Import submitForm from @formsreach/js in a client module and post to FormsReach. You do not add an /api route or a mailer in the Vite repo.
If you scaffolded React or Vue with create-vite, use those framework pages instead of this vanilla recipe.
- Call
submitForm in the browser, not during vite build or from a Node script.
- The env name must start with
VITE_ or import.meta.env will be empty.
- Keys in
data are the same names you would use as HTML name attributes.
- TypeScript uses the same
submitForm call. Types come from @formsreach/js.
Troubleshooting
- Empty API key: Confirm
.env has VITE_FORMSREACH_API_KEY and restart vite.
- Nothing arrives: Submit from the browser and check the form’s Submissions row. Confirm the domain allowlist if you enabled it.
- React or Vue Vite app: Do not copy this vanilla handler. Use the React or Vue SDK pages.
What you get
Monthly credits for submissions and delivery. Scale when volume grows.
Free
500 credits every month for form submissions, email, webhooks, and workflow rules. Spam filtering included. No credit card required.
Starter, Pro & Agency
Larger monthly credit pools (2,000 / 5,000 / 18,000). WhatsApp via Meta Business API unlocks on Pro and Agency. See pricing.
FAQ
Common questions about FormsReach with Vite.
Is there a Vite plugin or @formsreach/vite package?+
No. Use the official @formsreach/js package and call submitForm from a vanilla Vite module.
Does this work with JavaScript and TypeScript?+
Yes. The import is the same. TypeScript uses the types shipped with @formsreach/js.
How do I store the API key in Vite?+
Add VITE_FORMSREACH_API_KEY to a .env file and read import.meta.env.VITE_FORMSREACH_API_KEY. Restart the Vite dev server after changing env files.
Does Free include WhatsApp and email?+
Free includes email, webhooks, and workflow rules with 500 credits every month. WhatsApp is available on Pro and Agency.
Ready to receive form leads?
Create a free API key. Upgrade when you need more monthly credits.