Forms — Goeboek Next.js
The three forms of this Next.js template work as soon as you run it: the contact form on the Contact page, “Schedule tour” on every property page and the Add property form.
Each is sent to a server action in src/lib/actions.ts (submitContact, submitTour, submitProperty). All three check the fields in the browser and again on the server, show a spinner on the button while sending, then “Thank you” or “Something went wrong”, and drop spam with a hidden honeypot field. On success the fields are cleared; on an error the form keeps what the visitor typed. Once sent, the tour form opens /success-scheduled and the Add property form /success-add-property, as in the original design; the contact form keeps the visitor on the page.
Out of the box, every submission is 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. The full reference — every variable, what each
provider receives, adding your own — is Forms reference.
The quickest way to receive submissions
Section titled “The quickest way to receive submissions”-
Copy the example settings:
Terminal window cp .env.example .env.local -
Choose one:
You want Set An email for every message, tour request and listing FORM_PROVIDER=resend+RESEND_API_KEY,FORM_EMAIL_TO,FORM_EMAIL_FROMThe senders in a Mailchimp audience FORM_PROVIDER=mailchimp+MAILCHIMP_API_KEY,MAILCHIMP_AUDIENCE_ID, andMAILCHIMP_STATUS(below)It in a CRM, a spreadsheet, Slack… FORM_PROVIDER=webhook+FORM_WEBHOOK_URL(Zapier, Make, n8n, Formspree, your own API);FORM_WEBHOOK_SECRETis optionalSeveral at once work:
FORM_PROVIDER=resend,mailchimp. The setting applies to all three forms. -
Restart
npm run devand send a test from each form. -
Put the same variables in your host’s dashboard before deploying.
.env.localis not uploaded.
The providers
Section titled “The providers”The providers are in src/lib/forms/providers/, one file each, and FORM_PROVIDER picks them by name
(src/lib/forms/providers/index.ts).
FORM_PROVIDER |
What happens | Variables |
|---|---|---|
console (default, also when the variable is missing) |
Printed to the server log. For development. | — |
resend |
Emails each submission through Resend, with the form’s title and the sender’s name as the subject (“New tour request — Jane Smith”) and the sender’s address as the reply address. | RESEND_API_KEY; FORM_EMAIL_TO (one address or several, comma-separated); FORM_EMAIL_FROM, a sender on a domain you verified in Resend, e.g. Goeboek <forms@yourdomain.com> |
mailchimp |
Adds or updates the sender in a Mailchimp audience, tags them with the form’s title and keeps the submission as a note on their profile. | MAILCHIMP_API_KEY (it ends in your data centre, e.g. -us21), MAILCHIMP_AUDIENCE_ID, MAILCHIMP_STATUS |
webhook |
Posts the submission as JSON to a URL. | FORM_WEBHOOK_URL; FORM_WEBHOOK_SECRET, sent as Authorization: Bearer <secret> |
When one of several providers fails, the visitor sees “Something went wrong” and the reason is logged; the others have
usually delivered already, so sending again can arrive twice. Another service (Postmark, Brevo, HubSpot, a database…):
copy one of the files, change the request, and add it to providers in index.ts under a new name
(Forms reference).
What the forms send
Section titled “What the forms send”Each submission carries the form’s name (form) and a title (title), then the fields under their name:
| Form | form |
Title | Fields (name) |
Required |
|---|---|---|---|---|
| Contact (Contact page) | contact |
“New contact enquiry” | name, email, message |
name, email |
| Schedule tour (every property page) | tour |
“New tour request” | propertyId and propertyName (filled in from the property), name, email, phone, message |
all but message |
| Add property (Add property page) | property |
“New property submission” | name, email, phone; propertyName, location and category (radios), for (Sell / Rent), price, duration (/Days, /Months, /Years); size, bedrooms, bathrooms, floor, additionalSpace, furnishing, ceilingHeight, constructionYear, renovation (dates as YYYY-MM-DD); heating, airCondition, fireplace, elevator, ventilation, intercom, windowType, cableTv, wifi; message |
the personal fields, propertyName, for, price, duration and the details but renovation |
The e-mail field must look like an e-mail address. A webhook receives, for a tour request:
{ "form": "tour", "title": "New tour request", "submittedAt": "2026-11-02T10:48:23.256Z", "data": { "propertyId": "55W886", "propertyName": "South Sunlight Apartment", "name": "Jane Smith", "email": "jane@example.com", "phone": "+1 555 000 0000", "message": "Could I see it on Saturday morning?" }, "labels": { "propertyId": "Property ID", "propertyName": "Property Name", "name": "Name", "email": "Email", "phone": "Phone", "message": "Message" }}data has a key for every field, in the order of the form, and labels the label of each; a field left empty is "".
Resend’s email lists every filled field as “Label: value”, and the reply goes to the address typed in the form.
Mailchimp and consent
Section titled “Mailchimp and consent”MAILCHIMP_STATUS decides what you may send to the people the forms add: transactional (the default) stores the
contact but they can’t receive your campaigns, pending sends them a confirmation e-mail first (double opt-in), and
subscribed is only for addresses that gave explicit consent. None of the three forms asks for marketing consent, so
keep transactional unless you add a consent checkbox.
The name field fills the audience’s first name (FNAME) and phone its PHONE, through mergeFields at the top of
src/lib/forms/providers/mailchimp.ts; the rest is kept in the note. Change the map if your audience uses other tags. To
keep tour requests or listings out of Mailchimp, use Resend or a webhook for them, or check submission.form in the
provider.
Changing the forms
Section titled “Changing the forms”The words and fields of each form are content:
| Form | Where | What is there |
|---|---|---|
| Contact | form in src/content/pages/contact.ts |
The call to action beside the form (title), the three fields, the button’s label (submit) and its two messages (success, error), and the submission’s title (notification) |
| Schedule tour | tour in src/content/pages/property.ts |
The block’s title and text, the six fields, the button’s texts, the submission’s title and the page it opens once sent (redirect, /success-scheduled) |
| Add property | form in src/content/pages/add-property.ts |
The five groups with their titles and fields, the button’s texts, the submission’s title and redirect (/success-add-property) |
A field has a name (the key the providers receive), a label (what people read above it, and what the notification
shows), a placeholder, a type (text, email, tel, number, date; a field with options is a select; Add
property’s Location and Property Category are radio groups) and required. The server actions read the same copy, so a
field you make optional or required there is checked that way on the server too.
- A new field: add it to the copy, then to the form’s section (
src/components/sections/ContactDetails.tsx,TourForm.tsxorAddPropertyForm.tsx) and to its list insrc/lib/actions.ts, so it is placed and delivered. - The radio choices of Add property (the five locations, the four categories) are typed in
add-property.ts, not read from the collections: when you add a location or a category, add its name there too. - The thank-you pages: their words are in
src/content/pages/success.ts. To keep the visitor on the page instead (the button then shows “Thank you”), removeredirectTo={…}from the<Form>inTourForm.tsxorAddPropertyForm.tsx; to send them elsewhere, changeredirectin the copy.
Testing before launch
Section titled “Testing before launch”- Send each form on your own site after deploying, with a real address.
- Check the destination (inbox, audience, spreadsheet), and that the tour request names the property.
- Try a failure on purpose: set a wrong API key, send, and confirm the visitor sees “Something went wrong” and the form still holds what was typed.
The honeypot stops the usual bots: each 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 use Mailchimp’s double opt-in.
Privacy
Section titled “Privacy”Submissions go only where you point them; nothing is sent anywhere else. The forms collect names, e-mail addresses, phone numbers and property details: say what happens to them in your privacy policy, keep the destination secure, and check what your country’s rules ask of you. The template has no privacy page and no consent checkbox: add them if your visitors’ country requires it (Pages and sections).