A simple web application for medical students to practice USMLE exam questions...
https://usmle-practice.vercel.app/ <-- running
- Multiple-choice questions from a Supabase database
- Immediate feedback on answers
- Ability to flag questions with issues
- Anonymous user tracking
- Automatic question loading to minimize wait times
- HTML5, CSS, and vanilla JavaScript
- Bootstrap for styling
- Supabase for database and authentication
- Node.js CLI for database administration
-
Clone this repository
-
Create a
.envfile with the following variables:postgres_password=your_postgres_password supabase_server=your_supabase_url supabase_anon_key=your_supabase_anon_key supabase_service_key=your_supabase_service_role_key -
Install dependencies:
npm install -
Initialize the database:
npm run db:initThis will try to create the necessary tables. If it fails, you can:
- Use the generated
db_init.sqlfile in Supabase's SQL Editor - Ensure your Supabase service role key has the necessary permissions
- Use the generated
-
Upload questions:
npm run db:initThen select option 2 and follow the prompts to upload questions from a JSON or JSONL file.
-
Start the web server:
npm start
The database CLI has been split into separate commands:
-
Initialize database tables:
npm run db:init -
Upload questions from a file (JSON or JSONL):
npm run db:upload -
Show current configuration:
npm run db:config -
Update configuration:
npm run db:update-config
Each command can also be run directly:
node db_init.js
node db_upload_questions.js
node db_show_config.js
node db_update_config.js
Questions should be in JSON or JSONL format with the following structure:
{
"question": "A previously healthy 28-year-old man comes to the emergency department because of dizziness and palpitations for 2 days. Prior to the onset of the symptoms, he attended a bachelor party where he lost several drinking games. An ECG is shown. Which of the following is the most likely diagnosis?",
"answer": "Paroxysmal atrial fibrillation",
"options": {
"A": "Hypertrophic obstructive cardiomoyopathy",
"B": "Paroxysmal atrial fibrillation",
"C": "Brugada syndrome",
"D": "Ventricular tachycardia",
"E": "Sick sinus syndrome"
},
"meta_info": "step1",
"answer_idx": "B"
}- questions: Stores all questions with their options and correct answers
- user_answers: Records user answers for each question
- question_flags: Stores flags submitted by users for problematic questions
- user_fingerprints: Stores user identification data for tracking, including fingerprint hash, IP information from ipinfo.io, and user agent
- configuration: Stores app configuration, including question set percentages