Static Cloudflare Pages site for hattrick.autojack.ai, with a D1-backed
pilot mailing list.
index.html- single-file landing pagefunctions/api/signup.js-POST /api/signupwaitlist endpointfunctions/api/checkout.js-POST /api/checkoutStripe Checkout Session endpointfunctions/lib/email.js- Hat Trick welcome email templatefunctions/lib/tokens.js- unsubscribe token helperfunctions/unsubscribe.js- unsubscribe endpoint for email footer linksfunctions/admin/waitlist.js- authenticated JSON/CSV waitlist exportschema/d1-schema.sql- D1 schema for thewaitlisttablewrangler.toml- Pages and D1 binding config
cd /Users/jgarturo/Projects/OpenAI/autohub
npm run deploy:pages -- --slug=hattrick --dir=/Users/jgarturo/Projects/OpenAI/hat-trick --domain=hattrick.autojack.aiFor D1/Functions-aware deploys, run Wrangler from this directory:
cd /Users/jgarturo/Projects/OpenAI/hat-trick
/Users/jgarturo/Projects/OpenAI/autohub/node_modules/.bin/wrangler pages deploy . --project-name=hattrick --branch=main --commit-dirty=true --env-file /Users/jgarturo/Projects/OpenAI/autohub/.envDatabase: hattrick-db
Apply schema:
/Users/jgarturo/Projects/OpenAI/autohub/node_modules/.bin/wrangler d1 execute hattrick-db --remote --file ./schema/d1-schema.sql --yes --env-file /Users/jgarturo/Projects/OpenAI/autohub/.envQuery signups:
/Users/jgarturo/Projects/OpenAI/autohub/node_modules/.bin/wrangler d1 execute hattrick-db --remote --command "SELECT email, source, created_at FROM waitlist ORDER BY created_at DESC;" --env-file /Users/jgarturo/Projects/OpenAI/autohub/.envAdmin endpoint requires an ADMIN_TOKEN Pages secret:
curl -H "Authorization: Bearer <token>" https://hattrick.autojack.ai/admin/waitlistWelcome emails are copied from the AutoMail Resend flow. Signups still work
without email configuration, but POST /api/signup will return
email_configured: false and email_sent: false.
Required Pages secret:
/Users/jgarturo/Projects/OpenAI/autohub/node_modules/.bin/wrangler pages secret put RESEND_API_KEY --project-name=hattrick --env-file /Users/jgarturo/Projects/OpenAI/autohub/.envThe configured sender is hello@hattrick.autojack.ai; that sender/domain must
be verified in Resend before smoke tests will deliver. CONFIRM_SECRET is
optional and falls back to ADMIN_TOKEN or RESEND_API_KEY for unsubscribe
tokens.
Smoke test:
curl -s https://hattrick.autojack.ai/api/signup \
-H "Content-Type: application/json" \
-d '{"email":"smoke+hattrick@example.com","source":"email-smoke"}'The support and busker cards use Stripe-hosted Checkout Sessions. Card and wallet details stay in Stripe; the site only creates a Checkout Session and redirects to the returned URL. Pilot support and kit deposits are one-time payments; the monthly device plan creates a Stripe Billing subscription. Checkout sessions override Stripe branding per session to match The Busking Project: coral button, warm background, Montserrat, rounded controls, and the white-hat icon.
Required Pages secret:
/Users/jgarturo/Projects/OpenAI/autohub/node_modules/.bin/wrangler pages secret put STRIPE_SECRET_KEY --project-name=hattrick --env-file /Users/jgarturo/Projects/OpenAI/autohub/.envSmoke test session creation:
curl -s https://hattrick.autojack.ai/api/checkout \
-H "Content-Type: application/json" \
-d '{"amount":500,"kind":"pilot_support","source":"stripe-smoke"}'Refundable kit deposit smoke test:
curl -s https://hattrick.autojack.ai/api/checkout \
-H "Content-Type: application/json" \
-d '{"amount":10000,"kind":"kit_deposit","source":"deposit-smoke"}'Monthly device-plan smoke test:
curl -s https://hattrick.autojack.ai/api/checkout \
-H "Content-Type: application/json" \
-d '{"amount":4900,"kind":"device_monthly","source":"monthly-smoke"}'