Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ CodeGrader

An automated online coding assignment platform built with Django & Django REST Framework

Teachers create programming assignments with test cases. Students submit Python solutions and get instant, automated grading with detailed feedback.

Python Django DRF PostgreSQL JWT License

Live Demo Β· Report Bug Β· Request Feature


πŸ“– Table of Contents


πŸ“Œ About

CodeGrader is a full-stack coding assignment platform that automates the process of setting, submitting, and grading programming assignments. Teachers can create assignments with multiple hidden/visible test cases, deadlines, and marks. Students submit Python code that is automatically executed and evaluated, receiving instant per-test-case feedback and a leaderboard ranking.

The project exposes both a server-rendered web UI and a complete REST API (with JWT authentication), making it usable as a standalone web app or as a backend for a separate frontend/mobile client.

🌍 Live Demo

The project is deployed and publicly accessible.

πŸ”— App URL: https://codegrader.up.railway.app

✨ Features

πŸ‘¨β€πŸ« Teacher

  • Secure teacher login with role-based authorization
  • Create coding assignments with descriptions, deadlines, and marks
  • Add multiple test cases (input/expected output) per assignment
  • View all assignments and track submissions

πŸ‘¨β€πŸŽ“ Student

  • Registration and login
  • Browse available assignments
  • Submit Python solutions through the web UI or API
  • Automatic code execution against all test cases
  • Instant grading with per-test-case pass/fail feedback
  • Personal dashboard with submission statistics

πŸ“Š Dashboard

  • Total submissions count
  • Best score achieved
  • Recent submission history

πŸ† Leaderboard

  • Ranking by highest score
  • Live score updates as students submit

πŸ” Authentication & Security

  • Django's built-in authentication system
  • Role-based access control (Teacher / Student)
  • JWT authentication for the REST API
  • Session authentication for the DRF Browsable API

🌐 REST API

A complete, browsable REST API built with Django REST Framework, supporting registration, login, assignment management, and submission/grading β€” all consumable by external clients (e.g. a React/Vue SPA or mobile app).

πŸ›  Tech Stack

Layer Technology
Backend Python, Django, Django REST Framework
Database PostgreSQL (production), SQLite (local dev)
Auth JWT (djangorestframework-simplejwt), Django Session Auth
Frontend Django Templates, HTML, CSS, JavaScript
Styling Tailwind CSS, DaisyUI
Deployment Deployed to production (see Live Demo)

πŸ“Έ Screenshots

Assignment Dashboard Submission Result Submission History
Assignment Dashboard Submission Result Submission History

πŸ“‚ Project Structure

codegrader/
β”‚
β”œβ”€β”€ accounts/          # User auth, registration, roles (teacher/student)
β”œβ”€β”€ assignments/       # Assignment & test case models, views
β”œβ”€β”€ submissions/       # Submission handling, code evaluation, grading
β”œβ”€β”€ templates/         # Django HTML templates
β”œβ”€β”€ theme/             # Tailwind CSS / DaisyUI theme config
β”œβ”€β”€ manage.py
└── requirements.txt

βš™οΈ Getting Started

Prerequisites

  • Python 3.10+
  • PostgreSQL (for production-like setup) or SQLite (quick local testing)
  • pip and venv

Installation

# 1. Clone the repository
git clone https://github.com/Unnati-29/CodeGrader.git
cd CodeGrader

# 2. Create and activate a virtual environment
python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Configure environment variables
cp .env.example .env   # then fill in your values (see below)

# 5. Apply migrations
python manage.py migrate

# 6. Create an admin/superuser account
python manage.py createsuperuser

# 7. Run the development server
python manage.py runserver

Open your browser at:

http://127.0.0.1:8000/

πŸ”‘ Environment Variables

Create a .env file in the project root (do not commit this file):

SECRET_KEY=your-django-secret-key
DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1,your-domain.com

DATABASE_URL=postgres://user:password@host:port/dbname

JWT_ACCESS_TOKEN_LIFETIME_MINUTES=60
JWT_REFRESH_TOKEN_LIFETIME_DAYS=7

Adjust variable names to match however settings.py is currently configured (e.g. if using django-environ or python-decouple).

🌐 API Reference

Base URL: /api/

Endpoint Method Description Auth Required
/api/auth/register/ POST Register a new user (student/teacher) No
/api/auth/login/ POST Log in, returns JWT tokens No
/api/auth/profile/ GET Get logged-in user's profile Yes
/api/assignments/ GET List all assignments Yes
/api/assignments/ POST Create a new assignment (teacher only) Yes
/api/submissions/ GET List submissions (own / all for teacher) Yes
/api/submissions/ POST Submit code for grading Yes

Authentication: Include the JWT access token in requests:

Authorization: Bearer <access_token>

The API is also explorable via the DRF Browsable API in a web browser, and supports Session Authentication for that purpose.

πŸ”„ Workflow

Teacher

  1. Register / Login
  2. Create an assignment
  3. Add test cases, set deadline & marks
  4. Students are notified / can view the assignment

Student

  1. Register / Login
  2. Browse available assignments
  3. Submit Python code
  4. Code is automatically executed and evaluated
  5. Receive score & detailed per-test-case feedback
  6. Leaderboard updates in real time

πŸ—Ί Roadmap

Planned enhancements for future releases:

  • Containerized code execution sandbox (Docker) for safe/isolated code runs
  • Redis + Celery for asynchronous grading
  • Multi-language support (C++, Java, in addition to Python)
  • Plagiarism detection
  • Email notifications (new assignments, results)
  • Assignment-level analytics for teachers
  • Submission status states (Pending / Running / Accepted / Wrong Answer)
  • Dedicated teacher dashboard with class-wide insights
  • Student progress tracking over time

πŸ“Œ Project Status

Current Version: v1.1

  • βœ… Deployed to production
  • βœ… PostgreSQL as the production database
  • βœ… Template-based web application
  • βœ… REST API (DRF)
  • βœ… JWT authentication
  • βœ… Role-based access control
  • βœ… Automatic code evaluation
  • βœ… Dashboard & leaderboard
  • βœ… Assignment management

In Progress / Upcoming

  • 🚧 Docker-based code execution sandbox
  • 🚧 Multi-language compiler support
  • 🚧 Advanced analytics

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m "Add: your feature")
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Please open an issue first to discuss significant changes.

πŸ‘©β€πŸ’» Author

Unnati Raj Mechanical Engineering Undergraduate, NIT Silchar Aspiring Software Development Engineer | Django Β· DRF Β· DSA Β· Web Development

If you found this project useful, consider giving it a ⭐ on GitHub!

About

A Django-powered online coding assignment and automated evaluation platform with role-based authentication, leaderboards, and student dashboards.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages