Docs / Next.js

A Next.js contact form without an API route

You don't need app/api/contact/route.ts, a mail SDK, or SMTP credentials in your deployment. The form posts from the client straight to your conForm endpoint — which also means it keeps working under output: 'export' static builds.

1 — Create the endpoint

curl https://api.conform.centrst.com/v1/routes \
  -H 'Content-Type: application/json' \
  -d '{"email":"[email protected]","alias":"Contact"}'

2 — Fetch the client component

curl 'https://api.conform.centrst.com/v1/routes/YOUR_FORM_ID/install?framework=nextjs&raw=1' > app/components/ContactForm.jsx

The artifact is the React component with 'use client' prepended. Render it from any server or client page:

import ContactForm from '@/app/components/ContactForm';

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

3 — Verify and prove

Confirm the verification email in the destination inbox, then send a marked test submission:

curl -sS -X POST https://api.conform.centrst.com/f/cfm_7K4P9X2M8RWD3JNH \
  -d 'name=Test&[email protected]&message=Hello from a test&_test=true'
No secrets touch your repo or your Vercel/Cloudflare env: the endpoint is public by design, rate-limited, and delivers only to the verified inbox.