EF Computing

Eric's Inventions

Introducing Formstar: Simple, Serverless Form Processing

In the past, when I needed to host "static" sites - those that do not rely on server-side functionality like login sessions but instead rely fully on visitors' browsers (client-side) for rendering and interactivity - I looked to traditional web hosting providers, sometimes for a monthly cost for larger projects. These providers generally come with a Linux environment configured with a certain amount of CPU and memory, the Apache web server, and some other utilities (often the ubiquitous cPanel for managing various resources via a graphical control panel, PHP built into the Apache server, and the option of a MySQL database).

Naturally, I was mostly drastically underutilizing the resources these providers had to offer (unless, of course, I was hosting an Oxwall install; yes, it has been a while, but there's much more to come inmy series about fixing Oxwall up!). My mostly- or entirely-static sites primarily used visitors' browsers rendering and JavaScript engines to deliver their content, and any server-side capabilities I may have implemented with PHP, such as rendering menus in certain ways, could easily be replaced by static site generation facilitated by various modern JavaScript frameworks like Next.js, Gatsby, and SvelteKit. As a result, in early 2022, I decided to make a change, transitioning the site for my small, local web design/development consultancy, EF Computing, from a set of PHP files served by a traditional web hosting provider to a set of static assets statically generated by the Gatsby framework (React-based), hosted on Cloudflare Pages at no cost. I no longer have to worry about CPU, memory, or bandwidth limits, clunky delivery of updates via FTP, or server security.

But one common use case that exists for many sites like that of EF Computing still requires server-side functionality, even with the elegance of static site generation: form processing. Though web forms can be very simple - EF Computing's requires only the visitor's name, email address, and a message - their backends must take several steps to process submissions:

  • Reject spam. Even if your site hasn't received much traffic, spammers will find it. The most effective tool to fight spam is the infamous CAPTCHA, provided by services like Google's reCAPTCHA.

  • Optionally validate fields' data. Though you can use at least modern HTML to have browsers automatically do this on the client side, the first rule of web development is never to trust the client side due to how anyone can manipulate it and bypass its defenses. As a result, the server side should be the ultimate source of truth for validation.

  • Take action on valid submissions. Most often, a form backend should send you an email with the contents of the submission to notify you when someone filled out your form.

Implementing these steps efficiently, securely, and cost-effectively can be cumbersome, especially if you have a static site with no backend (or multiple!). Today, I'd like to introduce you to Formstar, an open-source project designed to make form processing simple, even for static sites. All you need is a Google Account and to follow the instructions on the Github repository.

Built atop the Google Workspace suite of apps (specifically Google Apps Script) and forked from another open-source project, Formstar's API can filter out spam using either reCAPTCHA or Cloudflare's less frustrating Turnstile (no more selecting pictures with traffic lights!) and email you only valid submissions, but it will also save submissions to a Google Sheet of your choice within your Google Account, providing a private, long-lived record beyond your inbox, fully owned by you.

Formstar is free for use within Google Apps Script. Given that Google Apps Script currently limits scripts to sending 100 emails per day as of this writing, Formstar's quotas are still significantly higher than that of other form backend services such as Formspree, whose free plan is limited to 50 submissions per month.

I built Formstar to address my own needs for form processing on static sites - EF Computing's form has already switched over to it and Cloudflare Turnstile for spam protection - so I hope it will help suit your form needs as well.