Skip to content
Sign inJoin waitlist

Forms — Cerette Next.js

The inquiry form of this Next.js template works as soon as you run it: it is on the Contact page, on Services and at the end of every service’s page.

It 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 e-mail for every inquiry FORM_PROVIDER=resend + RESEND_API_KEY, FORM_EMAIL_TO, FORM_EMAIL_FROM
    It in your CRM, Slack, a spreadsheet… 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 (and make the e-mail required first: below)

    Several at once work: FORM_PROVIDER=resend,mailchimp.

  3. Restart npm run dev and send a test from the Contact page and from a service’s 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 form comes in two versions, both in src/content/pages/forms.ts:

  • contactForm, on Contact and Services: the project type is a list of choices. Each submission is titled “New inquiry from the Cerette website”.
  • serviceForm, on every service’s page: the project type is a text field that starts with the service’s name (“Architecture”), and the visitor can change it. Each submission is titled “New service inquiry from the Cerette website”.
Field Name it arrives under Required
Name (“Enter your full name”) name
Email (“Enter your email address”) email
Phone (“Enter your phone number”) phone
Location (“Enter project location”) location
Project type: Architecture, Construction, Interior, Planning, Renovation or Landscape (on a service’s page, a text field with the service’s name) type yes on Contact and Services
Project budget: Under $50K, $50K – $100K, $100K – $250K, $250K – $500K, $500K+ budget yes
Project details (“Tell us about your project goals, ideas, and requirements”) details

Each field shows its label above it. The two drop-downs start on an empty choice (“Select project category”, “Select estimated budget”), so the visitor has to pick one. The fields sit two by two from tablets up (Name and Email, Phone and Location, Project type and Project budget), one under the other on phones, with Project details across and the “Send Inquiry” button under them.

Only the drop-downs are required, as in the original design: a visitor can send an inquiry without a name or an e-mail. Most studios want a way to reply, so consider making email (and name) required (below).

Resend puts the sender’s name after the title in the e-mail’s subject and sets the reply address to the sender’s e-mail. Mailchimp stores the name as FNAME, 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, with its label, and the form’s name (contact or service).

The labels, placeholders, choices, the button’s three texts (“Send Inquiry”, “Thank you”, “Something went wrong”) and the title of each submission are content: contactForm and serviceForm in src/content/pages/forms.ts. The fields both versions share (name, e-mail, phone, location, budget, details) are written once at the top of the file, so a change there applies to both. A field arrives at your provider under its name, so keep the names you already map somewhere.

The server actions (submitContact in src/lib/actions-contact.ts, submitService in src/lib/actions-service.ts) send every field listed in their form’s fields and check the required ones again on the server, so the list in the copy is the place to edit:

  • To change the choices, edit options of budget, or of type in contactForm. The project types don’t come from the services collection: if you add a service, add it here too.

  • To make a field required or optional, set or remove required: true:

    const email: FormFieldSpec = { name: "email", label: "Email", type: "email", required: true, placeholder: "Enter your email address", autoComplete: "email" };

    The browser checks it before sending and the server checks it again. 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 to both forms, for example a company name:

    company: { name: "company", label: "Company", placeholder: "Your company", autoComplete: "organization" },

    The types are text (the default), email, tel, url, select (with options; the placeholder is its empty first choice) and textarea. The fields are laid out by hand, so also place it in the form: <FormField {...company} /> in src/components/sections/InquiryForm.tsx, and add company to the list the component picks at its top (const { name, email, phone, location, type, budget, details } = spec.fields). Add className="md:col-span-2" for a full-width one.

  • To remove a field, delete its entry and its line in InquiryForm.tsx.

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

The form block on Services and a service page (its title, its text and the photo beside it on desktops) is inquiry in the same file.

  • Submit both versions 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. The form collects a name, an e-mail address, a phone number, the project’s location, type, budget and details: make sure your Privacy Policy (Editing the content) says what you do with them.

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.