A modern, full-stack quiz and assessment platform rooted in curiosity, culture, and learning. Designed for curious minds everywhere.
- Project Overview
- Key Features
- Tech Stack
- Project Architecture
- Pre-Loaded Default Quizzes
- Local Development Setup
- Docker Deployment
- Vercel Production Deployment
- API Reference
- Environment Variables
- License
Quizreto is an assessment and quiz platform offering users an interactive quiz-taking experience, instant performance evaluations, attempt tracking, and quiz creation tools.
Built with a curated aesthetic inspired by timeless art and warm Indian palette accents (deep wine, saffron gold, warm cream), Quizreto combines visual excellence with a robust, enterprise-ready Python and React architecture.
- Dynamic Curated Quizzes: Instant access to starter assessments across History, Science, Computer Tech, World Geography, and Literature.
- Dynamic Question Count: Real-time retrieval of exact question counts from the backendβno static or hardcoded numbers.
- Interactive Quiz Engine: Timed/untimed quiz flows with live option selection, progress tracking, and instant score computation.
- Comprehensive Results & Analytics: Detailed score breakdowns, percentage calculation, and historical attempt analytics on personal dashboards.
- Secure Authentication: User registration and login powered by JWT Bearer tokens and Argon2 password hashing.
- Quiz Creator Studio: Intuitive interface for authenticated users to author custom quizzes with multiple-choice questions.
- Containerized Architecture: Complete Docker & Docker Compose setup for local replication and multi-cloud portability.
- Serverless Ready: Fully configured for single-project monorepo deployment on Vercel with Supabase Cloud PostgreSQL.
- Framework: React 19 + TypeScript
- Bundler & Dev Server: Vite 8
- Styling: Tailwind CSS v4 + Custom Palette Tokens
- Icons & Animation: Lucide React & Canvas Confetti
- Routing: React Router v7
- HTTP Client: Axios with token interceptors and user-friendly error formatting
- Framework: FastAPI (Python 3.11 / 3.12)
- ASGI Server: Uvicorn
- ORM & Data Layer: SQLAlchemy 2.0
- Database Migrations: Alembic
- Authentication:
python-jose(JWT) +passlib[argon2] - Validation: Pydantic v2
- Database: PostgreSQL 16 / Supabase Cloud (Session Pooler with SSL)
- Containers: Docker & Docker Compose
- Hosting: Vercel (Multi-Service Unified Deployment)
Quizreto/
βββ api/ # Vercel serverless entrypoint
β βββ index.py # ASGI bridge to FastAPI backend
βββ backend/ # FastAPI Application
β βββ alembic/ # Database migration versions
β βββ app/
β β βββ core/ # Security (JWT, Argon2) & dependencies
β β βββ models/ # SQLAlchemy ORM models (User, Quiz, Question, Attempt)
β β βββ routers/ # API endpoints (auth, quiz, question, attempt)
β β βββ schemas/ # Pydantic validation schemas
β β βββ services/ # Business logic & starter quiz seeder
β β βββ database.py # Database engine & SessionLocal with IPv4 pooler
β β βββ main.py # FastAPI application initialization & middleware
β βββ Dockerfile # Backend container definition
β βββ entrypoint.sh # Startup script (runs Alembic then Uvicorn)
β βββ main.py # Root backend entrypoint
β βββ requirements.txt # Python backend dependencies
βββ frontend/ # React Vite Application
β βββ src/
β β βββ api/ # Axios client & typed API wrappers
β β βββ components/ # UI, Quiz, Layout, and Dashboard components
β β βββ context/ # AuthContext & state providers
β β βββ pages/ # Dashboard, Explore, QuizAttempt, Result, Login, Profile
β β βββ types/ # TypeScript API interfaces
β βββ Dockerfile # Multi-stage frontend container (Node build + Nginx)
β βββ nginx.conf # SPA routing fallback & API reverse proxy
β βββ package.json # NPM scripts and dependencies
βββ docker-compose.yml # 3-tier local container orchestration (DB, API, Web)
βββ requirements.txt # Root Python requirements for Vercel
βββ vercel.json # Vercel Services multi-app deployment config
βββ README.md # Project documentation
Quizreto seeds starter assessments into the database automatically on startup:
| Quiz Title | Category | Questions | Highlights |
|---|---|---|---|
| Indian Constitution & Polity | History / Polity |
5 | Dr. B.R. Ambedkar, Constituent Assembly, Article 32, Fundamental Rights |
| Wonders of General Science & Astronomy | Science |
5 | Planetary moons, cellular mitochondria, atmospheric nitrogen, speed of light |
| Core Computer Science & Web Tech | Technology |
5 | HTTP, LIFO stack mechanics, Binary Search Trees, SQL, HTTPS/TLS |
| World Geography & Natural Wonders | Geography |
5 | Nile River, Canadian lakes, Mount Everest, Vatican City, Gibraltar Strait |
| Literary Classics & Nobel Laureates | Literature |
5 | Rabindranath Tagore, Shakespeare's Hamlet, Jane Austen, 1984 |
- Python 3.11+
- Node.js 20+
- PostgreSQL (local or cloud Supabase)
# Navigate to backend directory
cd backend
# Create and activate virtual environment
python -m venv .venv
# On Windows:
.\.venv\Scripts\activate
# On Linux/macOS:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Configure environment in backend/.env:
# DATABASE_URL=postgresql+psycopg2://user:password@localhost:5432/quizreto
# SECRET_KEY=your_secret_key_here
# ALGORITHM=HS256
# ACCESS_TOKEN_EXPIRE_MINUTES=60
# Run migrations
alembic upgrade head
# Start FastAPI server
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000Swagger API docs will be available at: http://127.0.0.1:8000/docs
# In a new terminal, navigate to frontend
cd frontend
# Install packages
npm install
# Start Vite development server
npm run devOpen http://localhost:5173 in your browser. (The Vite proxy routes /api/* to 127.0.0.1:8000 automatically).
The repository includes a ready-to-run 3-tier architecture with Docker Compose:
quizreto-db: PostgreSQL 16 Alpine with healthcheck.quizreto-backend: FastAPI application waiting for database readiness and auto-migrating schema.quizreto-frontend: Lightweight Nginx alpine server serving the compiled React bundle and proxying/apiinternally.
# Start all services
docker compose up -d
# View live container logs
docker compose logs -f
# Stop all services
docker compose downAccess the app at:
- Frontend:
http://localhost(orhttp://localhost:5173) - Backend API Docs:
http://localhost:8001/docs
Quizreto is configured for Vercel Services, allowing both the Vite frontend and FastAPI backend to deploy together under one custom domain.
- Create a free PostgreSQL project at Supabase.
- Use the Session Pooler (IPv4) URI under Project Settings > Database > Connection string:
postgresql+psycopg2://postgres.[project-ref]:[PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgres?sslmode=require
- Go to Vercel and import the GitHub repository.
- Vercel automatically detects the Services preset:
frontend(Vite) at/backend(FastAPI) at/api
- Add the following Environment Variables:
DATABASE_URL: Your Supabase connection stringSECRET_KEY: Random 32+ character stringALGORITHM:HS256ACCESS_TOKEN_EXPIRE_MINUTES:60CORS_ORIGINS:*
- Click Deploy. Both the frontend SPA and backend API will deploy live!
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/auth/register |
Register a new user | No |
POST |
/api/auth/login |
Login and receive JWT access token | No |
GET |
/api/auth/me |
Fetch authenticated user profile | Yes |
GET |
/api/quizzes |
List all quizzes with dynamic question count | No |
GET |
/api/quizzes/{id} |
Get quiz details with questions | No |
POST |
/api/quizzes |
Create a new quiz | Yes |
POST |
/api/questions |
Add question to a quiz | Yes |
POST |
/api/attempts/submit |
Submit answers and receive score/percentage | Yes |
GET |
/api/attempts/my-attempts |
Fetch user's attempt history | Yes |
GET |
/api/attempts/my-stats |
Fetch aggregate stats (average score, total taken) | Yes |
GET |
/health |
Server and database health check | No |
| Variable | Description | Example |
|---|---|---|
DATABASE_URL |
SQLAlchemy PostgreSQL connection URI | postgresql+psycopg2://user:pass@host:5432/db?sslmode=require |
SECRET_KEY |
Secret key used to sign JWT tokens | your-secret-random-key-32-chars |
ALGORITHM |
Token encoding algorithm (default: HS256) | HS256 |
ACCESS_TOKEN_EXPIRE_MINUTES |
Token expiration duration in minutes | 60 |
CORS_ORIGINS |
Permitted CORS origins (comma-separated or *) |
* |
VITE_API_URL |
Frontend API base URL (optional, defaults to "" for relative) |
https://your-api.com |
This project is licensed under the MIT License. Built with β€οΈ for learners, educators, and quiz enthusiasts worldwide.