Skip to content
Formhook
← All guides

Guide

Astro contact form (no backend needed)

Astro renders to static HTML by default, which means an Astro contact form is just a plain HTML form with the right action attribute. You don't need a server endpoint or an Astro integration - paste the snippet into a .astro page and you're done.

The snippet

contact.Astro
---
// src/pages/contact.astro
---

<form action="https://formhook.app/f/YOUR_API_KEY" method="POST">
  <label>
    Email
    <input type="email" name="email" required />
  </label>

  <label>
    Message
    <textarea name="message" required></textarea>
  </label>

  <input type="text" name="_gotcha" tabindex="-1" autocomplete="off" hidden />
  <input type="hidden" name="_redirect" value="https://example.com/thanks" />

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

How it works

Show a thank-you page after submitting

Show the result without leaving the page

Allowed origins for dev, previews and production

Using it from an Astro endpoint

Spam and privacy

What happens next

  • Submission appears in your Formhook dashboard within a second.
  • Push notification fires on every device you've enabled it on.
  • Reply directly from the dashboard (Pro and above) without leaking your real email address.

Ship your Astro contact form today.

Sign up free, create a form, paste the API key. Five minutes.

Start free

Free tier: 5 forms · 250 submissions/month · No credit card.

Astro contact form - FAQ

Do I need an Astro integration or a server adapter?
No. The form POSTs to Formhook directly, so it works with the default static Astro output. No SSR mode, no @astrojs/node adapter required.
Can I have multiple contact forms across different Astro pages?
Yes. Create one Formhook form per use case - contact, careers, newsletter - and paste each form's action into the right .astro page. The Free tier covers five forms.
How do I show a thank-you page after submission?
Add a hidden _redirect input pointing at your Astro thank-you route. The URL must be on the form's allowed-origins list. Or, if you'd rather show inline success without a page reload, use the fetch pattern shown in the Next.js or SvelteKit guides.

Guides for other frameworks

Migrating from Formspree? See how Formhook compares.

Cookie preferences

We use a strictly-necessary session cookie and cookieless first-party analytics. With your consent we also run Google Analytics to understand traffic on our marketing pages.