examprep-api
Shared backend for examprep.softician.com (public) + examprep-admin.softician.com (admin). Cloudflare Worker + D1, no framework, no build step.
Setup (one-time, via Cloudflare dashboard — no local Wrangler on this machine)
- Workers & Pages > D1 > Create database
examprep, runschema.sqlin its Console tab. - Paste the resulting
database_idintowrangler.jsonc. - Workers & Pages > Create > Workers > Import a repository (this repo) for git-connected deploy.
- Worker Settings > Variables & Secrets:
TURNSTILE_SECRET,CF_ACCESS_TEAM_DOMAIN,CF_ACCESS_AUD. - In each of the
examprep/examprep-adminPages projects: Settings > Bindings > add a Service Binding to this Worker (examprep-api), so theirworker.jscan call it same-origin without any public hostname on this Worker.
Tests
node --test test/progress-consistency.test.js — runs against an in-memory DB via Node's
built-in node:sqlite (no wrangler/workerd needed, which matters since this repo can't run those
locally on this machine). Currently just the progress-totals consistency check from the
2026-08-05 admin-vs-site counter bug; add more test files under test/ as needed.
Routes
Public (bearer token, minted by /redeem): /questions/next, /answer, /progress, /prefs.
Admin (Cloudflare Access-gated): /console/codes, /console/codes/generate, /console/codes/revoke,
/console/questions (+ create/update/delete/import), /console/stats.
See the architecture plan for the full design.