> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crunchforms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Svelte & SvelteKit contact form without a backend

> Add a contact form to a Svelte or SvelteKit site — including adapter-static builds — with no server endpoint. Submissions and spam filtering via Crunchforms.

SvelteKit form actions need a server — which `adapter-static` sites don't have. Pointing your form at a Crunchforms endpoint keeps the whole site static while the form still works.

## Before you start: create your endpoint

Every guide on this page needs a Crunchforms form ID. Getting one takes about two minutes:

1. [Sign up free](https://crunchforms.com/auth/signup) — 1,000 submissions a month included, no credit card required.
2. In your [dashboard](https://crunchforms.com/dashboard), click **New Form**, give it a name, and pick a response type: **Redirect** for classic form posts (the visitor lands on your thank-you page), or **JSON** if you'll submit with JavaScript and handle the response yourself.
3. Your endpoint is `https://crunchforms.com/form/{formID}` — copy it with the **Copy Action URL** button, or use the dashboard's snippet generator.

The [quickstart](https://docs.crunchforms.com/quickstart.md) covers this in more detail.

## Option 1: plain form post

Set the form's response type to **Redirect** and let the browser do the work:

```html +page.svelte theme={null}
<form action="https://crunchforms.com/form/{formID}" method="post">
  <label for="email">Email</label>
  <input name="email" type="email" id="email" required />

  <label for="message">Message</label>
  <textarea name="message" id="message" rows="5" required></textarea>

  <button type="submit">Send</button>
</form>
```

## Option 2: fetch with a JSON response

Set the response type to **JSON** for inline feedback:

```html +page.svelte theme={null}
<script>
  let status = $state('idle'); // idle | sending | sent | error

  async function handleSubmit(e) {
    e.preventDefault();
    status = 'sending';
    const data = Object.fromEntries(new FormData(e.target));
    try {
      const res = await fetch('https://crunchforms.com/form/{formID}', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(data),
      });
      const result = await res.json();
      status = result.success ? 'sent' : 'error';
    } catch {
      status = 'error';
    }
  }
</script>

{#if status === 'sent'}
  <p>Thanks — we'll be in touch!</p>
{:else}
  <form onsubmit={handleSubmit}>
    <label for="email">Email</label>
    <input name="email" type="email" id="email" required />

    <label for="message">Message</label>
    <textarea name="message" id="message" rows="5" required></textarea>

    <button type="submit" disabled={status === 'sending'}>
      {status === 'sending' ? 'Sending…' : 'Send'}
    </button>
    {#if status === 'error'}<p role="alert">Something went wrong — please try again.</p>{/if}
  </form>
{/if}
```

(Using Svelte 4? Replace `$state('idle')` with a plain `let status = 'idle'` and `onsubmit` with `on:submit|preventDefault`.)

## Stop the spam before it starts

Every public form gets found by bots eventually. Crunchforms filters submissions server-side on **every plan, including Free**:

> [card] [Honeypot](https://docs.crunchforms.com/advanced/honeypot.md)
>
> A hidden field humans never see — if it's filled, the submission is rejected. Zero friction for real visitors.

> [card] [Cloudflare Turnstile](https://docs.crunchforms.com/advanced/turnstile.md)
>
> Invisible bot detection. Add the widget to your form and Crunchforms validates the token server-side.

> [card] [reCAPTCHA v3](https://docs.crunchforms.com/advanced/recaptcha.md)
>
> Score-based validation with a threshold you control per form.

The honeypot alone stops most drive-by spam and takes one extra line of markup — enable it in your form's settings, then include the hidden field in your form.

## Troubleshooting

> [accordion] The form posts, but nothing shows in my dashboard
>
> * Check the form is set to **Active** in your dashboard.
> * If you've enabled Turnstile or reCAPTCHA on the form, submissions without a valid token are rejected — including your own tests.
> * Check you haven't exceeded your plan's monthly submission quota.

> [accordion] The visitor isn't redirected after submitting
>
> Set the form's response type to **Redirect** and provide a success URL (and a failure URL) in the form settings. If you're submitting with JavaScript, use the **JSON** response type instead and navigate in your code.

> [accordion] Submitting with fetch/XHR fails
>
> The endpoint accepts cross-origin requests, JSON bodies (`Content-Type: application/json`), and classic URL-encoded form bodies. Set the form's response type to **JSON** so your code gets `{ "success": true }` back instead of a redirect.

> [accordion] I want to test without deploying my site
>
> Use the **Send Test Submission** action next to your form in the dashboard — it posts a sample submission to your live endpoint so you can see the pipeline working end to end.

## Next steps

> [card] [Form configuration](https://docs.crunchforms.com/form-config.md)
>
> Response types, notification emails, daily summaries, and more

> [card] [Free HTML form templates](https://crunchforms.com/templates)
>
> Contact, feedback, RSVP, job application, waitlist, and survey forms ready to paste

> [card] [What is a form backend?](https://crunchforms.com/what-is-a-form-backend)
>
> Why a static site needs one, and what to look for when choosing between them

> [card] [Compare the alternatives](https://crunchforms.com/alternatives)
>
> Crunchforms against Formspree, Web3Forms, and Netlify Forms — including where they win

> [card] [Pricing](https://crunchforms.com/pricing)
>
> 1,000 submissions a month free, then \$5/mo for 10,000. No credit card to start

> [card] [Stop form spam](https://docs.crunchforms.com/advanced/spam.md)
>
> Honeypot, Turnstile, and reCAPTCHA v3 — included on every plan, Free included

## Need help?

> [card] [Get Support](https://crunchforms.com/support)
>
> Send us a note — we read everything.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.