Go live
Forms
Make the contact, booking and newsletter forms send real messages.
Your template's forms (in the Spa template: booking, contact and newsletter) are fully designed and check what visitors type. To receive the messages, you connect each form to a form service.
Demo mode
Until you connect a form, it runs in demo mode: it shows a thank-you message but sends nothing. This lets you test the design safely.
Connect a form
Create a form with a form service
Sign up for a form service that accepts JSON submissions and emails them to you. For example, Formspree has a free plan. Create one form for each form on your site and copy its address, which looks like
https://formspree.io/f/abcd1234.Create a .env.local file
In the main template folder (next to
package.json), create a new file named.env.localand add your form addresses:.env.localNEXT_PUBLIC_BOOKING_ENDPOINT=https://formspree.io/f/your-booking-formNEXT_PUBLIC_CONTACT_ENDPOINT=https://formspree.io/f/your-contact-formNEXT_PUBLIC_NEWSLETTER_ENDPOINT=https://formspree.io/f/your-newsletter-formLeave out any line you do not need. To see the exact names your template uses, open
src/config/site.tsand look at forms.Restart and test
Stop the website (Ctrl + C) and start it again with
npm run dev. Fill in each form and check the message arrives in your inbox.Add the same settings to your hosting
The
.env.localfile stays on your computer. When you publish, add the same names and values as environment variables in your hosting dashboard, then redeploy. See Publish your website.
What the forms send
Each form sends the fields the visitor filled in (name, email, message, chosen service and so on) as JSON to your address. Most form services show these fields neatly in the email they send you.
Turn a form off
Do not need a newsletter or a booking form? Switch it off in src/config/features.ts. See Feature switches.