demo: d1 guestbook
a serverless sqlite guestbook. entries go into SITE_guestbook_db
(cloudflare d1), a per-region-primary sqlite database that ships close
to the write and replicates read-only copies globally.
data hygiene: this guestbook is auto-purged twice daily
at 14:00 utc (09:00 est) and 22:00 utc (17:00 est) by the
site-guestbook-cron worker. no ip addresses or user-agent
strings are stored. do not put anything sensitive here anyway.
# sign the book
# recent entries
click refresh…
# how it works
- form posts to
/api/guestbookwith a turnstile token - function verifies turnstile server-side, truncates name and message
- inserts into d1 using a prepared statement (parameterized, sqli-safe)
- GET returns the 20 most recent rows
- a separate worker
site-guestbook-cronrunsDELETE FROM guestbookat 14:00 and 22:00 utc daily