Platforms / Next.js
Contact form for Next.js — no backend required
Next.js can host Server Actions and Route Handlers, but you still own rate limits, spam, retention and webhook delivery. FormHeron is the form action URL — no server code on your side.
Setup
- Create a free FormHeron account and a form. Copy the public key.
- Paste the form action into any Server or Client Component. Use method POST.
- Add the _hp honeypot field exactly as shown — bots fill it; humans never see it.
- Optional: set allowed origins to your production domain and a redirect URL on your domain.
- For JSON clients, POST application/json and read the stable error code field.
Working example
export default function ContactPage() {
return (
<form action="https://formheron.com/f/YOUR_KEY" method="POST">
<input type="email" name="email" required placeholder="Email" />
<textarea name="message" required placeholder="Message" />
<input
type="text"
name="_hp"
tabIndex={-1}
autoComplete="off"
aria-hidden="true"
className="absolute -left-[9999px]"
/>
<button type="submit">Send</button>
</form>
);
}Common problems
Server Actions vs form action URL
You can wrap FormHeron in a Server Action that fetch()es the endpoint, but most sites do better with a plain HTML form action — fewer moving parts, works without JS.
CORS on JSON posts
Browser fetch needs your origin on the form allowlist. Empty allowlist means open (fine for prototypes; lock it before launch).
Redirect after submit
Set redirect_url on the form to an https URL on an allowed origin. It is validated at save and again at submit so it cannot become a phishing hop.
FAQ
How do I add a contact form to Next.js without a backend?
Point the form action at https://formheron.com/f/YOUR_KEY with method POST. FormHeron stores the submission, filters spam, and emails you.
Does this work with the App Router?
Yes. The form is ordinary HTML. No Route Handler required unless you want a custom JSON client.
Can I use Server Actions?
Yes — call fetch to the FormHeron endpoint from the action. Most projects do not need that layer.