How it works
Quizdeck keeps question and progress rules outside its renderers. Both interfaces create their own Jotai application session and use the same question-set validation, learning state, practice transitions, and report construction. Ink renders the session in a terminal; React DOM renders it in a browser. They do not connect to a common server.
From file to question set
An imported file is a UTF-8 JSON array, not an object with a questions property. Each question has a unique positive integer ID, non-blank description, and at least two answers; exactly one answer is correct. Each answer has text, a correct boolean, and a justification string, which may be empty. Unexpected properties and invalid entries reject the entire file with a location for the error. A blank justification is reported as missing source explanation, not invented by the app.
[{"id": 1,"description": "Which protocol resolves domain names to IP addresses?","answers": [{ "text": "DNS", "correct": true, "justification": "DNS resolves names to addresses." },{ "text": "HTTP", "correct": false, "justification": "HTTP transfers web resources." }]}]
json
The set records its source, load time, question count, and a SHA-256 hash of the question content. On first startup, each interface seeds its own copy of the three-question Demo Set only if its store is empty. It never silently replaces an existing set.
Committing progress
Storage validates snapshots and applies learning answers, practice updates, and set replacement as transactions with a revision check. An answer appears as saved only after the commit succeeds; failed writes leave the previous committed state intact. A replacement is one transaction: it swaps the set and clears learning records, practice runs, timing, and run ownership together. Loading the same file again still clears progress.
Practice records save the selected question IDs and answer order. A new run samples min(60, question count) distinct IDs, so the three-question demo produces a three-question run. Completed answers cannot be rewritten; the final committed answer produces a report with score, percentage, elapsed active time, answer outcomes, explanations, and practice-position-to-source-ID mapping.
Timing and concurrent sessions
The practice clock accumulates active time using a monotonic session clock and durable millisecond checkpoints. Reading and reviewing earlier answers during an active run count; manual pauses, time outside practice, and completed reports do not. A hard crash can lose the last uncheckpointed interval, but does not count the disconnected period. Short-lived writer leases prevent two sessions from updating the same run concurrently; an interrupted lease can briefly delay resumption.
CLI progress lives in a local node:sqlite database. Browser progress lives in IndexedDB for that browser profile and origin. Other open instances can refresh committed state, but observation does not grant permission to overwrite an active writer. There is no account, remote sync, or automatic transfer between the two stores.
Table of contents