Formstorkdocs
PricingENTRDashboard

SvelteKit

SvelteKit works with the @formstork/svelte store inside any route component. The store wires up the submit handler, loading flag, and success state, so your form works with almost no code.

Install

npm install @formstork/svelte

Client-side form

The simplest setup lives entirely in a +page.svelte route.

<!-- src/routes/contact/+page.svelte -->
<script>
  import { createFormstork } from "@formstork/svelte";

  const { submit, isSubmitting, isSuccess, message } = createFormstork({
    accessKey: "YOUR_ACCESS_KEY",
  });
</script>

{#if $isSuccess}
  <p>Thanks, {$message}</p>
{:else}
  <form on:submit={submit}>
    <input type="text" name="name" required />
    <input type="email" name="email" required />
    <textarea name="message" required></textarea>
    <button disabled={$isSubmitting}>
      {$isSubmitting ? "Sending..." : "Send"}
    </button>
  </form>
{/if}

The store reads every named field, adds the hidden access_key, and posts to Formstork for you. Read the Svelte stores it returns with the $ prefix.

Server-side form action

Prefer to keep the request off the client? Post to the endpoint from a form action instead.

// src/routes/contact/+page.server.js
export const actions = {
  default: async ({ request }) => {
    const data = await request.formData();
    data.append("access_key", "YOUR_ACCESS_KEY");
    await fetch("https://api.formstork.com/submit", {
      method: "POST",
      body: data,
      headers: { Accept: "application/json" },
    });
    return { success: true };
  },
};

Pair it with a plain <form method="POST"> in your +page.svelte.

Step by step

  1. Sign up at app.formstork.com and copy your free access key from the dashboard.
  2. Run npm install @formstork/svelte.
  3. Create a route such as src/routes/contact/+page.svelte.
  4. Add the <script> above and swap YOUR_ACCESS_KEY for your real key.
  5. Give every input a name; those become the fields you receive.
  6. Use $isSubmitting for the button state and $isSuccess for the thank-you message.
  7. For a server-side flow, add the +page.server.js action and a method="POST" form.

Submissions land in your dashboard. The free plan covers 250 a month.