rhocfsandbox.com

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

  1. form posts to /api/guestbook with a turnstile token
  2. function verifies turnstile server-side, truncates name and message
  3. inserts into d1 using a prepared statement (parameterized, sqli-safe)
  4. GET returns the 20 most recent rows
  5. a separate worker site-guestbook-cron runs DELETE FROM guestbook at 14:00 and 22:00 utc daily