Form in Replit
Replit Agent tends to add an Express route and a database for a contact form. The prompt keeps the form frontend-only and posts it to Formgong.
- Get an access key on the homepage.
- Open the Replit app and paste the prompt into Agent.
- Check that no new server route, database, or secret was added for the form.
- Publish, send a test submission, and open it in the Formgong inbox.
Prompt
Add a contact form to this app. Keep it frontend-only: submissions go to Formgong, a hosted form backend. Replit Agent: do not add an Express or Flask route, a database, Replit Secrets, or nodemailer 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>
);
}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 Replit tends to get wrong
For a contact form, Replit Agent often adds an Express or Flask route, a database table and nodemailer with an SMTP password in Replit Secrets. That is more to run and more to secure. The prompt keeps the form frontend-only: the browser posts to Formgong, which stores the message, filters spam and sends the email.
Because the messages go straight to Formgong, the form keeps working while your app server restarts or redeploys.
For agents: connect the MCP server
Replit Agent can use custom MCP servers. Open Integrations, go to MCP Servers and add a server by its URL. Put the token in a custom header under Advanced settings. Agent can then look up your forms and get code with your real key.
Replit MCP settings
URL: https://formgong.com/mcp Advanced settings → custom header Authorization: Bearer fgp_your_token
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
- Check the Agent's changes: no new server route, database table or secret for the form.
- Deploy and send a test message from the live address.
- Open the message in the Formgong inbox.
- 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 Replit Secrets for the access key?
No. The access key is public and is meant to sit in the page's HTML. Secrets are for private values, and this form has none.
My Replit app already has a backend. Should the form use it?
It can, but then you maintain email delivery and spam filtering yourself. Posting to Formgong keeps the form independent of your server, so it keeps working while you change the backend.
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.