Skip to content
Sign inJoin waitlist

Forms — Metuo Next.js

The booking form of this Next.js template works as soon as you run it: “Tell us about you.” on Home, the Service page and the Contact page.

It is one form in three places, sent to one server action. It checks the e-mail, shows a spinner on its button while sending, says “Thank you” and clears the fields, keeps what the visitor typed when something fails (“Something went wrong”), and drops spam with a hidden honeypot field. It works without JavaScript too.

Out of the box, submissions are written to the server log (FORM_PROVIDER=console). That’s fine while you build, but useless once you publish, so pick a destination before launch.

  1. Copy the example settings:

    Terminal window
    cp .env.example .env.local
  2. Choose one:

    You want Set
    An email for every submission FORM_PROVIDER=resend + RESEND_API_KEY, FORM_EMAIL_TO, FORM_EMAIL_FROM
    It in your CRM, Slack, a spreadsheet, a booking tool… FORM_PROVIDER=webhook + FORM_WEBHOOK_URL (Zapier, Make, n8n, Formspree, your own API)
    The sender in a Mailchimp audience FORM_PROVIDER=mailchimp + MAILCHIMP_API_KEY, MAILCHIMP_AUDIENCE_ID

    Several at once work: FORM_PROVIDER=resend,mailchimp.

  3. Restart npm run dev and send a test from the Contact page.

  4. Put the same variables in your host’s dashboard before deploying. .env.local is not uploaded.

Details for each provider, what it receives, the webhook payload, Mailchimp consent settings and how to write your own provider are in Forms reference.

The booking form (title “New session request”):

Field Name it arrives under Required
First Name (placeholder “Jane”) first-name
Last Name (“Smith”) last-name
Email (“jane@example.com”) email yes, and it must look like an e-mail address
Phone (“(+123)45678910”) phone
Preferred session type: a checkbox per service service (a list of the ticked services)
Preferred Date date (YYYY-MM-DD)
Preferred Time time (HH:MM, 24-hour)
What would you like support with? message

The labels sit above the fields. First and Last Name, Email and Phone, Date and Time sit side by side from tablets up (one under the other on phones); the session types and the message take a full row, then the Submit button. When the e-mail is empty or isn’t an address, the field gets the focus and shows “Please enter a valid email address.” The date and time are the browser’s own pickers.

The session types are the names of the services in src/content/collections/services.ts: add, rename or remove a service and the checkboxes follow. The visitor can tick several or none.

Resend puts the sender’s first and last name after the title in the email’s subject (“New session request — Jane Smith”) and sets the reply address to the sender’s e-mail. Mailchimp stores the names as FNAME and LNAME, tags the contact with the title and keeps the rest as a note. A webhook receives every field of the form, as "" when left empty (the session types as a list, [] when none), with its label.

The intro (“Book a session”, “Take the first step toward personal growth” and its text), the form’s title (“Tell us about you.”), the labels, placeholders, the e-mail’s error message, the button’s three texts (“Submit”, “Thank you”, “Something went wrong”) and the title of each submission (notification) are content: book in src/content/pages/book.ts. A field arrives at your provider under its name, so keep the names you already map somewhere. The trust line, the rating, the e-mail line and the social icons beside the form come from src/content/pages/shared.ts (Editing the content).

The server action (sendBooking in src/lib/actions-book.ts) sends every field listed in book.form.fields and checks the required ones again on the server, so the list in the copy is the place to edit:

  • To make a field required, set required: true on it and give it an error message. The browser checks it before sending and the server checks it again. No asterisk is shown: say it in the label if you want one. A required field must be on the page: if it is only in the list, every submission fails.

  • To add a field, add an entry, for example the visitor’s city:

    city: { name: "city", label: "City", placeholder: "London", autoComplete: "address-level2" },

    The types are text (the default), email, tel, date, time, textarea and checkboxes (with options). The fields are laid out by hand, so also place it in the form: <FormField {...fields.city} /> in src/components/sections/BookSection.tsx (add className="md:col-span-2" for a full-width one).

  • To remove a field, delete its entry and its <FormField … /> line. Keep the e-mail: every provider needs it.

  • Don’t give a real field the name fax: it is the honeypot’s (Spam).

  • Submit the form on your own site after deploying, with a real address.
  • Check the destination (inbox, spreadsheet, audience) and reply to the test.
  • Try a failure on purpose: set a wrong API key, submit, and confirm the visitor sees “Something went wrong” and their text is still there.

The honeypot stops the usual bots: the form carries a hidden field named fax that a person never sees; a bot that fills it is shown “Thank you” and nothing is sent. If you start getting spam anyway, put a service in front through the webhook provider (Formspree, Web3Forms and Basin all include spam filtering), or add a captcha to the form component.

Submissions go only where you point them; nothing is sent anywhere else. People who book a session may tell you about their health and their difficulties, which many countries treat as sensitive data: say what happens to it in your privacy policy (src/content/collections/legal.ts), keep the destination secure, and check what your profession’s rules ask of you. The form has no consent checkbox: add one if your visitors’ country requires it.

The form doesn’t ask for marketing consent, so if you send it to Mailchimp, keep MAILCHIMP_STATUS at transactional (the default): those contacts can get your replies, not your campaigns.