Contributing to ClassQuiz
Thank you for your interest in contributing to ClassQuiz! This guide will help you get started with development and contributing to the project.Quick Links
- Repository: github.com/mawoka-myblock/ClassQuiz
- Documentation: classquiz.de/docs
- Community: Matrix Space
- Hosted Instance: classquiz.de
Code of Conduct
Be respectful and constructive. ClassQuiz is an educational project, and we want to maintain a welcoming environment for all contributors.Ways to Contribute
1. Report Bugs
Found a bug? Please report it! Before reporting:- Search existing issues to avoid duplicates
- Try to reproduce with adblocker disabled (for Sentry error tracking)
- Contact the maintainer at mawoka.eu/contact
- Do NOT open a public issue for security vulnerabilities
- Open an issue on GitHub Issues
- Include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Browser/OS version
- Console errors (if any)
2. Suggest Features
Have an idea for ClassQuiz?- Open a GitHub issue with the
enhancementlabel - Describe the feature and its use case
- Explain why it would benefit ClassQuiz users
3. Translate
ClassQuiz uses Weblate for translations. To translate:- Go to Weblate project
- Select your language
- Start translating!
- If your language isn’t available, open a GitHub issue to request it
4. Write Code
Contribute features, bug fixes, or improvements!Development Setup
ClassQuiz is a monorepo with a Python backend and SvelteKit frontend.Prerequisites
Required:- Python 3.11+
- Node.js 18+ and npm/pnpm
- PostgreSQL 13+
- Redis 6+
- Meilisearch (for search functionality)
- Docker & Docker Compose (for easy setup)
Repository Structure
Setup with Docker (Recommended)
1. Clone the repository:.env for development:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/api/docs
Manual Setup (Without Docker)
1. Install PostgreSQL:Development Workflow
Backend Development
Run tests:Frontend Development
Run dev server:Making Changes
1. Create a Branch
feature/- New featuresfix/- Bug fixesdocs/- Documentationrefactor/- Code refactoringtest/- Test additions/changes
2. Write Code
Backend guidelines:- Follow PEP 8 style guide
- Use type hints
- Write docstrings for public functions
- Add tests for new features
- Use async/await for I/O operations
- Follow TypeScript best practices
- Use Svelte conventions
- Keep components small and focused
- Use TailwindCSS for styling
- Add types for props and functions
3. Write Tests
Backend tests (pytest):- ClassQuiz doesn’t currently have extensive frontend tests
- Contributions to add testing are welcome!
4. Format Commits
ClassQuiz uses Gitmoji for commit messages. Format:- ✨
:sparkles:- New feature - 🐛
:bug:- Bug fix - 📝
:memo:- Documentation - 🎨
:art:- Code style/formatting - ♻️
:recycle:- Refactoring - ⚡️
:zap:- Performance improvement - 🔒️
:lock:- Security fix - ⬆️
:arrow_up:- Upgrade dependencies - ✅
:white_check_mark:- Add tests
5. Push and Create PR
- Open a Pull Request
- Describe your changes
- Link related issues (e.g., “Fixes #123”)
- Wait for review
Code Review Process
- Automated checks: CI runs linting, type checking, and tests
- Manual review: Maintainer reviews code
- Revisions: Address feedback if needed
- Merge: Once approved, PR is merged
- Code quality and style
- Test coverage
- Documentation
- Security implications
- Performance impact
- Breaking changes
License
ClassQuiz is licensed under the Mozilla Public License 2.0. IMPORTANT: This is a copyleft license. You MUST publish any changes you make to the source code. What this means:- ✅ You can use ClassQuiz commercially
- ✅ You can modify the code
- ✅ You can distribute it
- ❌ You MUST share your modifications
- ❌ You MUST use the same license
- ❌ You MUST provide source code
- By submitting a PR, you agree to license your contribution under MPL-2.0
- Add SPDX headers to new files:
Getting Help
Need help contributing?- Join Matrix: #classquiz:matrix.org
- Read docs: classquiz.de/docs/develop
- Ask in issues: Comment on related issues
- Check discussions: GitHub Discussions (if enabled)
Development Resources
Backend
Frontend
Tools
- Alembic - Database migrations
- Meilisearch - Search engine
- Redis - Cache and sessions
Architecture References
Before contributing, familiarize yourself with:- System Architecture - High-level architecture overview
- Socket.IO Events - Real-time communication reference
- Database Models - Database schema documentation
Common Tasks
Add a New API Endpoint
- Create/edit router file in
classquiz/routers/ - Define Pydantic models for request/response
- Implement endpoint with type hints
- Add to main app in
classquiz/__init__.py - Test with
/api/docsinteractive documentation
Add a New Database Model
- Add model to
classquiz/db/models.py - Create Alembic migration:
alembic revision --autogenerate -m "Add model" - Review generated migration
- Apply:
alembic upgrade head
Add a New Socket.IO Event
- Add event handler to
classquiz/socket_server/__init__.py - Define Pydantic model in
classquiz/socket_server/models.py - Implement handler logic
- Document in Socket.IO Events page
- Implement client-side handler in frontend
Add a New Frontend Page
- Create file in
frontend/src/routes/ - Add
+page.sveltefor component - Add
+page.tsfor data loading (if needed) - Add
+page.server.tsfor server-side logic (if needed) - Use TailwindCSS for styling
Performance Guidelines
Backend:- Use async/await for all I/O
- Avoid N+1 queries (use
.select_related()) - Cache frequently accessed data in Redis
- Use database indexes for common queries
- Set appropriate Redis expiry times
- Lazy load heavy components
- Use SvelteKit’s streaming and lazy loading
- Optimize images (use WebP, thumbnails)
- Minimize bundle size
- Use code splitting
Security Guidelines
Always:- Validate user input with Pydantic
- Use parameterized queries (Ormar does this)
- Hash passwords (use
passlib) - Check authorization for protected endpoints
- Sanitize HTML output (use DOMPurify)
- Use HTTPS in production
- Set secure cookie flags
- Store passwords in plaintext
- Trust user input without validation
- Expose sensitive data in API responses
- Commit secrets to Git
- Use
eval()or similar on user input