Replit contact form

Formgong team ·

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

250 free submissions a month

How forms work in Replit

Replit Agent tends to build full-stack apps: a React frontend with an Express server, often with a database and email sending configured through Replit Secrets. For a contact form that means server code, a table and an email account you have to keep running.

A Formgong form posts from the visitor's browser to https://formgong.com/submit, so the server is not involved. It works the same on an Autoscale deployment and on a Static deployment for a site without a backend.

Set it up in Replit

  1. Create a form in Formgong and copy the access key.
  2. Paste the prompt below into Replit Agent. It asks for a frontend form only, without an Express route, database table or email secret.
  3. Check the files the Agent changed: there should be no new /api/contact route and no new secret for the form.
  4. Run the app, send a test from the webview and open it in the Formgong inbox.
  5. Deploy. If the site has no server code at all, a Static deployment is enough; otherwise keep the deployment type the Agent chose.

Step-by-step guide in the docs

Replit
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.

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

Formgong or an Express route?

Your own route makes sense when the submission feeds the app: storing it in your Postgres, linking it to a user or starting a job.

Formgong is the shorter path for contact and lead forms: no server code, no email provider and no database to keep. Telegram delivery and spam filtering are included.

Questions and answers

Should the access key go into Replit Secrets?

No. The access key is public and has to reach the browser. Secrets are for private values; a key hidden on the server would break a browser form.

The Agent added a database for the form. Is that a problem?

It is extra work, not an error. If nothing else reads the table, ask the Agent to remove it and keep just the frontend form.

Can I test before deploying?

Yes. Submissions from the Replit webview are real and appear in your Formgong inbox. Delete test entries there when you are done.

Start free