feat: reviews integration + Cloudflare Worker scaffold#1
Open
feat: reviews integration + Cloudflare Worker scaffold#1
Conversation
- src/lib/reviews.ts — typed fetch helpers, star renderer, relative
time formatter, safe DOM card builder (no innerHTML)
- src/pages/index.astro — Recent Reviews section on homepage; fetches
from local daemon in dev (localhost:3850), Worker in prod via
PUBLIC_REVIEWS_ENDPOINT env var
- worker/ — production Cloudflare Worker (signet-reviews):
- D1 schema with target + updated_at indexes
- GET /api/reviews — paginated public read, 30s cache
- POST /api/reviews/sync — batch upsert from signetai daemon
- Rate limiting (5 reqs/IP/60s), CORS origin guard, UUID + timestamp
validation, body size cap (512KB), X-Signet-Sync header gate,
idempotent upsert by review UUID
- wrangler.toml with D1 + rate_limit bindings, prod CORS var
- DEPLOY.md — step-by-step guide for Nicholai to finish setup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/lib/reviews.ts— typed fetch helpers for the reviews API; safe DOM card builder (no innerHTML anywhere); star renderer + relative timestamp formattersrc/pages/index.astro— Recent Reviews section on the homepage; fetches from local Signet daemon in dev (localhost:3850), Cloudflare Worker in prod viaPUBLIC_REVIEWS_ENDPOINTworker/— production-ready Cloudflare Worker (signet-reviews), ready to deployWorker details
GET /GET /api/reviewsPOST /api/reviews/syncSecurity:
ratelimitbinding)CORS_ORIGINenv var (set to marketplace domain in prod)X-Signet-Sync: 1header required on POSTdisplayName, no IPs or account IDsNicholai's finishing steps
See
worker/DEPLOY.md— complete step-by-step guide:wrangler d1 create signet-reviews→ paste ID intowrangler.tomlwrangler d1 migrations apply signet-reviews --remoteCORS_ORIGINto marketplace domain inwrangler.tomlwrangler deploy --env productionPUBLIC_REVIEWS_ENDPOINTin Cloudflare Pages env varsTest plan
bun run dev) shows "Recent Reviews" sectionGET /api/reviewsreturns paginated results with summaryPOST /api/reviews/syncaccepts valid daemon payloadX-Signet-Syncheader🤖 Generated with Claude Code