Lexiverse
Lexiverse - AI contextual reading engine for English learners. Your next article is your next review.
翻譯準備中
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Multiplayer sat
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Study smarter. Compete harder. A study platform for the SAT, PSAT, and AP exams with a focused, exam-style practice interface, real progress tracking, and live quiz matches with friends.
StudyDuel is an independent study tool. It is not affiliated with, endorsed by, or sponsored by College Board. All questions are original. The product name is set in one place (
PRODUCTinsrc/lib/config.ts).
/courses): every SAT Suite and AP course (43), searchable by name, nickname ("APUSH", "calc", "APES"), or subject. Each course hub lists StudyDuel practice tests, skill practice, and links to College Board's own free materials: the official practice tests in Bluebook and released AP past exam questions. StudyDuel links to that content and never copies it.content/tests/practice-tests.json, run in timed modules with a directions screen, module timer (hideable, low-time warning, auto-advance), mark for review, answer eliminator (ABC), math reference sheet, a "Check Your Work" page at the end of each module, no returning to finished modules, and a 10-minute break between SAT/PSAT sections. Results show a raw score report by section and module, not a scaled score. Current forms: SAT, PSAT/NMSQT, PSAT 8/9, and one short-form Section I test for each AP course with questions. They are shorter than real tests (the bank is small) but keep real per-question pacing.Requires Node.js 20.9 or newer.
npm install
npm run dev
Open http://localhost:3000. No environment variables are needed; the banner at the top confirms demo mode.
Requires a PostgreSQL 13+ database (a local install, Docker, or a Render database's External URL).
docker run -d --name studyduel-db -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:16 # or use any Postgres
cp .env.example .env.local # then set:
# DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
npm run build && npm start # or npm run dev
Tables are created on the first request (the app applies pending migrations from src/lib/server/migrations.ts and syncs the question bank). You can also run npm run db:migrate yourself. Check configuration at any time with GET /api/health.
| Variable | Where | Purpose |
|---|---|---|
DATABASE_URL | server only | Postgres connection string. Leave empty for demo mode. Never expose to the browser. |
DATABASE_SSL | server only | Optional: disable, require, or verify. Default: TLS on for remote hosts, off for localhost and Render internal hostnames. |
RESEND_API_KEY, EMAIL_FROM | server only | Optional: send password reset emails through Resend. Without them, the reset page says resets aren't set up. |
APP_URL | server only | Optional: base URL used in reset links (defaults to the request origin). |
CRON_SECRET | server only | Protects /api/cron/cleanup (stale room and expired session cleanup). |
NEXT_PUBLIC_FORCE_DEMO_MODE | public | true forces demo mode. |
If DATABASE_URL is set but isn't a postgres:// URL, the app does not silently fall back: it shows a configuration warning banner and runs a browser-only preview. If the database can't be reached, online API routes return a clear error and /api/health reports the problem.
| Command | What it does |
|---|---|
npm run dev / build / start | Next.js development, production build, production server |
npm run lint / typecheck | ESLint and tsc --noEmit |
npm test | Unit tests (content validation, grading, engine, XP, streaks, mastery, multiplayer rules) |
npm run test:db | Database function and invariant tests against DATABASE_URL (reads .env.local; use a throwaway database) |
npm run test:e2e | Playwright: builds a demo-mode server on port 3100 and runs the demo suites. Add E2E_CONNECTED_URL=http://localhost:3000 to also run the connected suite |
npm run content:validate | Validates content/questions and regenerates question-file.schema.json |
npm run db:migrate | Applies pending migrations to DATABASE_URL (the app also does this on first use) |
npm run db:seed | Upserts the question bank into DATABASE_URL (the app also does this on first use) |
xp_transactions) with a unique key per source and reason, so rewards can't be duplicated. Correct-answer XP is paid once per question per 7 days with a daily cap; the daily challenge pays once per day (enforced in the database). profiles.total_xp is maintained by a trigger and is not client-writable.httpOnly, SameSite=Lax cookie (only its SHA-256 hash is stored). Changing or resetting a password signs out other devices. Guests get a real account without an email and can upgrade in place, keeping their progress.question_keys and are never sent by the API. Leaderboards and friend data come from functions that expose only display names, usernames, and aggregates, and respect opt-outs.countdown → question → reveal → … → finished) stored in Postgres. Any member's request can apply a transition that is due, using a conditional update so concurrent requests can't double-advance. Answers are validated against the current question and deadline (with 750 ms grace), scored on the server (100 per correct answer plus up to 50 speed bonus; wrong answers score 0), and recorded by a function whose unique key rejects duplicates. Correctness stays hidden until the reveal. Room members poll the server every 1.5 seconds; each poll also records presence and can apply a due transition. Room codes alone never grant access: state is returned only to members.localStorage.content/questions/ Original question bank (JSON) + JSON Schema
src/app/ Routes (App Router). (app) has the main shell; (focus) is the exam interface
src/app/api/ Route handlers: sessions, rooms, me, health, cron
src/components/ UI primitives (shadcn-style), exam engine, play, dashboard
src/lib/content/ Catalog, bank, grading, schema
src/lib/engine/ Session types, selection, grading + rewards (finalize)
src/lib/progression/ XP/levels, streaks/dates, mastery, achievements, stats, recommendations
src/lib/multiplayer/ Room rules, scoring, state machine
src/lib/server/ Trusted server services (db, auth, migrations, sessions, rooms, social, question sync)
src/lib/data/ Client repositories (local vs remote)
tests/unit, tests/integration, tests/e2e
See docs/CONTENT.md to add questions or exams.
The app runs on Vercel; the database runs on Render.
render.yaml: Postgres 16 in Virginia, next to Vercel's default iad1 region), or New → PostgreSQL by hand (pick the region closest to your Vercel functions). Under the database's Networking/Access Control, allow connections from 0.0.0.0/0, because Vercel has no fixed outbound IPs. The connection still needs the password and uses TLS..render.com/<db name>).DATABASE_URL (the External URL) and CRON_SECRET (any long random string). Optionally add RESEND_API_KEY and EMAIL_FROM for password reset emails. Redeploy after adding them.DATABASE_URL="<external url>" npm run db:migrate from your machine.vercel.json schedules /api/cron/cleanup daily to close stale rooms and expire old sign-in sessions; Vercel sends CRON_SECRET automatically.Hosting the app on Render instead also works: create a Node web service with build command npm ci && npm run build, start command npm start, and set DATABASE_URL to the Internal Database URL.
/api/health returns "mode":"connected", "database":"ok", and an empty problems list./auth/update-password works.Run in this repository's development environment (local PostgreSQL 16):
npm test: 74 unit tests.npm run test:db: 6 database tests (session completion, XP ledger, friends, leaderboards, guest restrictions, account deletion).npm run test:e2e: 11 demo-mode tests (desktop and mobile, including course search and full SAT and AP practice tests), plus 4 connected-mode tests covering persistence across sign-in, idempotent resubmission, a two-browser live match with duplicate-answer rejection, and a practice test with server-side draft autosave.npm run build, npm run lint (0 errors), npm run typecheck.src/lib/content/course-directory.ts follow College Board's URL patterns but could not be checked from the build environment (its network blocks collegeboard.org). Click through them once after deploying.