A lightweight, interactive learning platform for Python — lessons, quizzes, coding challenges and an in-browser Python runner (Pyodide). This repository contains a Vite + React frontend and an Express + MySQL backend used by the application.
- Lesson viewer with YouTube / document resources
- Multiple-choice quizzes (MCQ) with anti-cheat measures
- Problem solving arena with an in-browser Python runner (Pyodide)
- Save MCQ results and problem attempts to MySQL
- Certificate generator (PNG) after solving 5 problems
- Dashboard with aggregated user stats and recent activity
Pylab/— frontend + backend workspacesrc/— React frontend pages and componentsbackend/— Express server, DB connection (db.js) and API (server.js)Db/pylab (2).sql— SQL dump with schema and seed data
- Node.js (16+ recommended) and npm
- MySQL / MariaDB (import the provided SQL)
- Internet connection (Pyodide loads from CDN)
-
Import the database
-
Create a database (e.g.
pylab) and importPylab/Db/pylab (2).sqlusing your preferred client (phpMyAdmin, MySQL CLI, Workbench).Example (MySQL CLI):
mysql -u root -p pylab < "D:/Xampp/htdocs/PyLab_Arena/Pylab/Db/pylab (2).sql"
-
-
Backend
-
Install dependencies and start the server:
cd "D:/Xampp/htdocs/PyLab_Arena/Pylab/backend" npm install # set environment variables in a .env file or your shell node server.js
-
Environment variables (create
.envin backend folder):DB_HOST=127.0.0.1 DB_USER=root DB_PASSWORD=your_db_password DB_NAME=pylab PORT=4000
-
-
Frontend
-
Install and run the frontend (Vite)
cd "D:/Xampp/htdocs/PyLab_Arena/Pylab" npm install npm run dev -
By default the frontend uses
http://localhost:4000as the API base. If your backend is hosted on a different URL, setVITE_API_URLin your environment before starting the frontend:$env:VITE_API_URL = 'http://localhost:4000'; npm run dev
-
POST /api/register— { name, email, password }POST /api/login— { email, password }GET /api/levels— list levelsGET /api/lessons— list lessons (optional?level=)GET /api/lessons/:id— lesson details (content, youtube_link, document_link)GET /api/lessons/:id/mcq— fetch MCQs for a lessonPOST /api/lessons/:id/mcq/result— save MCQ score { user_id, score }GET /api/problems— list problemsGET /api/problems/:id— get single problemPOST /api/problems/:id/attempt— save problem attempt { user_id, score, submission }GET /api/users/:id/stats— aggregated stats and recent activity
Note: Some endpoints return optional fields: template (starter code) and expected_output (used by the frontend to auto-judge). If the DB does not include those columns, the server will still work (it falls back gracefully).
- The frontend includes a client-side certificate generator at
/certificate. It requires that the logged-in user has at least 5 solved problems (this threshold is fixed). The certificate is drawn on canvas and downloaded as a PNG — no server-side composer required.
- Attempts are saved in
problem_results. The app saves the submission code (ifsubmissioncolumn exists) and a numeric score (frontend uses 100 for correct, 0 for wrong by default). - To store code on the server, add the
submissioncolumn toproblem_results:
ALTER TABLE problem_results ADD COLUMN submission TEXT DEFAULT NULL;- If you want server-side certificate issuance or storage, I can add endpoints to save generated images and provide a user certificate history.
- For a richer editor, integrate Monaco or CodeMirror instead of the textarea used now.
- Consider adding server-side judging (sandboxed runner) if you want authoritative scoring rather than client-side Pyodide checks.
- Sandhosh G — creator
- GitHub: https://github.com/SANDHOSH02
- Portfolio: https://sandhosh.vercel.app/
- LinkedIn: https://www.linkedin.com/in/sandhosh-g-884b7b279/
This project does not include a license file by default. Add a LICENSE file (MIT or similar) if you want to open-source it.
Below is a simple 3x3 gallery — this will render on GitHub and other Markdown viewers. Replace the files in ss/ with your actual overall screenshots.








