Backend for an educational platform: REST API for courses and lessons, role-based permissions, subscriptions and payments (Stripe), background jobs with Celery, and interactive API docs via drf-yasg (Swagger / ReDoc).
- Courses & lessons — full CRUD for educational content (
materials). - Permissions — different behaviour for regular users, content owners, and moderators.
- Subscriptions & payments — subscription model and Stripe integration for paid access (
users). - Background tasks — Celery workers (e.g. course update checks, inactive-user handling).
- Auth — JWT via
djangorestframework-simplejwt. - API docs — Swagger UI at
/swagger/, ReDoc at/redoc/.
| Layer | Technology |
|---|---|
| API | Django REST Framework |
| DB | PostgreSQL |
| Tasks | Celery |
| Scheduler | django-celery-beat |
| Broker/cache | Redis |
| Docs | drf-yasg (OpenAPI / Swagger) |
materials/— courses, lessons, serializers, views, tasks.users/— custom user model, subscriptions, payments, auth-related endpoints.config/— Django settings, URLs, Celery app (celery_config.py).
-
Clone the repo:
git clone https://github.com/AJLbN0H/lms-core-api.git cd lms-core-api -
Copy the environment template and set secrets:
cp .env.sample .env
Set at least
SECRET_KEY,NAME/USER/PASSWORD/HOST=dbfor Compose, andSTRIPE_API_KEYif you use payments. -
Start the stack:
docker compose up --build
The
appservice runs migrations, thenrunserveron http://localhost:8000.
API entry points are under/materials/and/users/(root/is not routed). -
Run tests inside Docker:
docker compose exec app pytest -qCoverage (optional):
docker compose exec app pytest --cov=users --cov=materials --cov-report=term-missing
Secrets: do not commit real keys. Use
.env(gitignored) or your host/CI secret store.
You need PostgreSQL and Redis running locally. In .env, set HOST / PORT for the DB (e.g. 127.0.0.1 / 5432) and point CELERY_BROKER_URL, CELERY_RESULT_BACKEND, and if needed CACHE_LOCATION at Redis (replace host redis with 127.0.0.1).
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux / macOS
pip install -r requirements.txt
cp .env.sample .env # then edit HOST, Redis URLs, etc.
python manage.py migrate
python manage.py runserverInstall runtime + test dependencies:
poetry install --no-root --with dev
cp .env.sample .env # configure DB/Redis for your machine
poetry run pytestrequirements.txt is what the Dockerfile installs; keep it in sync with production/runtime needs. pyproject.toml / poetry.lock are used for development and CI.
celery -A config worker -l info
celery -A config beat -l infoEnsure CELERY_BROKER_URL and CELERY_RESULT_BACKEND match your Redis (see .env.sample).
GitHub Actions runs on pushes to main / develop and on pull requests targeting main: Python 3.13, PostgreSQL 15, Redis 7, then poetry install --with dev and poetry run pytest.
Workflow: .github/workflows/tests.yml.
- Raise automated test coverage toward 90%+.
- Harden production config (WSGI/ASGI server, secrets management).
- Optional: student assessments inside the platform; richer notifications.
Pytest is configured via pytest.ini (DJANGO_SETTINGS_MODULE=config.settings). Current line coverage for users + materials is about 83% (run pytest --cov=... as above to refresh).