Skip to main content
This guide uses Svelte 5 ($state and the onsubmit attribute), which is what new SvelteKit projects create.

1. Save your Public Key

Copy the Public Key from the Endpoint form’s General tab and add it to .env in your project root:
.env
SvelteKit only exposes variables that start with PUBLIC_ to browser code. The key is safe to expose; it can only add responses to this form.

2. Create the page

src/routes/contact/+page.svelte
Open /contact, send a test response, and check Submissions.

Good to know

  • On Svelte 4, replace $state(...) with plain let variables and use on:submit={onsubmit} instead of {onsubmit}.
  • This is a client-side request, so you do not need a +server.ts endpoint or a form action.
  • Restart vite dev after editing .env.
  • If you enable domain restriction, allow localhost while you develop.