The default signed-in page serves 1,406 distinct Reading & Writing questions from a bundled OpenSAT/PineSAT snapshot. No Supabase connection or provider request is needed at runtime. Answers and source explanations stay on the backend until submission. Source answers have not been independently reviewed.
Progress is saved per account in that browser, with the existing 1-day wrong
answer and 3/7/14/30-day correct-answer review intervals. Clearing browser data
removes progress; it does not sync across devices or migrate automatically into
Supabase. The original nine-question diagnostic quiz is at /?quiz=originals.
The existing /?admin=true Supabase development view is still separate.
Snapshot provenance is documented in backend/src/practice/SOURCE.md.
- Supabase question rows can be inspected at
http://localhost:5173/?admin=truewhile the local frontend and backend are running. - The view reads
public.question_draftsthrough the backend; it currently shows all rows, including drafts. The current project returned 1,000 rows, all withreview_status: draftas of 2026-10-09. - Local Supabase credentials belong in ignored
backend/.envasSUPABASE_URLandSUPABASE_SERVICE_ROLE_KEY. Never expose the service key in frontend config, commits, or chat. - User-specific practice history is stored in
public.user_question_memory. Applybackend/supabase/migrations/202610100001_user_question_memory.sqlafter the question-pipeline migration before testing memory. The local?admin=trueview lets you switch betweenALLOWED_EMAILS; wrong answers return in 1 day and consecutive correct answers use 3, 7, 14, then 30 day intervals. This practice route remains local-development-only. - Current work branch:
feat/supabase-questions-ui.
SAT Reading & Writing practice: multi-question quiz flow, per-option marking (Answer / Maybe / Eliminate), diagnostic labels, and server-side answer checking. The backend also provides a private question draft pipeline for source imports, AI diagnosis, and reviewed approval.
backend/ NestJS API (bundled practice banks, answer checking)
frontend/ React + Vite UI
Two terminals:
cd backend && npm install && npm run dev # http://localhost:3000
cd frontend && npm install && npm run dev # http://localhost:5173To skip Magic Link sign-in while developing locally, set DEV_AUTH_BYPASS=1
in backend/.env and VITE_DEV_AUTH_BYPASS=1 in frontend/.env.local, then
restart both servers. Vite applies the frontend setting only in development,
and the backend ignores the bypass when NODE_ENV=production.
With the local bypass enabled and Supabase configured on the backend, open
/?admin=true to inspect rows in question_drafts. This development view
shows question text and review status without returning answer keys or
diagnosis data to the browser.
GET /api/questions— all questions for the quiz UI. Omits correct answers, rankings, and authored analysis.GET /api/question— the first question in the bank (same shape as one element of/api/questions).POST /api/submit— body:{ questionId, selectedOptionId, secondChoiceOptionId, eliminatedOptionIds }. Browser-imported questions also include a validatedauthoredQuestionused only when the ID is absent from the server bank. Returns{ correct, correctOptionId, trapOptionId, selectedOptionId, secondChoiceWasCorrect, label, explanation, trapExplanation }.
For server-bank questions, authored rankings and analysis live only on the server and are never sent to the client before submission. Rank 1 is the correct answer; rank 2 is the authored primary trap.
User-imported questions are different: the separately supplied JSON file contains the full grading metadata, so its answers and analysis are available to the person importing it and are stored in that browser's local storage. The backend receives the imported question transiently for grading but does not add it to the shared question bank or persist it.
- backend/src/questions/sat-reading-writing.questions.ts is the canonical nine-question runtime bank and contains only original ScoreBetter practice items.
- Four human-reviewed originals live in
backend/src/questions/sat-reading-writing.replacement-candidates.tsand are included in the canonical bank.
The optional browser JSON import remains available for custom questions. The quiz rejects duplicate IDs and IDs that collide with the server bank. Importing or clearing a file starts a fresh quiz session.
Apply backend/supabase/migrations/202610070001_question_pipeline.sql to a
Supabase project and configure these backend environment variables:
ADMIN_EMAIL: exact account allowed to use pipeline endpoints (must also be inALLOWED_EMAILS).SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEY: server-only database access.QUESTION_SOURCES: optional JSON array of additional or overridden source connectors. OpenSAT/PineSAT English is included by default. Each connector hasid, an HTTPSendpoint, optionalitemsPath,nextCursorPath, andcursorParameter, plus permission fieldsstore,process,serve, andevidence. The endpoint returns a JSON array (or an array atitemsPath); records need anidorquestionId. Keep this configuration and credentials private. A source is only syncable when storage and processing are allowed and permission evidence is recorded.AI_API_URL,AI_API_KEY, andAI_MODEL: optional OpenAI-compatible chat completions endpoint for diagnosis. Model output is always unreviewed.
After signing in with the admin account, open /?admin=questions to review
private drafts. The screen can diagnose the next 20 unanswered drafts, edit and
save a human-reviewed diagnosis, then approve drafts one at a time. Approval
requires the diagnosis to be explicitly saved as reviewed.
All pipeline routes require the admin session:
POST /api/admin/question-pipeline/sources/:sourceId/syncGET /api/admin/question-pipeline/draftsPATCH /api/admin/question-pipeline/drafts/:idwith adraftand/ordiagnosisobjectPOST /api/admin/question-pipeline/drafts/:id/diagnosePOST /api/admin/question-pipeline/drafts/:id/approve
Approval requires permission to store, process, and serve, plus a complete and
structurally valid diagnosis. Drafts stay in the private staging table and do
not enter the student quiz bank. Configure only sources whose content rights
and intended use have been verified; public API access alone is not permission.
The built-in opensat-pinesat connector maps the English endpoint's nested
question text, passage, A-D choices, answer key, explanation, domain, and
difficulty into ScoreBetter drafts. It resolves repeated provider IDs using a
content hash, batches writes, and leaves existing drafts untouched on re-sync.
The recorded permission note links OpenSAT's database terms and notes that
item-level provenance has not been independently audited. College Board's
undocumented endpoint is not configured, and PDF/image upload extraction is
not included yet.
Each option can be marked Answer, Maybe, or Eliminate. Answer and Maybe are exclusive — assigning either moves it off whichever option held it. Clicking an option's current mark clears it. Submit requires an Answer.
cd backend && npm test # unit tests (diagnostic classifier, submit)With both servers running:
cd frontend && npm run e2e # headless Cypress
cd frontend && npm run e2e:open # interactiveThis repo is a Vercel Services app: Vite frontend + NestJS API on one URL. Leave Root Directory empty so Vercel reads the root vercel.json.
- Push to GitHub.
- In Vercel: Add New Project → import this repo. Framework should be Services.
- Deploy. You get a production URL (e.g.
scorebetter.vercel.app). - Test: open the URL, load questions, import a JSON file, submit answers.
- Share the site URL.
The browser calls /api on the same host. If the UI is on a different Vercel project, set VITE_API_URL to the API origin (with or without /api) and redeploy the frontend. Imported questions stay in that browser's localStorage. The original diagnostic bank contains original practice items; the default practice view uses the bundled source snapshot.
Persistence, auth, AI explanations, and expanding the original practice bank.