All frameworks
AstroAstro

Use NBForms with Astro

Astro ships zero JavaScript by default, making form handling a common challenge. NBForms gives your Astro contact form a full backend — email notifications, spam protection, and a submissions dashboard — with just a small inline script.

Official Astro docs
Astro
---
---

<form id="nbform" action="https://api.nbforms.com" method="POST">
  <input type="hidden" name="_token" value="YOUR_TOKEN" />
  <label>Name</label>
  <input type="text" name="name" required />
  <label>Email</label>
  <input type="email" name="email" required />
  <label>Message</label>
  <textarea name="message" required></textarea>
  <button type="submit">Send</button>
  <p id="nbsuccess" hidden></p>
</form>

<script>
  const form = document.getElementById('nbform')
  form.addEventListener('submit', async (e) => {
    e.preventDefault()
    const res = await fetch(form.action, { method: 'POST', body: new FormData(form) })
    const data = await res.json()
    if (res.ok) {
      form.hidden = true
      const p = document.getElementById('nbsuccess')
      p.textContent = data.message ?? 'Thanks!'
      p.hidden = false
    }
  })
</script>

Why NBForms?

  • Works with Astro's island architecture
  • Tiny inline script for AJAX feedback — no framework or bundler needed
  • Compatible with Astro SSG, SSR, and hybrid rendering modes
  • No API endpoints or server middleware required

Add to your Astro app in minutes

Free tier included. No credit card. No backend setup — just copy the snippet above and go.

Get started free