v0 contact form

Formgong team ·

Paste this into v0. Posts go to Formgong. No database and no Resend.

250 free submissions a month

How forms work in v0

v0 generates Next.js App Router code with shadcn/ui and Tailwind. For forms it usually writes a Server Action or an API route that sends email through a provider such as Resend. That needs a server runtime and an API key in your Vercel environment variables, and the code is yours to maintain.

With Formgong the form is a client component that calls fetch on https://formgong.com/submit. Nothing runs on your server for the form, so it also works when the app is exported as static files.

Set it up in v0

  1. Create a form in Formgong and copy the access key.
  2. Paste the prompt below into v0. You can also add https://formgong.com/llms.txt to the project sources so later chats know the fields.
  3. Check the result: the component starts with "use client", posts to Formgong, and there is no new file under app/api and no Server Action for the form.
  4. If you use the shadcn Form with react-hook-form, keep it: put the fetch call in the onSubmit handler.
  5. Deploy to Vercel, send a test and connect Telegram in the form settings.

Step-by-step guide in the docs

v0
Add a contact section with a form. Build it as a React client component ("use client") that posts with fetch. Submissions go to Formgong, a hosted form backend. Do not use Server Actions, route handlers (app/api), or Resend.

Formgong spec (follow exactly):
- Plain HTML: <form action="https://formgong.com/submit" method="POST">. With JavaScript, POST the same fields to https://formgong.com/submit using fetch.
- Hidden field access_key with value fk_your_access_key. The key is public and belongs in frontend code. Do not move it to a server or a secret.
- Hidden field _lang with the page language code, e.g. "en" (on multilingual sites use document.documentElement.lang). Formgong uses it for error messages, the thank-you page, and the autoreply.
- Fields: name, email, message (required); phone is optional. Keep these field names, and use <input type="email"> for email so browsers check the address.
- Honeypot: <input type="text" name="botcheck" tabindex="-1" autocomplete="off"> inside a wrapper with aria-hidden="true", visually hidden with CSS (position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)). Never fill it.
- Success, plain form POST: optionally add a hidden _redirect field with the absolute https URL of the site's thank-you page. Without it, Formgong shows its own thank-you page.
- Success, fetch: send Accept: application/json (and Content-Type: application/json for a JSON body; for FormData let the browser set it). If the response has success === true, show an inline thank-you message and reset the form; otherwise show the response's message.
- Turnstile: only if I give you a Cloudflare Turnstile site key, add <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> and <div class="cf-turnstile" data-sitekey="SITE_KEY"></div> inside the form. Otherwise leave it out.
- Optional: add <script src="https://formgong.com/fg.js" async></script> once per page. It fills _lang from <html lang>, sets the Turnstile language, and counts form views without cookies.
- Do not create a backend, API route, server function, database table, or email-sending code (Supabase, Resend, SendGrid, nodemailer), and do not add secrets. No file uploads.

Ready React component on GitHub: github.com/formgong/react-contact-form. MIT license: click “Use this template” or copy the files.

React package: npm install @formgong/react (npm: @formgong/react)

Formgong or a Server Action?

Write your own Server Action when the submission must change your own data, for example creating a record in your database or checking a signed-in user.

Use Formgong for contact, quote and lead forms. You skip the email provider, the secrets and the spam handling, and you get Telegram delivery and an inbox.

Questions and answers

Why not let v0 write a Server Action that forwards to Formgong?

Every submission would then come from your server's IP address, which weakens per-visitor rate limits and spam signals. Posting from the browser is simpler and works better.

Does it work with a static export?

Yes. Next.js static export does not support Server Actions, but a client component that posts to Formgong needs no server.

Where should the access key go?

Directly in the component or in a NEXT_PUBLIC_ environment variable. The key is public, so it does not belong in a server-only secret.

Start free