Go to file
AriTheStupidCat aa831aec12 test 2026-06-27 19:42:18 +01:00
src Fix 2026-06-18 02:03:04 +01:00
.gitignore first commit 2026-06-18 01:53:24 +01:00
README.md Fix 2026-06-18 02:03:04 +01:00
package.json first commit 2026-06-18 01:53:24 +01:00
pnpm-lock.yaml first commit 2026-06-18 01:53:24 +01:00
pnpm-workspace.yaml Add packages section to pnpm-workspace.yaml 2026-06-26 04:34:09 +01:00
tsconfig.json first commit 2026-06-18 01:53:24 +01:00
wrangler.toml test 2026-06-27 19:42:18 +01:00

README.md

guestbook-worker

Cloudflare Worker backing the guestbook on c.stupid.cat.

No database — entries live in Workers KV as a single JSON array under the key entries. Think of it as a JSON file on Cloudflare's edge.

API

Method Path Description
GET /?limit=50&offset=0 List entries, newest first. Returns { entries, total, limit, offset }.
POST / Add an entry. JSON body: { name, message, website?, turnstileToken?, url2? }.

url2 is a hidden honeypot — leave it empty. Anti-spam: honeypot + per-IP rate limit (30s) + optional Turnstile.

Setup

pnpm install

# 1. Create the KV namespaces (prod + preview for `wrangler dev`)
pnpx wrangler kv namespace create GUESTBOOK
pnpx wrangler kv namespace create GUESTBOOK --preview
# -> paste both ids into wrangler.toml (id + preview_id)

# 2. (optional) enable the captcha
#    Create a Turnstile widget in the Cloudflare dashboard, then:
pnpx wrangler secret put TURNSTILE_SECRET
#    Put the matching SITE key into the site's js/guestbook.js (TURNSTILE_SITE_KEY).
#    Skip this step to run with just honeypot + rate limiting.

# 3. Run locally / deploy
pnpm dev
pnpm deploy