Form Builder Templates Pricing Dashboard Get Started Free
Next.js Form Backend

A Next.js form backend that needs no API route

You don't need to write a Next.js API route or serverless function to handle a contact form. Point a React client component — or a plain HTML form — at SnapItForms, and every submission is filtered for spam and emailed straight to your inbox. Works the same in the App Router, Pages Router, Vite, Astro and Remix.

Why you don't need an API route for a contact form

When a form only needs to email you a message — contact, lead, signup, feedback — a hand-written app/api/contact/route.js or serverless function is pure overhead. You'd be wiring up a mail provider, API keys, validation, spam protection, rate limiting and error handling, then deploying and maintaining it, all to move a few fields into your inbox.

A hosted form backend does that part for you. Your form POSTs to one endpoint; SnapItForms handles delivery, spam filtering, file uploads, storage and notifications. There is no server to run and no backend code to write.

You genuinely need your own API route when a form must run custom server logic — writing to your database, calling a paid API with a secret key, or reacting to the submission on the server. For everything else, skip it.

  • No route.js / API route to build, secure or deploy.
  • No mail provider account, SMTP credentials or SES setup.
  • Spam filtering, file uploads and email notifications are built in.
  • Works on any host — Vercel, Netlify, Cloudflare, static export — because there's no backend of your own.

Handle a Next.js form in 3 steps

  1. Get a free access key

    Sign in to SnapItForms with Google to create a free account and copy your access key. Only you, the developer, sign in — your visitors never do.

  2. POST a React client component to SnapItForms

    Mark the component "use client", capture the submit event, and fetch the endpoint with new FormData(e.target) — including a hidden access_key input. Read the JSON response to show a success state.

  3. Or drop in a plain HTML form

    When you don't need JavaScript, set a native <form> action to the endpoint. Submissions are emailed to you with zero client-side code.

1. React client component (App Router)

Create app/contact/ContactForm.jsx. The "use client" directive makes it interactive so you can track submitting and success state:

"use client";

import { useState } from "react";

export default function ContactForm() {
  const [status, setStatus] = useState("idle"); // idle | sending | success | error

  async function handleSubmit(e) {
    e.preventDefault();
    setStatus("sending");

    try {
      const res = await fetch("https://api.snapitforms.com/submit", {
        method: "POST",
        body: new FormData(e.target) // includes the hidden access_key input
      });
      const data = await res.json();
      setStatus(data.success ? "success" : "error");
      if (data.success) e.target.reset();
    } catch {
      setStatus("error");
    }
  }

  if (status === "success") {
    return <p>Thanks — your message is on its way.</p>;
  }

  return (
    <form onSubmit={handleSubmit}>
      {/* your free access key — the only SnapItForms-specific field */}
      <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" />
      <input type="text" name="name" placeholder="Name" required />
      <input type="email" name="email" placeholder="Email" required />
      <textarea name="message" placeholder="Message" required />
      <button type="submit" disabled={status === "sending"}>
        {status === "sending" ? "Sending…" : "Send"}
      </button>
      {status === "error" && <p>Something went wrong. Please try again.</p>}
    </form>
  );
}

Then render it from any Server Component page, e.g. app/contact/page.jsx:

import ContactForm from "./ContactForm";

export default function ContactPage() {
  return <ContactForm />;
}

2. Plain HTML form (no JavaScript)

Don't need interactive state? A native form works inside a Server Component with no "use client" at all. The browser posts it directly and SnapItForms emails you the result:

<form action="https://api.snapitforms.com/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <input type="text" name="name" placeholder="Name" required>
  <input type="email" name="email" placeholder="Email" required>
  <textarea name="message" placeholder="Message"></textarea>
  <button type="submit">Send</button>
</form>

Strict Content-Security-Policy? Allow the endpoint. If your site sends a strict CSP, the browser can silently block the request even though a curl test returns 200. Add https://api.snapitforms.com to connect-src so the fetch is permitted, and to form-action if you use the native form POST. In Next.js you set these in your headers() config or middleware.

Works the same everywhere

Nothing here is App Router–specific. The exact same hidden access_key field plus POST works in the Next.js Pages Router, in React apps built with Create React App or Vite, and in Astro, Remix, SvelteKit, Nuxt, plain HTML and any static host. The endpoint accepts standard form fields as multipart/form-data, urlencoded and JSON, so new FormData(form) from a browser fetch just works — including file uploads. The API supports CORS for browser fetch.

Prefer not to hand-write the markup? The free form builder and templates generate ready-to-paste form code for you.

Rolling your own API route vs SnapItForms

Both get form data from the browser to your inbox. The difference is how much of the backend you build and maintain yourself.

What you handle SnapItForms Your own Next.js API route
Backend code to writeNoneRoute handler + validation
Email deliveryBuilt inWire up SES / a mail API
Spam filteringBuilt inAdd honeypot / captcha yourself
File uploadsSupportedHandle multipart + storage
Rate limitingBuilt inAdd it yourself
Submission storage & dashboardIncludedBuild a DB + UI
Secrets in your repoNone — just an access keyMail/API keys to manage
Works with static export / any hostYesNeeds a serverless runtime
Setup timeA couple of minutesHours, then ongoing upkeep
Free plan500 submissions/moYour own infra costs

SnapItForms figures per snapitforms.com/pricing. "Your own API route" reflects the typical work to ship a production contact endpoint (mail provider, validation, spam, rate limiting, storage). Build your own when a submission must run custom server logic; otherwise a hosted backend is less to own.

Ship the form, skip the backend

Free plan: 500 submissions a month, unlimited forms, email notifications, spam filtering and file uploads. No credit card, no API route.

Get your free access key

Next.js form backend FAQ

No. For a contact, lead or signup form you do not need a Next.js API route, Route Handler or serverless function. Point the form at a hosted form backend like SnapItForms and submissions are emailed to you. You only need your own API route when you must run custom server logic, talk to a database, or keep a secret you cannot expose to the browser.
Add a hidden access_key input to your form and POST it to https://api.snapitforms.com/submit. You can do this from a plain HTML form with a native action attribute, or from a React client component using fetch with new FormData(e.target). SnapItForms accepts the submission, filters spam, stores it in your dashboard and emails it to you — no serverless function of your own to write, deploy or maintain.
Yes. A form that posts to SnapItForms works the same in the App Router and the Pages Router. If you want interactive state such as a submitting or success message, put the form in a client component marked with "use client" and call fetch there. A native HTML form with an action attribute also works inside a Server Component with no client JavaScript at all.
Yes. The SnapItForms endpoint accepts standard form fields as multipart/form-data, urlencoded and JSON, so posting new FormData(e.target) from a browser fetch works directly, including file uploads. The API supports CORS for browser fetch and returns a JSON response you can read to show a success state.
Often, yes. If your site sends a strict Content-Security-Policy, the browser can silently block the request even though a curl test succeeds. Allow https://api.snapitforms.com in connect-src so fetch is permitted, and in form-action if you use a native form POST. After adding those directives the submission goes through.
Yes. The free plan includes 500 submissions per month, unlimited forms, email notifications, spam filtering and file uploads, with no credit card required. Paid plans start at $2.99 per month for 1,000 submissions if a form gets busy.