Furrow Forms

Frameworks & SSGs · works with Furrow Forms

Next.js forms for the App Router

Delete /api/contact — one endpoint replaces the route, the filter, and the mailer.

paste this into your agent

Fetch furrowforms.com/ai and set up a contact form backend for my Next.js app.

agent-readable recipe: /forms-for/nextjs.md

prefer clicking? start in the dashboard

components/contact-form.tsx
'use client';
import { useState } from 'react';

export function ContactForm() {
  const [sent, setSent] = useState(false);
  const [loadedAt] = useState(() => Date.now());

  async function submit(formData: FormData) {
    const res = await fetch('https://api.furrowforms.com/s/fp_k7m2', {
      method: 'POST',
      body: formData,
    });
    const { ok } = await res.json();
    setSent(ok);
  }

  if (sent) return <p>Thanks — we’ll be in touch.</p>;
  return (
    <form action={submit}>
      <input type="text" name="_gotcha" style={{ display: 'none' }} tabIndex={-1} />
      <input type="hidden" name="_ft" value={loadedAt} />
      <input name="email" type="email" required />
      <textarea name="message" required />
      <button>Send</button>
    </form>
  );
}

The gap

Why Next.js sites need a form backend

Every Next.js app eventually grows a /api/contact route: parse the body, check a captcha, call a mail API, maybe store the thing, forget to rate-limit it. It is the most-rewritten forty lines in the ecosystem. Furrow Forms replaces the route entirely — your form POSTs from the client to a managed endpoint with the spam stack on by default, and your team gets email while your systems get HMAC-signed webhooks. Snippets are generated natively for Next.js from the form’s field contract, and the whole backend is provisionable by the same AI agent that scaffolds your app.

01

The form route is a liability, not a feature

Unrate-limited API routes get found; mail-provider keys leak into env sprawl; the captcha wiring breaks quietly. Furrow ships honeypot, Turnstile, domain allowlisting, and per-IP rate limits as defaults — someone else’s pager.

02

Static and edge deployments stay simple

Exporting statically or running fully on the edge? There is no server dependency to accommodate — the form talks to Furrow, not to your deployment.

03

Multi-app fleets, one control plane

Recipients, webhooks, and keys are project-level settings managed over REST or MCP — the same call pattern for every Next.js app you or your agents run.

Two ways in

Set it up yourself, or don’t

Hand it to your agent

[ recommended ]

Furrow’s whole control plane is an API and MCP server. Paste this prompt into Claude Code, Cursor, or any agent — it does the rest:

paste this into your agent

Fetch furrowforms.com/ai and set up a contact form backend for my Next.js app.
  1. 1.Registers the account over POST /api/register — you read one 6-digit email code
  2. 2.Provisions the site: client, project, and forms in one idempotent bootstrap_site call
  3. 3.Pastes the generated snippet into your codebase
  4. 4.Fires test_webhook and verifies the signed delivery

Or do it by hand

  1. 01Create a free account and a project (or let the agent building your app do it over MCP).
  2. 02Copy the generated Next.js snippet into components/ and delete the /api/contact route.
  3. 03Configure domain, recipients, and webhooks once at the project level.
  4. 04Deploy anywhere — Vercel, self-hosted, static export — the form backend is independent of the host.

free tier: 100 subs/mo · unlimited forms · full API + MCP · pricing →

Working setup

How to add a Next.js form

01 Client form

The usual Next.js path is a client component that POSTs FormData to Furrow. No /api/contact route, no mail library, no server. This works for the App Router, a static export, and the edge runtime, because the browser talks to Furrow.

Replace fp_k7m2 with the real public key. Do not move it into NEXT_PUBLIC_ or .env — it is not a secret, and a missing variable is how these forms break in production.

Add the site’s apex, www, and localhost to the project’s allowed domains. Browser fetch is CORS-checked against that list; anything else is 403 forbidden_origin.

components/contact-form.tsx
'use client';
import { useState } from 'react';

const ENDPOINT = 'https://api.furrowforms.com/s/fp_k7m2';

export function ContactForm() {
  const [sent, setSent] = useState(false);
  const [loadedAt] = useState(() => Date.now());

  async function submit(formData: FormData) {
    const res = await fetch(ENDPOINT, {
      method: 'POST',
      headers: { Accept: 'application/json' },
      body: formData,
    });
    const data = await res.json();
    setSent(Boolean(data.ok));
  }

  if (sent) return <p>Thanks — we’ll be in touch.</p>;
  return (
    <form action={submit}>
      <input type="text" name="_gotcha" style={{ display: 'none' }} tabIndex={-1} autoComplete="off" />
      <input type="hidden" name="_ft" value={loadedAt} />
      <input name="name" type="text" required />
      <input name="email" type="email" required />
      <textarea name="message" required />
      <button>Send</button>
    </form>
  );
}

Accept: application/json is what selects the JSON response. Without it, a classic POST is a 303 redirect.

02 App Router server action

A server action is the right shape when the submit should stay on your origin — extra checks, a redirect you control, or a file you want to forward yourself. The action still POSTs to the same Furrow URL. Furrow has no separate server-side endpoint.

A server fetch has no browser Origin. If the project has allowed domains, send an Origin header that matches one of them or Furrow answers 403 forbidden_origin. Use the production origin in production and add localhost while you test.

Copy only the fields you defined. A server-action FormData also carries Next.js action bookkeeping fields, and those should not land in the submission.

app/contact/actions.ts
'use server';

import { redirect } from 'next/navigation';

const ENDPOINT = 'https://api.furrowforms.com/s/fp_k7m2';
const SITE_ORIGIN = 'https://example.com';

