Upload a PDF → generate an AI quiz → play 20 random questions → see your score and solutions → download results as PDF.
- Next.js 14 (App Router) + MongoDB (Mongoose)
- Auth: GitHub OAuth + email/password with JWT (httpOnly cookie)
- Quiz generation: OpenAI API
- PDF:
pdf-parsefor extraction,jspdffor results download
-
Install dependencies
npm install
-
Configure environment — copy
.env.exampleto.env.localand fill in:MONGODB_URI— local MongoDB or a free Atlas clusterJWT_SECRET— any long random stringGITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET— create an OAuth app at https://github.com/settings/developers with callback URLhttp://localhost:3000/api/auth/github/callbackOPENAI_API_KEY— from https://platform.openai.com/api-keys
-
Run
npm run dev
- Home — upload a PDF; text is extracted server-side and sent to OpenAI, which returns up to 30 MCQs stored in MongoDB.
- Play —
/play/[id]serves 20 random questions (answers stay server-side). - Results — answers are graded on the server; the solutions page shows correct answers + explanations and offers a PDF download with your score.
- About — edit
app/about/page.jsto personalize.
- Scanned/image-only PDFs won't work (no OCR).
- Quiz generation costs a small amount per upload via the OpenAI API.