Replit の問い合わせフォーム

Formgong team ·

これを Replit に貼ってください。送信先は Formgong です。データベースも Resend も要りません。

250 月あたりの無料送信

Replitでのフォームの仕組み

Replit Agentは、フルスタックアプリを構築する傾向があります。具体的には、ReactフロントエンドとExpressサーバーを組み合わせ、多くの場合、Replit Secretsを通じて設定されたデータベースやメール送信機能を含みます。お問い合わせフォームの場合、サーバーサイドのコード、テーブル、そして継続的に稼働させておく必要があるメールアカウントが必要となります。

Formgongのフォームは、訪問者のブラウザからhttps://formgong.com/submitへ直接送信されるため、サーバーは介在しません。この仕組みは、オートスケール環境でも、バックエンドを持たないサイト向けの静的デプロイ環境でも同様に機能します。

Replitでの設定手順

  1. Formgongでフォームを作成し、アクセスキーをコピーしてください。
  2. 以下のプロンプトをReplit Agentに貼り付けてください。これは、Expressルート、データベーステーブル、メールのシークレットを含まない、フロントエンドのフォームのみを指定するものです。
  3. エージェントが変更したファイルを確認してください。新しい/api/contactルートや、フォーム用の新しいシークレットが追加されていないことを確認してください。
  4. アプリを実行し、WebViewからテスト送信を行い、Formgongの受信トレイで開いてください。
  5. デプロイ。サイトにサーバーサイドのコードが一切ない場合は、「静的デプロイ」で十分です。それ以外の場合は、エージェントが選択したデプロイタイプを維持してください。

ドキュメントの手順ガイド

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.

既存のプロジェクトに追加: npx formgong init (npm: formgong)

Formgong内か、それともExpressのルートか?

「独自のルート」は、送信データがアプリに反映される場合に有効です。例えば、Postgresへの保存、ユーザーとの紐付け、ジョブの開始などが挙げられます。

Formgongは、お問い合わせフォームや問い合わせフォームを作成するための最も手軽な手段です。サーバー側のコードやメールプロバイダー、データベースの管理が不要で、Telegramによる配信機能やスパムフィルタリング機能も標準で含まれています。

よくある質問

アクセスキーはReplitのシークレットに設定すべきでしょうか?

いいえ。アクセスキーは公開用であり、ブラウザに届く必要があります。シークレットは非公開の値用です。サーバー上に隠されたキーを使用すると、ブラウザ上のフォームが機能しなくなります。

エージェントがフォーム用のデータベースを追加しました。これは問題でしょうか?

これはエラーではなく、追加作業となります。他にこの表を参照する箇所がない場合は、エージェントに依頼して表を削除し、フロントエンドのフォームのみを残してください。

公開する前にテストすることはできますか?

はい。ReplitのWebViewからの送信データは実際のデータであり、Formgongの受信箱に表示されます。テスト用のエントリは、作業終了後に受信箱から削除してください。

無料ではじめる