Stage 1
Capture
Four triggers (exit-intent, an external-link click, beforeunload, and the tab going hidden) save the fields a visitor typed before they leave, with per-visitor journey tracking and IP geolocation attached to every saved entry.
Astro integration
cool-astro-forms is an MIT-licensed Astro integration that saves a lead's typed fields the moment they leave a form without submitting. Astro and static sites have had no open-source equivalent; WordPress sites have solved this for years, but only behind a paid form-plugin addon. One npm install, one data-caf attribute per form, and a self-hosted admin UI cover it, with no external service required by default.
The problem it solves
A visitor fills in a name, an email, most of a message, then closes the tab. That lead is gone unless something saved it before they left. WordPress sites buy a premium form-plugin addon for exactly this. Astro and static sites, built for speed and simplicity, have had nothing built for the job until this package.
cool-astro-forms is a clean-room, independent implementation, not affiliated with or endorsed by any commercial form-plugin vendor. It instruments the forms already on an Astro site; it does not build form markup for you.
What it does
Every feature in the package sits inside one of five stages, from the moment a visitor types to the moment they pay.
Stage 1
Four triggers (exit-intent, an external-link click, beforeunload, and the tab going hidden) save the fields a visitor typed before they leave, with per-visitor journey tracking and IP geolocation attached to every saved entry.
A save-confirmed "progress saved" toast tells the visitor their entry is safe, and one automated follow-up email offers a link to finish.
Quote-first Stripe and PayPal payments, plus a shareable /forms-pay link the server computes the total for; a verified provider webhook is the only thing that marks a payment paid.
A password-protected /forms-admin UI lists entries, abandoned leads, and payments, with an analytics funnel and CSV plus .db export.
Google Drive uploads over raw REST, signed outbound webhooks, and Cloudflare Turnstile spam control round out the five stages.
1,102 unit tests and a Playwright end-to-end suite cover the package, and every quickstart step in its README runs end-to-end through a script that installs a real npm tarball into a scratch Astro project and hits it with a real abandon POST.
Project status
cool-astro-forms ships at v0.1.11, MIT-licensed, npm-published. 11 releases have shipped since the package's first release, 8 stars, and 250 downloads/mo as of 2026-09-01. Every one of those numbers comes from npm's own registry and GitHub's own API, not a figure written into this page by hand.
Stats as of 2026-09-01.
Versions 0.1.2 through 0.1.10 each shipped from a finding on a live services business running the package in production, not from a roadmap written in advance. The current release, v0.1.11, is the version that fix history has produced.
Who this is for
cool-astro-forms fits an Astro site already running output: 'server' with a Node adapter, Astro 6 or 7, and Node 22.12 or newer. It does not fit a fully static site with no server route to install into.
Two groups reach for it: a site owner losing leads to abandoned forms with no visibility into it, and a developer who wants the WordPress-grade lead-capture layer without buying a per-site plugin license or standing up a hosted SaaS that keeps the data off the client's own infrastructure.
How this relates to the practice
A technical SEO audit often finds a contact form quietly losing leads: a visitor starts typing, hesitates, and closes the tab, and nobody on the client's side ever knows it happened. cool-astro-forms is the shipped answer to that exact failure mode, running in production on a live services business since version 0.1.2, not a slide in a sales deck.
Building it required the same discipline the rest of this site argues for: a server that recomputes every payment total instead of trusting the client, a fetch-first checkout hop that survives an edge bot-challenge, and a database path that survives a redeploy wiping the default data directory. Lead-ops advice that has never shipped as running code is a guess dressed up as a recommendation.
Install
The commands below are verbatim from the package's own README quickstart: install, an optional scaffold step, then build and run.
npm install cool-astro-forms @astrojs/node
npx cool-astro-forms init
npm run build
node dist/server/entry.mjsTag any form with data-caf="contact" and no other markup change is needed. The capture route is auto-injected at /api/forms/abandon; a visitor who types and leaves lands a row in data/forms.db and a notification email at the address configured in astro.config.mjs. Full configuration, including the Stripe/PayPal, Drive, and Turnstile options, is in the package's own README and linked docs.
Questions
Every field a visitor typed into a tagged form before leaving, saved to SQLite the moment one of four exit triggers fires: exit-intent, an external-link click, beforeunload, or the browser tab going hidden.
No. The default install runs on a SQLite file and your existing SMTP environment variables. Payments, Google Drive uploads, and Turnstile spam control are opt-in, not required to capture a lead.
Questions about the package, or want the same lead-capture engineering on a client site?
Work with me