---
title: "Migrate Framer Forms to Next.js Without Losing Submissions"
description: "Migrate Framer forms to Next.js without losing submissions: export past data, run both in parallel, remap webhooks, add Turnstile, test with curl, monitor."
url: https://deframer.co/blog/forms-after-leaving-framer
---

# How to migrate Framer forms to Next.js without losing submissions

Migrate Framer forms to Next.js without losing submissions: route handlers, webhook mapping, a parallel run, spam protection and monitoring.

Deframer

**Published**

24 September 2026

**Updated**

1 November 2026

**Reading time**

11 min

- [Forms](https://deframer.co/blog?tag=forms)
- [Webhooks](https://deframer.co/blog?tag=webhooks)
- [Next.js](https://deframer.co/blog?tag=nextjs)
- [Migration](https://deframer.co/blog?tag=migration)

![Deframer cover: “Forms that post to your route.” Beside it, a list of Contact form, API route and Webhook or email with API route selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fforms-after-leaving-framer.webp&w=3840&q=75)

To migrate Framer forms to Next.js without losing submissions, record where each form sends today and export past data, give every form its own route handler in the new project, point it at the same destinations through webhooks, remap any receiver to the new payload, and run both sites in parallel until DNS settles. Then test every route with curl and watch the logs after launch. If you convert to [TanStack Start](https://deframer.co/framer-to-tanstack-start), [Astro](https://deframer.co/framer-to-astro) or [React Router](https://deframer.co/framer-to-react-router) instead, forms come across the same way, with one API route per form in that framework's routes; a [Vite](https://deframer.co/framer-to-vite) site, which has no server, posts them to a form service you set or to Netlify Forms.

In a project converted by Deframer, Framer's native forms no longer post to Framer's form service. Each form gets its own API route at `src/app/api/forms/<name>/route.ts`, its fields are listed in `src/site/forms.ts`, and `src/lib/forms.ts` rate-limits, filters spam, validates and delivers every submission. Delivery means the submission is logged and sent as JSON to webhook URLs you set in environment variables, so you decide where it goes: Zapier, Make, n8n, Slack, a CRM, or your own email code.

Forms are the one part of a site that has to change when you leave a hosted platform, because something on your side must now receive the data. This guide shows the three files involved, what to record before cutover, how webhook receivers change, a parallel-run plan, how to connect a destination and send email, spam protection, testing with curl, and monitoring after launch.

## The three files

### One route per form

Every native form gets a route named after the form's layer (or, failing that, its file), such as `contact` or `footer`. The route file is a single line (real output):

ts

```
// src/app/api/forms/footer/route.ts
import { formHandler } from "@/lib/forms";
import { forms } from "@/site/forms";

export const POST = formHandler("footer", forms.footer);
```

The form component in your view posts to that route. You don't need to change it unless you rename the form.

### The field list

`src/site/forms.ts` lists every form with its fields, as the design defines them: type, whether it is required, select options, an optional redirect page after success, and the name of the environment variable holding the form's own webhook.

ts

```
// src/site/forms.ts (excerpt)
export const forms = {
  contact: {
    fields: {
      Name: { type: "text", required: true },
      Email: { type: "email", required: true },
      Message: { type: "textarea" },
    },
    webhook: "FORMS_CONTACT_WEBHOOK_URL",
  },
};
```

If you change a form in the design, keep this file in step with it. Fields a form sends that aren't listed are still accepted as plain text, so code overrides that add inputs keep working, but listing a field is what gets it validated.

### The handler

`src/lib/forms.ts` does four things, in order:

1. **Rate limit.** Five submissions per minute from one IP address, read from the header your host sets (`cf-connecting-ip`, `x-real-ip`, `fly-client-ip` or `x-vercel-forwarded-for`). The count lives in the server's memory, so each server instance counts on its own. If you run several instances, move it to a shared store such as Redis.
2. **Honeypot.** Hidden decoy fields catch simple bots. A submission that fills them is answered like a success but never delivered.
3. **Validation.** The same checks the browser makes (required fields, email and URL formats, number and date ranges, maximum length, select options) run again on the server, where they can't be skipped.
4. **Delivery.** The submission is logged and POSTed as JSON to `FORMS_WEBHOOK_URL` (every form) and to the form's own variable, such as `FORMS_CONTACT_WEBHOOK_URL`, when set.

It answers with JSON: `{ "ok": true }` on success (plus `redirect` when the form has one), 400 with per-field `errors` for invalid input, 413 for a body over 100,000 characters, 429 when rate-limited, and 502 if a webhook fails or takes longer than 10 seconds.

It is a starting point, written to be read and changed. The file's own comments explain each part.

![A submission's path in five steps: the form's own route, rate limit, honeypot, validation, and delivery as JSON to your webhook](https://deframer.co/api/cms/media/file/form-route.webp)

Every form posts to its own route; src/lib/forms.ts does the rest, in this order.

## Before cutover: record where Framer sends each form

Nothing about a form's history moves with the code, so write down every form's current destinations before you switch DNS. As of October 2026, Framer's native forms send submissions by email, to Google Sheets, or to a custom webhook ([Framer forms](https://www.framer.com/updates/forms)), and each form's destination is set on the form itself in Framer.

1. **List every form** and where it sends today. The project's `README.md` Forms section and `src/site/forms.ts` list the forms the conversion found; match each to its Framer settings.
2. **Export what you already have.** Download the Google Sheet as CSV, export or archive the notification emails, and note any automation (Zapier, Make, n8n) the Framer webhook triggers. Those destinations are the only record of past submissions, so keep them after you leave Framer.
3. **Note how each receiver reads the data**, because the body changes (next section).
4. **Keep the Framer forms configured** until the new site has run cleanly for a few days. Visitors whose DNS hasn't updated yet, or who have the old page open, still submit to Framer.

A simple inventory is enough (example values):

| Form | Framer sends to | New destination |
| --- | --- | --- |
| contact | Email and a Google Sheet | `FORMS_CONTACT_WEBHOOK_URL` (an automation that emails and appends to the same sheet) |
| footer (newsletter) | Webhook to Zapier | `FORMS_FOOTER_WEBHOOK_URL` (the same Zap, remapped) |

- [ ] Every form in `src/site/forms.ts` has a row
- [ ] Past submissions exported from each destination
- [ ] Each receiver remapped to the new body
- [ ] Each form tested on the preview deployment

## What changes for your webhook receivers?

The body changes shape, so an existing Zap, scenario or endpoint needs its field mapping updated. Framer's webhook sends JSON with the input names as keys and signs each request with a `Framer-Signature` header when you set a secret ([Framer's webhook guide](https://www.framer.com/help/articles/framer-form-webhook-setup/)). The converted handler sends the fields nested under `fields`, plus the form name, page and time:

|  | Framer webhook | Converted project |
| --- | --- | --- |
| Body | `{ "Name": "Ada", "Email": "ada@example.com" }` | `{ "form": "contact", "fields": { "Name": "Ada", … }, "page": "/contact", "submittedAt": "…" }` |
| Where a field is | `Email` | `fields.Email` |
| Signature | `Framer-Signature`, if a secret is set | None by default |
| Retries | Framer retries a failed delivery | None: the visitor gets a 502 and can try again |

In an automation tool, remap each step from `Email` to `fields.Email`. If your receiver checks `Framer-Signature`, replace that check: add a shared secret header to the `fetch` in `deliver` (for example `"X-Forms-Secret": process.env.FORMS_WEBHOOK_SECRET`) and verify it on the receiving side. Since the handler doesn't retry, pick destinations that answer quickly and reliably; each webhook call times out after 10 seconds.

## A parallel-run plan

Run both versions side by side before the switch, so you can compare real deliveries rather than hope:

1. **Deploy a preview** of the converted site with its webhook variables pointing at the new destinations, or at a copy of them (a test sheet, a test Slack channel).
2. **Submit every form on the preview** at desktop and phone widths, and confirm each submission arrives with every field filled.
3. **Submit the same forms on the live Framer site** and compare the two deliveries field by field: same names, same values, same select options.
4. **Switch the webhook variables to the production destinations**, redeploy, and send one more test.
5. **Cut over DNS.** For the next few days both systems may receive submissions; check the Framer destinations too, then remove them once nothing new arrives there.

## Connecting a destination

1. Copy `.env.example` to `.env.local`. The example lists `FORMS_WEBHOOK_URL` and one `FORMS_<NAME>_WEBHOOK_URL` per form.
2. Create a webhook trigger in the tool you use (an automation platform, a Slack incoming webhook, your CRM's intake endpoint) and paste its URL into the right variable.
3. Restart `npm run dev` so the new variables load.
4. In production, add the same variables in your host's dashboard. `.env*.local` files are listed in `.gitignore`, so your secrets stay out of the repository.

Every webhook receives the same body:

json

```
{
  "form": "contact",
  "fields": { "Name": "Ada", "Email": "ada@example.com", "Message": "Hello" },
  "page": "/contact",
  "submittedAt": "2026-09-24T09:30:00.000Z"
}
```

Set only `FORMS_WEBHOOK_URL` to send all forms to one place, or only the per-form variables to route them separately. If you set both, a submission goes to both.

Deploying with environment variables differs a little per host; the [deployment guide](https://deframer.co/blog/deploy-converted-framer-site-vercel-netlify-cloudflare-fly) covers Vercel, Netlify, Cloudflare and Fly.io.

## Sending email from `deliver`

If you want an email per submission rather than a webhook, call your email provider's HTTP API from the `deliver` function in `src/lib/forms.ts`. Most transactional email providers accept a JSON POST with an API key. The sketch below is code you add; shape the request body the way your provider's documentation describes.

ts

```
// Added to src/lib/forms.ts: called from deliver() after the webhooks.
async function sendEmail(submission: Submission): Promise<void> {
  const apiUrl = process.env.EMAIL_API_URL;
  const apiKey = process.env.EMAIL_API_KEY;
  if (!apiUrl || !apiKey) return;

  const lines = Object.entries(submission.fields).map(([name, value]) => `${name}: ${String(value)}`);
  const response = await fetch(apiUrl, {
    method: "POST",
    headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
    body: JSON.stringify({
      to: process.env.EMAIL_TO,
      subject: `New ${submission.form} submission`,
      text: lines.join("\n"),
    }),
    signal: AbortSignal.timeout(10_000),
  });
  if (!response.ok) throw new Error(`Email API answered ${response.status}`);
}
```

Add the new variables (`EMAIL_API_URL`, `EMAIL_API_KEY`, `EMAIL_TO`) to `.env.example` without values so the next developer knows they exist. Throwing on failure makes the route answer 502, so the visitor sees an error rather than a false success.

## Spam protection: honeypot first, Turnstile if you need it

The honeypot is on by default and stops simple bots silently. If spam still gets through, add a challenge such as Cloudflare Turnstile, which verifies a token on the server. The kit's form sends every named input inside the `<form>` as a field, so the hidden `cf-turnstile-response` input the widget adds arrives in `fields` without changes to the form code.

1. Create a Turnstile widget in the Cloudflare dashboard for your domain, and add its secret as `TURNSTILE_SECRET_KEY` in your environment.
2. Load `https://challenges.cloudflare.com/turnstile/v0/api.js` and place the widget (`<div className="cf-turnstile" data-sitekey="…" />`) inside the form element in the view or component that renders the form.
3. Verify the token in `src/lib/forms.ts` before validation (code you add):

ts

```
// Added to src/lib/forms.ts.
async function passesTurnstile(token: unknown, address: string): Promise<boolean> {
  const secret = process.env.TURNSTILE_SECRET_KEY;
  if (!secret) return true; // Turnstile not configured
  if (typeof token !== "string" || token === "") return false;
  const response = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ secret, response: token, remoteip: address }),
    signal: AbortSignal.timeout(10_000),
  });
  const result = (await response.json()) as { success?: boolean };
  return result.success === true;
}

// In formHandler, after the honeypot check:
const fieldsIn = payload.fields as Record<string, unknown>;
const token = fieldsIn["cf-turnstile-response"];
delete fieldsIn["cf-turnstile-response"]; // don't deliver the token
if (!(await passesTurnstile(token, clientAddress(request)))) {
  return reply(400, { ok: false, error: "Verification failed, please try again." });
}
```

Each token is valid for five minutes and can be verified only once, according to [Cloudflare's server-side validation docs](https://developers.cloudflare.com/turnstile/get-started/server-side-validation/), so a visitor who waits too long or retries after an error needs a fresh challenge. If you run several server instances, pair this with a shared rate limit as described above.

## What stays the same

Not every form on a Framer site is a native Framer form. Forms built inside code components and third-party embeds, such as a HubSpot or Typeform embed, remain the site's own code and keep posting where they did before. You don't need to configure anything for them, but test them on the new domain, since some embed providers restrict the domains a form may load on.

## Testing with curl

Before pointing DNS at the new site, test every form route locally. With `npm run dev` running:

sh

```
# A valid submission: expect {"ok":true}
curl -i -X POST http://localhost:3000/api/forms/contact \
  -H "Content-Type: application/json" \
  -d '{"fields":{"Name":"Ada","Email":"ada@example.com","Message":"Hello"},"page":"/contact"}'

# An invalid email: expect 400 with an errors object naming the field
curl -i -X POST http://localhost:3000/api/forms/contact \
  -H "Content-Type: application/json" \
  -d '{"fields":{"Name":"Ada","Email":"not-an-email"}}'

# A filled honeypot: expect 200, and nothing delivered
curl -i -X POST http://localhost:3000/api/forms/contact \
  -H "Content-Type: application/json" \
  -d '{"fields":{"Name":"Bot","Email":"bot@example.com"},"honeypot":"x"}'
```

Repeat the first request several times quickly to see the 429 rate-limit response. Watch the terminal running `npm run dev`: every delivered submission is logged with a `[forms]` prefix, which tells you the handler ran even before a webhook is connected.

Then submit each form in the browser, at desktop and phone widths, and confirm the data arrives at its destination. The project `README.md` has a Forms section listing this site's forms.

## Monitoring forms after launch

A form that silently stops delivering is the costliest kind of migration bug, because nobody complains. For the first weeks:

1. **Watch the logs.** Every delivered submission is logged with a `[forms]` prefix, failures as `[forms] <name>: delivery failed`, and spam as `spam ignored (honeypot filled)`. Search your host's logs for those lines. Note that the delivered line includes the submitted fields, so treat your logs as containing personal data.
2. **Alert on 502s.** A 502 from `/api/forms/*` means a webhook failed. Most hosts and uptime tools can alert on a status code for a path.
3. **Compare volumes.** Submissions per week should look like they did on Framer. A sharp drop points at a broken destination, a rate limit that is too strict behind a shared proxy, or a challenge that fails for real visitors.
4. **Send a synthetic test** on a schedule: a production `curl` with a recognizable name, filtered out at the destination.

sh

```
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://www.example.com/api/forms/contact \
  -H "Content-Type: application/json" \
  -d '{"fields":{"Name":"Uptime check","Email":"uptime@example.com","Message":"ignore"},"page":"/contact"}'
```

Expect `200`. If you add Turnstile, a synthetic test needs Cloudflare's test keys on a staging deployment instead, since it can't solve a real challenge.

## A pre-launch checklist

| Check | Where |
| --- | --- |
| Every form has a route | `src/app/api/forms/` |
| Fields match the design | `src/site/forms.ts` |
| Webhook variables set in production | Your host's environment settings |
| Rate limit suits your hosting | `src/lib/forms.ts` |
| Embedded forms work on the new domain | The provider's domain settings |
| Past submissions exported | Google Sheet, email archive, automation history |
| Receivers remapped to `fields.*` | Each automation or endpoint |
| Framer destinations kept for a few days | The form's settings in Framer |
| Delivery failures alert someone | Host logs or uptime tool |

Deframer is an independent tool and is not affiliated with, endorsed or sponsored by Framer. The form code it writes is yours to change. If something in the conversion needed attention, the result page's notices name it; [common conversion issues](https://deframer.co/blog/common-framer-to-nextjs-conversion-issues) explains what each one means.

## FAQ

### Will my Framer form submissions keep arriving where they did?

Not for native Framer forms. They post to your project's own routes, so you connect a webhook or email delivery yourself; code-component forms and third-party embeds keep posting where they did.

### Can I store submissions in a database instead?

Yes. Write to your database from `deliver` in `src/lib/forms.ts`, the same way the email example calls an API. The submission object already holds the form name, fields, page and time.

### Does Deframer receive my form submissions?

No. Submissions go to the routes in your own project and the destinations you configure. The [FAQ](https://deframer.co/#faq) explains what Deframer does with the files it converts.

### How do I move Framer form submissions to Next.js without losing any?

Export past submissions from where Framer sends them (sheet, email, automation), connect the new form routes to the same destinations, and keep the Framer forms configured for a few days after the DNS switch. Late visitors still reaching Framer then aren't lost.

### Why did my Zapier or Make automation stop working after the migration?

The webhook body changed: fields now sit under `fields` (for example `fields.Email`) next to `form`, `page` and `submittedAt`. Remap the automation's steps to the new paths, and replace any `Framer-Signature` check with your own secret header.

Deframer

## Move your Framer site to clean code.

Convert your site free, review the result, then download it as a TypeScript project you own: Next.js, Astro, React, TanStack Start, React Router, Nuxt or HTML.

[Convert your site](https://deframer.co/dashboard)[Pricing](https://deframer.co/pricing)

## Keep reading

[All posts](https://deframer.co/blog)

- ![Deframer cover: “Audit first, then migrate.” Beside it, four tiles, Crawl, Baselines, Redirect map and Tests, with Redirect map selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fwebsite-migration-audit-checklist.webp&w=3840&q=75)

  Migration 25 Oct 2026 9 min read

  ### [How to audit a website before migrating it to Next.js](https://deframer.co/blog/website-migration-audit-checklist)

  Audit a site before moving it to Next.js: inventory URLs, record traffic and Core Web Vitals, plan redirects and write acceptance tests. Framer steps marked.
- ![Deframer cover: “Every problem, with a fix.” Beside it, four tiles, Layout, Animations, CMS and Builds, with Animations selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fframer-to-nextjs-migration-problems.webp&w=3840&q=75)

  Migration 25 Oct 2026 15 min read

  ### [Framer to Next.js migration problems: a database of real issues and fixes](https://deframer.co/blog/framer-to-nextjs-migration-problems)

  Real Framer to Next.js migration problems by category, each with symptoms, cause, fix and whether Deframer handles it, from our own test runs and code.
- ![Deframer cover: “Move hosts, keep rankings.” Beside it, a list of Search, Sitemap, Metadata and Redirects with Redirects selected](https://deframer.co/_next/image?url=%2Fapi%2Fcms%2Fmedia%2Ffile%2Fseo-when-moving-off-framer.webp&w=3840&q=75)

  SEO 22 Sep 2026 12 min read

  ### [How to keep SEO when moving off Framer, and fix problems after the migration](https://deframer.co/blog/seo-when-moving-off-framer)

  Keep and fix your SEO after moving off Framer: URLs, redirects, metadata, sitemaps, then troubleshooting with Search Console and curl.
