<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Felice Cesarano</title>
    <description>The latest articles on DEV Community by Felice Cesarano (@felice_cesarano).</description>
    <link>https://dev.to/felice_cesarano</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4266588%2Ff8db8ac2-9b4d-4367-826f-e876aace08ca.png</url>
      <title>DEV Community: Felice Cesarano</title>
      <link>https://dev.to/felice_cesarano</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felice_cesarano"/>
    <language>en</language>
    <item>
      <title>How to add a contact form to an Astro site without a backend</title>
      <dc:creator>Felice Cesarano</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:37:37 +0000</pubDate>
      <link>https://dev.to/felice_cesarano/how-to-add-a-contact-form-to-an-astro-site-without-a-backend-3158</link>
      <guid>https://dev.to/felice_cesarano/how-to-add-a-contact-form-to-an-astro-site-without-a-backend-3158</guid>
      <description>&lt;h1&gt;
  
  
  How to add a contact form to an Astro site without a backend
&lt;/h1&gt;

&lt;p&gt;Static sites are fast, cheap, and easy to deploy. But they don't have a server to receive form submissions.&lt;/p&gt;

&lt;p&gt;If you're building a portfolio, landing page, documentation site, or small business website with Astro, you eventually need a way to handle contact forms without setting up and maintaining your own backend.&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll build a working contact form using Web3Forms, then look at some alternatives and their trade-offs.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The easiest solution: Web3Forms
&lt;/h2&gt;

&lt;p&gt;Web3Forms lets you submit form data to an endpoint without creating your own server.&lt;/p&gt;

&lt;p&gt;Its free plan currently offers a limited monthly submission allowance, making it useful for small projects and personal websites.&lt;/p&gt;

&lt;h3&gt;
  
  
  Get your access key
&lt;/h3&gt;

&lt;p&gt;Visit &lt;a href="https://web3forms.com/" rel="noopener noreferrer"&gt;Web3Forms&lt;/a&gt; and generate an access key.&lt;/p&gt;

&lt;p&gt;You don't need to create a traditional backend. The key is used to identify your form submissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create the Astro component
&lt;/h2&gt;

&lt;p&gt;Create a file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/components/ContactForm.astro&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
---

&amp;lt;form id="contact-form"&amp;gt;
  &amp;lt;input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" /&amp;gt;
  &amp;lt;input type="hidden" name="subject" value="New contact form submission" /&amp;gt;

  &amp;lt;!-- Honeypot field --&amp;gt;
  &amp;lt;input
    type="checkbox"
    name="botcheck"
    class="hidden"
    style="display: none;"
    tabindex="-1"
    autocomplete="off"
  /&amp;gt;

  &amp;lt;label for="name"&amp;gt;Name&amp;lt;/label&amp;gt;
  &amp;lt;input type="text" id="name" name="name" required /&amp;gt;

  &amp;lt;label for="email"&amp;gt;Email&amp;lt;/label&amp;gt;
  &amp;lt;input type="email" id="email" name="email" required /&amp;gt;

  &amp;lt;label for="message"&amp;gt;Message&amp;lt;/label&amp;gt;
  &amp;lt;textarea id="message" name="message" required rows="5"&amp;gt;&amp;lt;/textarea&amp;gt;

  &amp;lt;button type="submit"&amp;gt;Send message&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;p id="form-result" role="status" aria-live="polite"&amp;gt;&amp;lt;/p&amp;gt;

&amp;lt;script&amp;gt;
  const form = document.getElementById('contact-form');
  const result = document.getElementById('form-result');

  form.addEventListener('submit', async (e) =&amp;gt; {
    e.preventDefault();
    result.textContent = 'Sending…';

    const formData = new FormData(form);
    const payload = Object.fromEntries(formData);

    try {
      const response = await fetch('https://api.web3forms.com/submit', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json'
        },
        body: JSON.stringify(payload)
      });

      const data = await response.json();

      if (data.success) {
        result.textContent = 'Message sent successfully!';
        form.reset();
      } else {
        result.textContent =
          data.message || 'Something went wrong. Please try again.';
      }
    } catch (error) {
      result.textContent = 'Network error. Please try again later.';
    }
  });
&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
  .hidden {
    display: none;
  }

  form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 480px;
  }

  label {
    font-weight: 600;
    font-size: 0.9rem;
  }

  input,
  textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
  }

  button {
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: #0070f3;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
  }

  button:hover {
    filter: brightness(1.1);
  }

  #form-result {
    margin-top: 0.5rem;
    font-size: 0.9rem;
  }
&amp;lt;/style&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;YOUR_ACCESS_KEY&lt;/code&gt; with the key generated on Web3Forms.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Use the component on a page
&lt;/h2&gt;

&lt;p&gt;For example, in &lt;code&gt;src/pages/contact.astro&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
import ContactForm from '../components/ContactForm.astro';
---

&amp;lt;section&amp;gt;
  &amp;lt;h1&amp;gt;Contact us&amp;lt;/h1&amp;gt;
  &amp;lt;ContactForm /&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. No server-side code is required for this implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. How it works
&lt;/h2&gt;

