drmacsika /
drf-auth-project-starter
Production-ready Project starter for RESTFul API Backend Using Django Rest Framework. This project is for Django Rest Framework (DRF). If you need a version with only Django, use the link below.
Loading repository data…
GregoryCardillo / repository
A production-ready RESTful API for an e-learning platform built with Django REST Framework. Features JWT authentication, role-based permissions, automated progress tracking, comprehensive testing, and OpenAPI documentation.
A comprehensive and production-ready RESTful API for an e-learning platform built with Django and Django REST Framework.
A full-stack e-learning solution with JWT authentication, role-based permissions, course management, progress tracking, and comprehensive testing.
User (Custom AbstractBaseUser)
├── Student (role='student')
└── Instructor (role='instructor')
Course
├── instructor: FK(User)
└── Module
└── Lesson
└── Quiz
└── Question
└── AnswerChoice
Enrollment
├── student: FK(User)
├── course: FK(Course)
└── Progress
└── lesson: FK(Lesson)
git clone https://github.com/yourusername/LearnHub-API.git
cd LearnHub-API
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your configuration
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
The API provides comprehensive interactive documentation:
Swagger UI: http://127.0.0.1:8000/api/docs/
ReDoc: http://127.0.0.1:8000/api/redoc/
OpenAPI Schema: http://127.0.0.1:8000/api/schema/
Most endpoints require authentication. To authenticate:
POST /api/auth/register/POST /api/auth/login/ Authorization: Bearer <your_access_token>
The project has comprehensive test coverage (92%+) with 58 tests across models, serializers, views, and permissions.
pytest
pytest --cov=courses --cov-report=html
pytest courses/tests/test_api.py
pytest courses/tests/test_api.py::TestCourseAPI
# Generate HTML report
pytest --cov=courses --cov-report=html
# Open in browser
open htmlcov/index.html # macOS
xdg-open htmlcov/index.html # Linux
start htmlcov/index.html # Windows
elearning_platform/
├── config/ # Project configuration
│ ├── settings.py # Django settings
│ ├── urls.py # Main URL configuration
│ └── wsgi.py # WSGI configuration
├── courses/ # Main application
│ ├── migrations/ # Database migrations
│ ├── tests/ # Test suite
│ │ ├── conftest.py # Pytest fixtures
│ │ ├── factories.py # Test data factories
│ │ ├── test_models.py
│ │ ├── test_serializers.py
│ │ ├── test_api.py
│ │ └── test_permissions.py
│ ├── admin.py # Django admin configuration
│ ├── models.py # Database models
│ ├── serializers.py # DRF serializers
│ ├── views.py # API views
│ ├── permissions.py # Custom permissions
│ ├── filters.py # Custom filters
│ └── urls.py # App URL routing
├── media/ # User-uploaded files
├── static/ # Static files
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
├── manage.py # Django management script
├── pytest.ini # Pytest configuration
├── requirements.txt # Python dependencies
└── README.md # This file
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register/ | Register new user | ❌ |
| POST | /api/auth/login/ | Login and get tokens | ❌ |
| POST | /api/auth/logout/ | Logout (blacklist token) | ✅ |
| POST | /api/auth/refresh/ | Refresh access token | ❌ |
| GET | /api/auth/verify/ | Verify token validity | ✅ |
| PUT | /api/auth/change-password/ | Change password | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/users/me/ | Get current user profile | ✅ |
| PUT | /api/users/me/ | Update user profile | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/courses/ | List all published courses | ❌ |
| POST | /api/courses/ | Create course (instructors only) | ✅ |
| GET | /api/courses/{slug}/ | Get course details | ❌ |
| PUT | /api/courses/{slug}/ | Update course (owner only) | ✅ |
| DELETE | /api/courses/{slug}/ | Delete course (owner only) | ✅ |
| GET | /api/courses/{slug}/modules/ | List course modules | ❌ |
| POST | /api/courses/{slug}/enroll/ | Enroll in course | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/instructor/courses/ | List instructor's courses | ✅ |
| GET | /api/courses/{slug}/students/ | View enrolled students | ✅ |
| POST | /api/courses/{slug}/modules/create/ | Create module | ✅ |
| POST | /api/modules/{id}/lessons/create/ | Create lesson | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/student/dashboard/ | Get dashboard stats | ✅ |
| GET | /api/enrollments/ | List my enrollments | ✅ |
| GET | /api/enrollments/{id}/ | Get enrollment details | ✅ |
| POST | /api/enrollments/{id}/unenroll/ | Unenroll from course | ✅ |
| GET | /api/enrollments/{id}/certificate/ | Get certificate | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/enrollments/{id}/progress/ | Get enrollment progress | ✅ |
| POST | /api/enrollments/{id}/lessons/{lesson_id}/complete/ | Mark lesson complete | ✅ |
| POST | /api/enrollments/{id}/lessons/{lesson_id}/reset/ | Reset lesson progress | ✅ |
Filter courses by level:
GET /api/courses/?level=beginner
Search courses:
GET /api/courses/?search=python
Filter by price range:
GET /api/courses/?min_price=0&max_price=50
Combine filters:
GET /api/courses/?level=beginner&is_free=true&search=django&ordering=-created_at
Selected from shared topics, language and repository description—not editorial ratings.
drmacsika /
Production-ready Project starter for RESTFul API Backend Using Django Rest Framework. This project is for Django Rest Framework (DRF). If you need a version with only Django, use the link below.