A web-based math quiz game platform built with FastAPI and PostgreSQL. Players solve math problems, progress through difficulty stages, and compete for high scores.
- 🔐 User Authentication: Secure signup/login with JWT tokens
- 🎮 Math Quiz Game: Dynamic question generation based on difficulty levels
- 📊 Score Tracking: Real-time score updates and session management
- 🏆 Leaderboards: Top player rankings
- 📈 Player Statistics: Historical performance tracking
- FastAPI - Async Python Web framework
- SQLAlchemy - ORM for database operations
- PostgreSQL - Relational database
- JWT - Token-based authentication
- Uvicorn - ASGI server
- Vanilla JavaScript (ES6 modules) - Client-side logic
- Jinja2 Templates - Server-side HTML rendering
- CSS - Styling
- Docker and Docker Compose installed
- Python 3.11+ (for local development)
1.Start the application ( Builds Docker images and starts containers)
docker system prune -a --volumes (only if you want to remove all unused data)
docker-compose build --no-cache
docker-compose up- Access the application
- Web UI: http://localhost:8000
- API Docs: http://localhost:8000/docs
-
Install dependencies
python -m pip install -r requirements.txt
-
Set up PostgreSQL database
- Ensure PostgreSQL is running
- Update environment variables in
.envfile
-
Run the application
uvicorn main:app --reload
To run the test suite (or a specific test file) inside the application container, use:
docker compose run web pytest tests
docker compose run web pytest tests/test_rate_limit.py