Add a working contact form to SvelteKit using FormsList.
TL;DR
Add a contact form to SvelteKit by creating a Svelte component with bind:value and submitting to a FormsList endpoint. No +server.ts file needed. FormsList handles the backend, spam protection, and notifications.
Sign up at formslist.com and create a form.
Create a Svelte component with reactive state.
<script>
let name = $state('')
let email = $state('')
let message = $state('')
let submitted = $state(false)
async function handleSubmit(e) {
e.preventDefault()
const res = await fetch('https://formslist.com/f/YOUR_HASH', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ name, email, message }),
})
if (res.ok) submitted = true
}
</script>
{#if submitted}
<p>Thanks! We'll be in touch.</p>
{:else}
<form onsubmit={handleSubmit}>
<input bind:value={name} placeholder="Name" required />
<input bind:value={email} type="email" placeholder="Email" required />
<textarea bind:value={message} placeholder="Message" required />
<button type="submit">Send</button>
</form>
{/if}Use the component in any +page.svelte file.
Deploy to Vercel or Netlify and test.
No. The form submits directly to FormsList. No server-side code needed.
Yes. Replace $state() with let variables. The fetch call is identical.
You can, but submitting directly to FormsList via fetch is simpler.
200 free submissions a month and a live endpoint in 30 seconds. No server, no credit card, just point your form at it.