Next.js app with PostgreSQL: sections, segments, and questions are stored in the database. Progress and daily stats are persisted per client (anonymous client_id in localStorage).
-
Create a PostgreSQL database
Use Vercel Storage (e.g. Neon), Supabase, or any Postgres host. Copy the connection string. -
Environment
Create.envin the project root:DATABASE_URL=postgresql://...
-
Schema and seed
From the project root:npm install npm run db:setup npm run db:seed
(
db:seedrequiresscripts/seed-questions.json; runnode scripts/extract-seed-json.jsonce to generate it fromdemo.js.) -
Run locally
npm run dev
Open http://localhost:3000.
-
Push the repo and import the project in Vercel under your account (e.g. under “juelzs” / your team). Name the project Alex.
-
In Vercel → Project → Settings → Environment Variables, add:
DATABASE_URL= your Postgres connection string (Production, Preview, Development if needed).
-
After the first deploy, run migrations and seed against the same database (from your machine or a one-off script):
DATABASE_URL="your-production-url" npm run db:setup DATABASE_URL="your-production-url" npm run db:seed
-
Redeploy or trigger a new deployment so the app uses the seeded data.
npm run dev– local dev servernpm run build– production buildnpm run start– run production build locallynpm run db:setup– applyscripts/schema.sqlnpm run db:seed– insert sections and questions (requiresseed-questions.json)node scripts/extract-seed-json.js– generateseed-questions.jsonfromdemo.js
- sections / segments – MCAT sections and segments (labels, colors, icons).
- questions – seed questions plus custom questions per
client_id. - progress – per client/segment/question: attempts, correct, streak, notes, last_seen.
- daily – per client/day: attempts and correct count.
All content is read from the database; no hardcoded question bank in the app.