How mawoka-myblock/classquiz works
Project type and purpose
• This is a full-stack, monorepo quiz platform called ClassQuiz.
• Frontend: SvelteKit + TailwindCSS
• Backend: FastAPI + ormar ORM + python-socketio for real-time.
• Self-hostable with Postgres (DB), Redis (cache), Meilisearch (search), Caddy (reverse proxy).
• Students join live quizzes; teachers create and manage quizzes; real-time answer collection and scoring.
File structure
• Top level
– Dockerfile, docker-compose.yml, Caddyfile: containerization and proxy.
– Pipfile, pyproject.toml, alembic.ini, migrations/: Python backend and DB migrations.
– classquiz/: core backend code, divided into subpackages (auth, db, oauth, routers, storage, socket_server, worker).
– frontend/: SvelteKit code, with src/routes (all pages), src/lib (UI components, stores, sockets), assets, config files.
– scripts (import_to_meili.py, image_cleanup.py, simulate_players.py, start.sh): utility and start-up scripts.
• Backend structure
– classquiz/routers: HTTP endpoints organized by domain (login, quiz, results, admin, socket-controller).
– classquiz/socket_server: standalone Socket.IO server code for embedded controllers.
– classquiz/worker: background tasks (e.g., storage).
– classquiz/storage: abstraction over local and S3.
– classquiz/db: ormar models and DB initialization.
– alembic migrations track schema evolution.
• Frontend structure
– src/routes: SvelteKit page routes mirroring site map (account, dashboard, play, quiztivity, docs).
– src/lib: reusable components (editor, play UI, modals, stores, sockets), utils, assets, i18n.
– src/lib/socket.ts: client socket-io integration.
README for additional insights
• Monorepo with clearly separated frontend and backend.
• External dependencies: Meilisearch (search), Caddy (proxy), Postgres, Redis.
• 3rd-party closed services: Mapbox (maps), hCaptcha (captcha).
• Live mode uses websockets via python-socketio.
Detail & scope
• Break backend into HTTP API and real-time socket server.
• Caddy reverse proxy routing to either frontend or backend.
• Migration tooling (Alembic) under backend for completeness if desired.