Sign-up attribution + Cloudflare Turnstile bot protection - signup_attribution (migration nifty_chameleon): first-visit referrer, landing path, utm_* (client, via x-bp-attribution from sessionStorage/bp_attr cookie) + request Referer, CF-Connecting-IP, cf.country/asn/ asOrganization, user agent; sanitized and length-capped (src/lib/attribution.ts); deleted with the account. - middleware/03-signup.ts: Turnstile siteverify before Better Auth creates the account (400 CAPTCHA_REQUIRED / 403 CAPTCHA_INVALID / 503 unavailable); sign-in asks for a check after 3 failures per email in 15 min (auth_failures). Enabled only when TURNSTILE_SITE_KEY + TURNSTILE_SECRET_KEY are set; optional TURNSTILE_SMOKE_BYPASS for @example.com smoke sign-ups. GET /v1/signup-config serves the site key. - Web: managed widget (explicit render, flexible size, app theme) on sign-up and on sign-in when asked. - Tests: test/attribution.test.ts (10), scripts/signup.mjs e2e (added to CI e2e with Turnstile test keys); scripted sign-ups send the dummy test token. DESIGN.md.

656c45ad3fSubmittedbysunny

Patchsets

pending

/sunny/botparley/DESIGN.md

Loading diff…
pending

/sunny/botparley/app/db/migrations/20261019233059_nifty_chameleon.sql

Loading diff…
pending

/sunny/botparley/app/db/migrations/meta/20261019233059_snapshot.json

Loading diff…
pending

/sunny/botparley/app/db/migrations/meta/_journal.json

Loading diff…
pending

/sunny/botparley/app/db/schema.ts

Loading diff…
pending

/sunny/botparley/app/env.ts

Loading diff…
pending

/sunny/botparley/app/examples/mcp-smoke.mjs

Loading diff…
pending

/sunny/botparley/app/examples/seed-demo.mjs

Loading diff…
pending

/sunny/botparley/app/examples/seed-real.mjs

Loading diff…
pending

/sunny/botparley/app/examples/smoke.mjs

Loading diff…
pending

/sunny/botparley/app/middleware/03-signup.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/routes/v1/signup-config.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/ci.sh

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/owner-links.mjs

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/password-ui.mjs

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/signup.mjs

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/sse.mjs

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/scripts/unread.mjs

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/lib/attribution.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/lib/turnstile.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/server/deletion.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/attribution.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/lib.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/main.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/signin.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/style.css

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/src/ui/turnstile.ts

Diff loads as this file nears the viewport.
pending

/sunny/botparley/app/test/attribution.test.ts

Diff loads as this file nears the viewport.