&lt;p&gt;The form collects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name&lt;/li&gt;
&lt;li&gt;Email&lt;/li&gt;
&lt;li&gt;Message&lt;/li&gt;
&lt;li&gt;Access key&lt;/li&gt;
&lt;li&gt;Subject&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the visitor submits the form:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JavaScript prevents the default form submission.&lt;/li&gt;
&lt;li&gt;The form data is converted into a JSON payload.&lt;/li&gt;
&lt;li&gt;The payload is sent to the Web3Forms API.&lt;/li&gt;
&lt;li&gt;The response is checked.&lt;/li&gt;
&lt;li&gt;A success or error message is displayed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The hidden honeypot field can help catch bots that automatically fill out every field.&lt;/p&gt;

&lt;h3&gt;
  
  
  A few things to keep in mind
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The access key is public in frontend code by design.&lt;/li&gt;
&lt;li&gt;Domain restrictions and additional configuration may be available through the provider.&lt;/li&gt;
&lt;li&gt;Free plans have submission limits.&lt;/li&gt;
&lt;li&gt;File uploads and more advanced spam protection may require paid features.&lt;/li&gt;
&lt;li&gt;For production projects, remember to consider privacy requirements and explain how submitted data is handled.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. What are the alternatives?
&lt;/h2&gt;

&lt;p&gt;There are several form backend services available. Each has different limits, pricing, integrations, and spam protection options.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Free plan&lt;/th&gt;
&lt;th&gt;Main advantage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Netlify Forms&lt;/td&gt;
&lt;td&gt;Limited/credit-based&lt;/td&gt;
&lt;td&gt;Convenient if you're already hosting on Netlify&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web3Forms&lt;/td&gt;
&lt;td&gt;Free monthly submissions&lt;/td&gt;
&lt;td&gt;Simple setup and no traditional backend&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;StaticForms&lt;/td&gt;
&lt;td&gt;Free submission allowance&lt;/td&gt;
&lt;td&gt;Straightforward integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Formspree&lt;/td&gt;
&lt;td&gt;Limited monthly submissions&lt;/td&gt;
&lt;td&gt;Mature ecosystem and integrations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Formspark&lt;/td&gt;
&lt;td&gt;Limited free usage&lt;/td&gt;
&lt;td&gt;Simple forms and developer-focused workflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloudflare Workers&lt;/td&gt;
&lt;td&gt;Generous platform free tier&lt;/td&gt;
&lt;td&gt;Maximum control if you build your own endpoint&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Pricing and limits can change, so check the providers' official pricing pages before choosing a service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify Forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web3forms.com/" rel="noopener noreferrer"&gt;Web3Forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://staticforms.xyz/" rel="noopener noreferrer"&gt;StaticForms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://formspree.io/" rel="noopener noreferrer"&gt;Formspree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://formspark.io/" rel="noopener noreferrer"&gt;Formspark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://workers.cloudflare.com/" rel="noopener noreferrer"&gt;Cloudflare Workers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. The problem I'm exploring
&lt;/h2&gt;

&lt;p&gt;While looking at these options, I noticed a recurring pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free tiers can be restrictive for projects that start receiving traffic.&lt;/li&gt;
&lt;li&gt;Pricing can increase significantly when additional features are needed.&lt;/li&gt;
&lt;li&gt;Advanced spam protection, integrations, and file uploads are often limited to higher plans.&lt;/li&gt;
&lt;li&gt;Developers sometimes need something much simpler than a full backend.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm currently researching a concept for a simpler form backend with a higher free tier and transparent pricing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No product exists yet — this is a validation experiment.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  I'm exploring the idea here:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://rococo-granita-2145a9.netlify.app/?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=formbackend&amp;amp;utm_content=astro_tutorial" rel="noopener noreferrer"&gt;Form Backend — a simpler form backend for static sites&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The concept is focused on a simple endpoint, email or webhook delivery, spam filtering, and a developer-friendly experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. I'd love to hear from other developers
&lt;/h2&gt;

&lt;p&gt;If you use forms on static websites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which form backend are you currently using?&lt;/li&gt;
&lt;li&gt;What frustrates you most about existing services?&lt;/li&gt;
&lt;li&gt;Would a higher free tier and simpler pricing be useful?&lt;/li&gt;
&lt;li&gt;Would you pay around $5–9/month for a service like this?&lt;/li&gt;
&lt;li&gt;Which features matter most: spam filtering, file uploads, webhooks, integrations, or analytics?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm interested in real experiences and feedback before deciding whether this concept is worth building.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Disclosure:&lt;/strong&gt; This post is part of a validation experiment. No product exists yet, no features are available, and the pricing mentioned is hypothetical. The landing page is for research purposes only.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://web3forms.com/" rel="noopener noreferrer"&gt;Web3Forms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.web3forms.com/" rel="noopener noreferrer"&gt;Web3Forms API documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://staticforms.xyz/" rel="noopener noreferrer"&gt;StaticForms pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://formspree.io/" rel="noopener noreferrer"&gt;Formspree pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://workers.cloudflare.com/" rel="noopener noreferrer"&gt;Cloudflare Workers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://formspark.io/" rel="noopener noreferrer"&gt;Formspark&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>astro</category>
      <category>webdev</category>
      <category>frontend</category>
      <category>jamstack</category>
    </item>
  </channel>
</rss>