export async function sendContact(formData: FormData) {
  const body = new FormData();
  for (const key of ['name', 'email', 'message', '_gotcha', '_ft', 'cf-turnstile-response']) {
    const value = formData.get(key);
    if (typeof value === 'string') body.append(key, value);
  }
  const file = formData.get('attachment');
  if (file instanceof File && file.size > 0) body.append('attachment', file);

  const res = await fetch(ENDPOINT, {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      Origin: SITE_ORIGIN,
    },
    body,
  });
  const data = await res.json().catch(() => null);
  if (!res.ok || !data?.ok) {
    throw new Error('Form submission failed');
  }
  redirect('/thanks');
}

redirect() throws, so call it only after a successful JSON body. Failure throws and the App Router error boundary takes over.

03 Route handler

Same proxy, as a route handler, if an existing client already POSTs to /api/contact. Forward the multipart body and pass the incoming Origin through so the allowlist still sees the real site.

app/api/contact/route.ts
import { NextResponse } from 'next/server';

const ENDPOINT = 'https://api.furrowforms.com/s/fp_k7m2';

export async function POST(request: Request) {
  const incoming = await request.formData();
  const origin = request.headers.get('origin') ?? new URL(request.url).origin;
  const res = await fetch(ENDPOINT, {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      Origin: origin,
    },
    body: incoming,
  });
  const data = await res.json().catch(() => ({ ok: false }));
  return NextResponse.json(data, { status: res.ok ? 200 : res.status });
}

04 Spam protection

Honeypot field _gotcha, kept hidden and empty. Timing field _ft, set to Date.now() when the form renders; omitting it is not penalized, but browser forms should send it. Optional Cloudflare Turnstile: the site key and secret live on the Furrow project. When require_turnstile is true, get_snippet includes the widget, which posts the reserved field cf-turnstile-response. Do not put the Turnstile secret in the Next.js app.

Domain allowlist, per-IP per-form rate limit (default 10 requests / 60 seconds), and server-side filtering are project settings. Caught spam returns a normal 200 and is quarantined: no normal notification, no webhook, no quota. A [Potential spam] email still goes to notify addresses so a real lead is not dropped quietly.

05 Success and redirect

A classic form action pointed at the Furrow URL — no React state — gets a 303 to default_redirect_url. That thank-you URL is absolute and on an allowed domain. Build the page in the Next.js app.

fetch() and the server action above send Accept: application/json and read { "ok": true, "id": "<submission_id>" }. The client form swaps in a thank-you message. The server action calls redirect("/thanks") itself. Either way the visitor should see a confirmation, not a JSON payload.

components/contact-form.tsx
export function ContactForm() {
  return (
    <form action="https://api.furrowforms.com/s/fp_k7m2" method="POST">
      <input type="text" name="_gotcha" style={{ display: 'none' }} tabIndex={-1} autoComplete="off" />
      <input type="hidden" name="_ft" value="" />
      <input name="email" type="email" required />
      <textarea name="message" required />
      <button>Send</button>
    </form>
  );
}

No JavaScript success state. The browser follows Furrow’s 303.

06 File uploads

Uploads are off until you enable them on the project. Every form on that website inherits the switch. Send multipart FormData from a file input — JSON cannot carry files. Default types: PDF, JPEG, PNG, WebP. Multi-file fields use a [] name, name="photos[]".

Files are stored in a private per-project inbox. Emails and webhooks link to the inbox. They do not include a public file URL. The server action above already forwards a single attachment field; the client form only needs the input.

components/contact-form.tsx
<input
  name="attachment"
  type="file"
  accept="application/pdf,image/jpeg,image/png,image/webp"
/>

07 Set it up with an agent (MCP)

Paste “Fetch furrowforms.com/ai and set up a contact form backend for my Next.js app.” The agent can register the account (you read one 6-digit email code), then call bootstrap_site. That one call creates the client, the website, and the forms. It is idempotent by slug, so re-running it does not duplicate them.

get_snippet returns Next.js code for the field contract, including _gotcha, _ft, and the Turnstile widget when the project requires it. test_webhook checks a signed delivery. The MCP endpoint is https://api.furrowforms.com/mcp, and the same operations exist over REST. Both work on the free tier. The frw_ token stays in the MCP client, not in the app’s env.

FAQ

Next.js + Furrow Forms, answered

How do I add a Next.js form in the App Router?

POST FormData from a client component to https://api.furrowforms.com/s/<public_key> with Accept: application/json, or point a plain <form action> at that URL for a 303 redirect. Furrow stores the submission, filters spam, emails you, and can fire a signed webhook. You do not need /api/contact.

Can a Next.js server action submit the form?

Yes. The action copies your fields into a new FormData and POSTs it to the same endpoint with Accept: application/json and an Origin header that matches an allowed domain. On { "ok": true } call redirect(). A route handler can proxy the same request if a client already posts to /api/contact.

Why not just write an API route with a mail library?

You can — and you then own spam filtering, rate limiting, captcha wiring, deliverability, storage, and retries, per app, forever. A form backend turns those forty recurring lines into managed infrastructure with a delivery log.

Does a next js form work with static export or the edge runtime?

The client-form path does. The browser talks to Furrow, so output: "export", edge rendering, and self-hosting all work. CORS follows the project’s allowed domains. A server action or route handler needs a server, so it does not run on a fully static export.

Can a Next.js form upload files?

Yes, after uploads are enabled on the project (off by default). Send multipart FormData. Default types are PDF, JPEG, PNG, and WebP. Multi-file inputs use a [] name suffix. Files stay in a private inbox linked from email and webhooks.

The form backend your agent can run.

paste this into your agent

Fetch furrowforms.com/ai and set up forms for this site.

Setup for agents →