Home / Form backend for Svelte

Form backend for Svelte

Handle form submissions in Svelte and SvelteKit with zero backend code.

Svelte's simplicity extends to forms — but sending that data somewhere still requires a backend. Unless you use LazyForms. Point your Svelte form at our endpoint and get submissions in your email, dashboard, and Google Sheets.

How it works

  1. 1

    Create a free LazyForms endpoint.

  2. 2

    Build your Svelte form with bound variables.

  3. 3

    POST to the LazyForms URL on submit.

  4. 4

    Done. Submissions are in your inbox.

Code example

<script>
  let name = ''
  let email = ''
  let message = ''
  let status = 'idle'

  async function handleSubmit() {
    status = 'sending'

    const res = await fetch('https://api.lazyforms.com/f/YOUR_ACCESS_KEY', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ name, email, message }),
    })

    status = res.ok ? 'sent' : 'error'
    if (res.ok) { name = ''; email = ''; message = '' }
  }
</script>

<form on:submit|preventDefault={handleSubmit}>
  <input bind:value={name} type="text" placeholder="Name" required />
  <input bind:value={email} type="email" placeholder="Email" required />
  <textarea bind:value={message} placeholder="Message" required />
  <button type="submit" disabled={status === 'sending'}>
    {status === 'sending' ? 'Sending...' : 'Send'}
  </button>
  {#if status === 'sent'}<p>Sent!</p>{/if}
</form>

Tips

  • Svelte's bind:value gives you reactive form state with zero boilerplate.
  • In SvelteKit, you can also use form actions — but for simple forms, direct fetch is easier.
  • LazyForms handles CORS, so client-side fetch works from any domain.

What you get

Email notifications on every submission
Web dashboard to browse and export data
Google Sheets integration
Webhook support for automation
Spam protection (honeypot + Turnstile)
Unlimited forms and submissions

Start collecting Svelte form submissions

Enter your email to get your form endpoint. Free forever.

Enter your email to receive your form action URL · No password needed