🗺️ System overview
[Users]
|
v
Cloudflare Pages (apps/web)
|
v
Cloudflare Worker (services/api)
|
v
Cloudflare D1 (ihnyc-games)
- Pages serves the public site and the
/admin UI.
- Worker provides JSON APIs for public + admin flows.
- D1 stores events, results, imports, and submissions.
🔐 Admin access model
/admin should be protected at the edge with Cloudflare Access.
- Admin API endpoints (
/api/admin/*) require either:
- Cloudflare Access headers, or
X-Admin-Token matching ADMIN_TOKEN (dev only).
🔁 Data flow
- Events + Results are created in Admin Console.
- CSV Import ingests Google Forms exports into
signup_submissions.
- Standings are computed on read from
results.
⚙️ Deploy flow
- API:
npx wrangler deploy (Worker)
- UI: Cloudflare Pages build from repo (
apps/web)
- D1 schema:
npx wrangler d1 execute ihnyc-games --file=../../infra/d1/schema.sql --remote