An AI-powered adaptive quiz platform with a secure FastAPI backend and a modern Next.js frontend. Build custom or adaptive quizzes, generate quizzes from uploaded documents, track progress, review detailed results, and export quizzes to Google Forms.
- π€ AI Quiz Generation: Generate MCQs with local Ollama, supported cloud endpoints, or uploaded documents.
- π€ Secure Auth Flow: Login/registration with bcrypt hashing and bearer-token protected APIs.
- π Session Safety: Token refresh endpoint and friendly frontend auto-redirect on expiry.
- π§ Adaptive Learning: Target weak topics automatically based on previous performance.
- π Analytics Dashboard: Track total quizzes, average score, weak topics, and recent performance.
- π Quiz Review Experience: Detailed per-question breakdown with your answer vs correct answer.
- π€ Google Form Export: Export quiz data to Google Forms with credentials upload.
- π§± Clean Architecture: Clear separation across API, services, core logic, and UI layers.
- π Python + FastAPI
- β‘ Uvicorn
- π bcrypt
- π JSON persistence (local development friendly)
- βοΈ Next.js (App Router)
- π¦ TypeScript
- π¨ Tailwind CSS
- ποΈ Zustand
- π Axios + interceptor-based auth/session handling
- Python 3.10+
- Node.js 18+
- Optional for local model: Ollama
git clone https://github.com/VishvaNarkar/Smartquiz-Agent.git
cd smartquiz-agentpython -m pip install -r requirements.txt
cd frontend
npm installCreate a root .env file for backend settings, and use the frontend example file if you want a starter for browser settings:
cp frontend/.env.example frontend/.env.localImportant variables:
OLLAMA_URLOLLAMA_MODELSMARTQUIZ_CLOUD_API_KEYSMARTQUIZ_AUTH_SECRET- Document uploads require the parser packages listed in
requirements.txt(pypdf,python-docx, andpython-pptx). Legacy.docfiles may need to be converted to.docxor PDF if extraction fails.
Frontend optional config (frontend/.env.local):
NEXT_PUBLIC_API_URL=http://localhost:8000python api_server.pycd frontend
npm run dev- Frontend: http://localhost:3000
- API: http://localhost:8000
- Swagger docs: http://localhost:8000/docs
- Health check: http://localhost:8000/health
POST /auth/registerPOST /auth/loginPOST /auth/refresh
POST /quiz/customPOST /quiz/documentPOST /quiz/adaptivePOST /quiz/submitPOST /quiz/export-google-form
GET /user/{username}/analyticsGET /user/{username}/quizzesGET /user/{username}/quizzes/{quiz_id}DELETE /user/quizPOST /user/quiz/delete
GET /settings/aiPOST /settings/aiPOST /credentials/upload
The document quiz endpoint accepts multipart uploads with username, difficulty, num_questions, optional topic, and a file upload. Supported files are PDF, PPT/PPTX, DOC, and DOCX; the upload limit is 12 MB. For legacy .doc files, conversion to .docx or PDF is the safest path if text extraction is unavailable.
- β Bearer token required on protected endpoints.
- β User ownership checks enforced on user-scoped APIs.
- β Strict username rules + legacy alias migration support.
- β Cloud API URL allowlist for supported providers.
- β Credentials upload validation (type, size, JSON shape).
- β Document quiz uploads with file type checks, size limits, and extracted-text parsing.
- β Cloud API keys not persisted in plaintext settings files.
smartquiz-agent/
βββ api_server.py
βββ config.py
βββ requirements.txt
βββ assets/
βββ auth/
βββ core/
βββ data/
βββ frontend/
βββ services/
βββ tests/
Run core + auth smoke tests:
python -m pytest -q tests/test_core.py tests/test_auth_smoke.pyBuild frontend for production checks:
cd frontend
npm run buildBuild and run backend container:
docker build -t smartquiz-agent .
docker run --rm -p 8000:8000 smartquiz-agentContainer health check uses /health.
- π Setup details: SETUP_GUIDE.md
- π Google credentials help: CREDENTIALS_RECOVERY.md
- π€ Contribution process: CONTRIBUTING.md
- π‘οΈ Security reporting: SECURITY.md
- π Advanced progress visualizations
- π§ Better adaptive curriculum sequencing
- π§ͺ Expanded test coverage (integration + e2e)
MIT License