Form in Bolt

Bolt often offers its own database. A contact form does not need one.

  1. Get a Formgong key.
  2. Paste the prompt into Bolt.
  3. Check that the form posts to /submit, not a local table.
  4. The submission should appear in the inbox.

Prompt

Add a contact form to this site. Submissions go to Formgong, a hosted form backend. Bolt: do not create a database table, Supabase project, or server function for this form.

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.

Required: directly under the submit button, add a small, muted link to Formgong, exactly <p class="fg-credit"><a href="https://formgong.com/en/?ref=badge&utm_source=badge&utm_medium=form&utm_campaign=prompt" target="_blank" rel="noopener">Form by Formgong</a></p> Keep it visible on the page.

Minimal code

React component

"use client";
import { useState } from "react";

export function ContactForm() {
  const [status, setStatus] = useState("");
  async function onSubmit(event) {
    event.preventDefault();
    const fields = Object.fromEntries(new FormData(event.currentTarget));
    const response = await fetch("https://formgong.com/submit", {
      method: "POST",
      headers: { "Content-Type": "application/json", Accept: "application/json" },
      body: JSON.stringify({ _lang: "en", ...fields, access_key: "fk_your_access_key" }),
    });
    const result = await response.json();
    setStatus(result.message || (result.success ? "Sent. Thank you!" : "Could not send. Please try again."));
  }

  return (
    <form onSubmit={onSubmit}>
      <label>Name <input name="name" placeholder="Your name" required /></label>
      <label>Email <input name="email" type="email" placeholder="you@example.com" required /></label>
      <label>Message <textarea name="message" placeholder="How can we help?" required /></label>
      <div aria-hidden="true" style={{ position: "absolute", insetInlineStart: 0, top: 0, width: 1, height: 1, overflow: "hidden", clipPath: "inset(50%)" }}>
        <input name="botcheck" tabIndex={-1} autoComplete="off" />
      </div>
      <button type="submit">Send</button>
      <p role="status">{status}</p>
    </form>
  );
}

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)

Add to an existing project: npx formgong init (npm: formgong)

Before you publish

  • The form posts to https://formgong.com/submit (form action or fetch URL).
  • access_key holds your key from the Formgong dashboard, not fk_your_access_key.
  • A hidden, empty botcheck field is present.
  • _lang matches the page language.
  • No API route, server function, database table, or secret was added for the form.
  • A test submission shows up in the Formgong inbox. Telegram (if connected) and email arrive at once, on Free too.

What Bolt tends to get wrong

When Bolt hears "form", it often adds a Supabase table or a server function, or a form that only logs to the console in the preview. The messages then never reach anyone. The prompt asks for a plain POST to Formgong with the hidden access key, so there is nothing extra to host or connect.

Many Bolt projects are deployed to Netlify. You don't need Netlify Forms as well. One backend per form is enough, and the Formgong form works the same on any host.

For agents: connect the MCP server

Bolt: Settings → Connectors (MCP) → Custom MCP server. Name: Formgong. Transport: HTTP. Authentication: MCP OAuth. Click Connect, sign in to Formgong and approve the permissions, then enable the connector for your project. API key is also available with a personal Formgong token.

Bolt MCP settings

Name: Formgong
URL: https://formgong.com/mcp?auth=required
Transport: HTTP
Authentication: MCP OAuth
Connect → Formgong

Prompt for an agent with MCP

With the MCP server connected, this prompt lets the agent find your form and key on its own:

Use the Formgong MCP server to add a working contact form to this site.
1. Call list_forms. If there is no form for this site, call create_form with the site name.
2. Call get_form_snippet with that form_id and framework "react" (use "html" for a static page, "next" for the Next.js App Router).
3. Add the returned code as the contact form, styled like the rest of the site. Keep access_key, _lang and the botcheck honeypot exactly as returned.
4. Do not add a backend, API route, database or email code, and never write the fgp_ token into project files.

Check the result

  1. Send a test message from the Bolt preview or the deployed site.
  2. Open the message in the Formgong inbox.
  3. Check that no database table or server function was created for the form.
  4. Run the form checker on the deployed page.

The form checker reads the published page and lists concrete problems, such as a missing name attribute or a placeholder key.

Questions

Do I need Bolt's database for a contact form?

No. Formgong stores the message and sends the email. A database only makes sense if your app itself needs to show or edit the messages.

Will the form still work if I move the site away from Bolt?

Yes. The form is plain HTML or a fetch call, so it works on any host: Netlify, Vercel, GitHub Pages or your own server.

Is the access key in the prompt a secret?

No. The access key (fk_…) is public by design. It can only send submissions to one form, which anyone can already do on your site. Secrets, such as a Turnstile secret key or a Formgong API token (fgp_…), must never go into a prompt or frontend code.

How do I put my real key into the prompt?

Copy it from your Formgong dashboard and replace fk_your_access_key. If you are signed in, use the button under the prompt. It reads your forms from your own dashboard in the browser and swaps the key in. Nothing is sent to the AI tool until you paste the prompt.

Bolt contact form →

Get a key