On this page12 sections
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, Astro or React Router instead, forms come across the same way, with one API route per form in that framework's routes; a 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):
// 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.
// 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:
- 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-iporx-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. - Honeypot. Hidden decoy fields catch simple bots. A submission that fills them is answered like a success but never delivered.
- 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.
- Delivery. The submission is logged and POSTed as JSON to
FORMS_WEBHOOK_URL(every form) and to the form's own variable, such asFORMS_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.

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), and each form's destination is set on the form itself in Framer.
- List every form and where it sends today. The project's
README.mdForms section andsrc/site/forms.tslist the forms the conversion found; match each to its Framer settings. - 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.
- Note how each receiver reads the data, because the body changes (next section).
- 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 | |
footer (newsletter) | Webhook to Zapier | |
- [ ] Every form in
src/site/forms.tshas 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). The converted handler sends the fields nested under fields, plus the form name, page and time:
| Framer webhook | Converted project |
|---|---|---|
Body | | |
Where a field is | | |
Signature | | 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:
- 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).
- Submit every form on the preview at desktop and phone widths, and confirm each submission arrives with every field filled.
- Submit the same forms on the live Framer site and compare the two deliveries field by field: same names, same values, same select options.
- Switch the webhook variables to the production destinations, redeploy, and send one more test.
- 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
- Copy
.env.exampleto.env.local. The example listsFORMS_WEBHOOK_URLand oneFORMS_<NAME>_WEBHOOK_URLper form. - 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.
- Restart
npm run devso the new variables load. - In production, add the same variables in your host's dashboard.
.env*.localfiles are listed in.gitignore, so your secrets stay out of the repository.
Every webhook receives the same body:
{
"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 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.
// 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.
- Create a Turnstile widget in the Cloudflare dashboard for your domain, and add its secret as
TURNSTILE_SECRET_KEYin your environment. - Load
https://challenges.cloudflare.com/turnstile/v0/api.jsand place the widget (<div className="cf-turnstile" data-sitekey="…" />) inside the form element in the view or component that renders the form. - Verify the token in
src/lib/forms.tsbefore validation (code you add):
// 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, 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:
# 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:
- Watch the logs. Every delivered submission is logged with a
[forms]prefix, failures as[forms] <name>: delivery failed, and spam asspam 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. - 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. - 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.
- Send a synthetic test on a schedule: a production
curlwith a recognizable name, filtered out at the destination.
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 | |
Fields match the design | |
Webhook variables set in production | Your host's environment settings |
Rate limit suits your hosting | |
Embedded forms work on the new domain | The provider's domain settings |
Past submissions exported | Google Sheet, email archive, automation history |
Receivers remapped to | 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 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 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.
