Skip to content

Backend service for an online learning platform with REST API and role-based access.

Notifications You must be signed in to change notification settings

ScherbAlex/OnlineLearning

Repository files navigation

OnlineLearning 🎓

Python Django PostgreSQL RBAC CI

Backend service for an online learning platform with REST API, role-based access control and payments.


🔎 Overview

OnlineLearning is a backend service designed to manage:

  • users and profiles,
  • courses and lessons,
  • payments history,
  • role-based access (admin / moderator / user).

The project demonstrates clean REST API design, access control logic and production-ready deployment.


✨ Key features

  • Custom user model with email-based authentication
  • Courses with nested lessons
  • Role-based access control (RBAC)
  • Payments for courses or lessons with strict validation
  • Filtering and ordering of payments
  • REST API ready for frontend or mobile clients
  • Automated tests and CI pipeline

🛠 Tech stack

  • Backend: Python 3.11, Django, Django REST Framework
  • Database: PostgreSQL
  • Auth: Token / role-based permissions
  • Testing: pytest
  • Quality: black, isort, flake8
  • CI/CD: GitHub Actions, Docker, Docker Compose

🏗 Architecture

flowchart LR
  Client -->|REST| API[Django + DRF]
  API --> Auth[RBAC / Permissions]
  API --> Domain[Courses / Lessons]
  API --> Payments
  Domain --> DB[(PostgreSQL)]
  Payments --> DB
Loading

👥 Roles & access The system implements three roles:

Admin — full access, user and content management

Moderator — edit courses and lessons

User — access and manage own content and payments

Access rules are enforced using custom DRF permission classes:

IsOwner

IsModerator

IsModeratorOrAdmin

📂 Project structure (simplified)

OnlineLearning/
├── config/ # Django settings & URLs
├── users/ # custom user, profiles, payments
├── lms/ # courses, lessons, API
├── tests/ # automated tests
├── deploy/ # deployment scripts
└── manage.py

📘 OpenAPI / Swagger

Swagger UI preview

Swagger UI: /api/docs/

OpenAPI schema: /api/schema/

🎬 Demo

OnlineLearning demo (admin / API flow)

Demo shows: admin login → create course → add lessons → API response.

🧪 Testing & code quality The project includes automated tests covering:

models and business rules,

API endpoints and permissions,

filtering and ordering logic.

Run tests locally:

pytest -q CI pipeline runs tests and checks code quality on every push.

🚀 Quickstart (local)

python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate pip install -r requirements.txt

python manage.py migrate python manage.py createsuperuser python manage.py runserver 🐳 Deployment (production-ready) The project is prepared for production deployment using:

Docker & Docker Compose

GitHub Actions CI/CD

SSH-based delivery (no public registry)

Optional systemd integration

Deployment logic is documented in deploy/ and workflow files.

📌 What this project demonstrates real-world backend architecture

role-based access control

payments domain modeling

clean REST API design

production-oriented CI/CD

maintainable and testable codebase

👨‍💻 Author This project was built as a showcase of backend development skills with focus on architecture, access control and production readiness.

About

Backend service for an online learning platform with REST API and role-based access.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages