AssafWaknin/quiz-app
À propos
Generic quiz app template - Flask + SQLite + Docker + Cloudflare SSL
Systèmes et infrastructureWhat you can do
- Topic filtering - Filter questions by category
- Quiz modes - Regular quiz, bookmarks only, wrong answers review
- Dark mode - Toggle with localStorage persistence
- Explanation popups - Show correct answer and explanation on wrong answers
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalGeneric Quiz App
A fully containerized, production-ready quiz application with Flask + SQLite + Docker, designed for any topic or domain.
Features
- Topic filtering - Filter questions by category
- Quiz modes - Regular quiz, bookmarks only, wrong answers review
- Dark mode - Toggle with localStorage persistence
- Explanation popups - Show correct answer and explanation on wrong answers
- Progress tracking - Per-browser progress with localStorage (no login required)
- Responsive design - Works on desktop and mobile
- Production ready - Gunicorn WSGI server, nginx reverse proxy, SSL/TLS
Tech Stack
- Backend: Flask (Python), Gunicorn
- Database: SQLite (file-based, persistent volume)
- Frontend: Vanilla HTML5, CSS3, JavaScript (no frameworks)
- Container: Docker + Docker Compose
- Reverse Proxy: nginx (Alpine)
- SSL: Cloudflare Origin Certificate (15-year validity)
- CDN/DDoS: Cloudflare (proxied)
Quick Start
1. Run the setup script
chmod +x setup.sh
./setup.sh
This will prompt you for:
- Site title (e.g., "AZ-104 Quiz", "AWS Practitioner Prep")
- Domain name (e.g., "quiz.example.com")
2. Add your questions
Edit questions.json with your quiz questions:
[
{
"id": 1,
"topic": "Category Name",
"question": "What is the question?",
"options": {
"A": "Option A",
"B": "Option B",
"C": "Option C",
"D": "Option D"
},
"answer": "B",
"explanation": "The correct answer is B because..."
}
]
3. Create Cloudflare Origin Certificate
- Log into Cloudflare dashboard
- Go to SSL/TLS → Origin Server
- Click Create Certificate
- Keep defaults (RSA 2048, 15 years)
- Download both files:
- Origin Certificate → save as
nginx/certs/cert.pem - Private Key → save as
nginx/certs/cert.key
- Origin Certificate → save as
4. Add DNS record in Cloudflare
- Go to your domain in Cloudflare
- DNS → Records → Add record
- Type: A
- Name: your subdomain (e.g.,
quiz) - IPv4: your server's public IP
- Proxy: ON (orange cloud)
5. Set SSL/TLS mode
In Cloudflare dashboard:
- Go to SSL/TLS
- Set encryption mode to Full
6. Deploy
docker compose up -d --build
Your site will be live at https://your-domain.com within a minute.
Directory Structure
.
├── Dockerfile
├── docker-compose.yml
├── setup.sh
├── config.json (site configuration)
├── questions.json (your quiz questions)
├── requirements.txt
├── .dockerignore
├── data/ (auto-created, persistent)
│ └── questions.db
├── nginx/
│ ├── site.conf
│ └── certs/
│ ├── cert.pem (Cloudflare Origin Certificate)
│ └── cert.key (Cloudflare Private Key)
├── static/
│ ├── css/
│ │ └── style.css
│ └── js/
│ └── app.js
└── templates/
└── index.html
Configuration
Site Title
Edit config.json:
{
"site_title": "Your Quiz Title",
"site_description": "Description here"
}
Then restart the container:
docker compose restart flask
Adding More Questions
- Edit
questions.jsonwith your new questions - Restart the Flask container:
docker compose restart flask
The database will be rebuilt automatically with your new questions.
Customizing Styles
Edit static/css/style.css to change colors, fonts, or layout. The app uses CSS variables for theming:
:root {
--bg-primary: #f5f7fa;
--accent: #4299e1;
--success: #48bb78;
/* ... more variables ... */
}
Then rebuild the container:
docker compose up -d --build
Troubleshooting
Container won't start
Check logs:
docker compose logs nginx
docker compose logs flask
SSL certificate errors
Make sure your certificate files are in the right location:
ls -la nginx/certs/
# Should show cert.pem and cert.key
Questions not loading
Check if the database was created:
docker compose exec flask ls -la /app/data/
# Should show questions.db
DNS not resolving
Wait 5-10 minutes for DNS propagation, or check:
dig your-domain.com
License
MIT License - feel free to use this for any quiz topic or commercial project.
Credits
Built with Flask, Docker, and nginx. Designed for Cloudflare SSL termination.
Explorer des projets similaires
Chargement…