Tier-2
Merged
HU
4mo ago+15635+15635+01234567890123456789012345678901234567890123456789-5967-5967-0123456789012345678901234567890123456789
Summary by cubic
Adds JWT auth and API key management, KV-cached session lists, and DO-based rate limiting to harden the API. The SPA gets media upload, polished page-load motion with skeletons, required field tooltips, game guides, PWA offline read-only, i18n, and scorecard export.
-
New Features
- Auth & keys:
POST /auth/token(exchange API key → short‑lived JWT); SPAAuthProvider+ owner switcher; API key UI at/settings/keys; OpenAPI updated withBearerJwt. - Scale & reliability:
RateLimiterDurable Object (per‑IP), KV cache forGET /sessions(HTTP max‑age 15s; KV 60s;X-Cache), structured JSON logs withX-Trace-Id, deep readinessGET /health?deep=1. - Media:
/media/uploadto R2 with progress/cancel (MediaUpload); PATCH supportsvideoUrl,videoPoster,hlsUrl, and player photos; added HLS MIME types. - Motion & UX: route transitions via
AnimatedOutlet, destination‑aware skeletons, slidingTabStrip; required tooltips viaTextField/SelectField/FileField; single‑source game guides (game-guides.ts) shown withGameGuideCard. - Extras: PWA with query persistence and offline banner; i18n via
react-i18next(en); scorecard export to print‑ready HTML; static API docs served from/openapi.jsonand/docs/.
- Auth & keys:
-
Migration
- Set
OCHE_JWT_SECRETin API env and sync dev vars (npm run setup:dev-vars:sync); optionally setVITE_PLAUSIBLE_DOMAINorVITE_CF_WEB_ANALYTICS_TOKEN. - From
apps/api: create KV namespace forCACHEand add IDs towrangler.toml; apply theRateLimiterDO migration (tag v2) and redeploy. - Rebuild the SPA to pick up PWA/i18n and new routes; no breaking changes to existing endpoints.
- Set