Skip to content
prianshumitraPublic

About

QuizReto is a full-stack online quiz and assessment platform that enables users to take quizzes, track their scores, and review their performance. It features secure authentication, quiz and question management, automated score evaluation, and user profiles.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

18 Commits

Folders and files

Repository files navigation

🌟 Quizreto β€” Knowledge Has No Boundaries

A modern, full-stack quiz and assessment platform rooted in curiosity, culture, and learning. Designed for curious minds everywhere.

Vercel Docker FastAPI React PostgreSQL TailwindCSS


πŸ“– Table of Contents


🎯 Project Overview

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.


✨ Key Features

  • 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.

πŸ› οΈ Tech Stack

Frontend

Backend

Database & Infrastructure


πŸ“‚ Project Architecture

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

πŸ“š Pre-Loaded Default Quizzes

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

πŸ’» Local Development Setup

Prerequisites

  • Python 3.11+
  • Node.js 20+
  • PostgreSQL (local or cloud Supabase)

1. Backend Setup

# 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 8000

Swagger API docs will be available at: http://127.0.0.1:8000/docs

2. Frontend Setup

# In a new terminal, navigate to frontend
cd frontend

# Install packages
npm install

# Start Vite development server
npm run dev

Open http://localhost:5173 in your browser. (The Vite proxy routes /api/* to 127.0.0.1:8000 automatically).


🐳 Docker Deployment

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 /api internally.
# Start all services
docker compose up -d

# View live container logs
docker compose logs -f

# Stop all services
docker compose down

Access the app at:

  • Frontend: http://localhost (or http://localhost:5173)
  • Backend API Docs: http://localhost:8001/docs

πŸš€ Vercel Production Deployment

Quizreto is configured for Vercel Services, allowing both the Vite frontend and FastAPI backend to deploy together under one custom domain.

1. Database (Supabase)

  1. Create a free PostgreSQL project at Supabase.
  2. 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
    

2. Import into Vercel

  1. Go to Vercel and import the GitHub repository.
  2. Vercel automatically detects the Services preset:
    • frontend (Vite) at /
    • backend (FastAPI) at /api
  3. Add the following Environment Variables:
    • DATABASE_URL: Your Supabase connection string
    • SECRET_KEY: Random 32+ character string
    • ALGORITHM: HS256
    • ACCESS_TOKEN_EXPIRE_MINUTES: 60
    • CORS_ORIGINS: *
  4. Click Deploy. Both the frontend SPA and backend API will deploy live!

πŸ“‘ API Reference

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

πŸ”‘ Environment Variables

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

πŸ“„ License

This project is licensed under the MIT License. Built with ❀️ for learners, educators, and quiz enthusiasts worldwide.

About

QuizReto is a full-stack online quiz and assessment platform that enables users to take quizzes, track their scores, and review their performance. It features secure authentication, quiz and question management, automated score evaluation, and user profiles.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages