Skip to content

Backend and REST API

Re-Krass edited this page Nov 16, 2026 · 1 revision

βš™οΈ Backend and REST API

The original backend is in ydl-api. It is a legacy Python 3.6 / Django 2 / Django REST Framework application, backed by MariaDB in the restored local environment.

Important repository structure

πŸ“¦ ydl-api/
┣ πŸ“‚ ydl_api/
┃ ┣ πŸ“„ manage.py
┃ ┣ πŸ“‚ api/
┃ ┃ ┣ πŸ“„ models.py           # Users, courses, messages, resources, etc.
┃ ┃ ┣ πŸ“„ serializers.py      # REST response shapes
┃ ┃ ┣ πŸ“„ views.py            # ViewSets and endpoints
┃ ┃ ┣ πŸ“„ urls.py
┃ ┃ ┣ πŸ“‚ migrations/
┃ ┃ β”— πŸ“‚ management/commands/
┃ ┃   β”— πŸ“„ seed_demo.py      # Fictional repeatable sample content
┃ ┣ πŸ“‚ quiz/
┃ ┃ ┣ πŸ“„ models.py
┃ ┃ ┣ πŸ“„ serializers.py
┃ ┃ β”— πŸ“„ views.py
┃ β”— πŸ“‚ ydl_api/
┃   ┣ πŸ“„ settings.py
┃   β”” πŸ“„ urls.py
┣ πŸ“‚ api-docs/
┃ ┣ πŸ“„ openapi.json           # Archived exported API contract
┃ ┣ πŸ“„ index.html            # Static Swagger UI shell
┃ ┣ πŸ“„ app.js
┃ β”— πŸ“‚ vendor/               # Versioned Swagger UI runtime
┣ πŸ“‚ scripts/
┃ ┣ πŸ“„ export_openapi.py
┃ β”— πŸ“„ prepare_api_docs.sh
┣ πŸ“„ Pipfile
β”— πŸ“„ Pipfile.lock

Documented REST endpoint groups

The public OpenAPI 2.0 export describes the original Django API. The major groups include:

Group Representative paths Purpose
Authentication POST /token/auth/, /token/refresh/, /token/verify/ JWT-based session operations
Users and enrollment GET /users/, GET /users/{id}, PUT /students/{user} User accounts and student course memberships
Courses GET/POST /courses/, GET/PUT/PATCH/DELETE /courses/{id} Course content and management
Announcements GET/POST /announcements/ News on the landing page
Forum GET/POST /posts/, GET/PUT/PATCH/DELETE /posts/{id} Discussions and posts
Messages GET/POST /messages/ User messages
Quiz GET/POST /quiz/tests/, GET/PUT/PATCH/DELETE /quiz/tests/{id} Quiz definitions and tasks
Resources GET/POST /resources/, /resources/{id} Learning materials

These are examples from the exported schema, not a guarantee of secure or usable live endpoints. The archived schema can differ from features simulated in the latest browser-only demo.

Open Swagger Reference Β· Download OpenAPI JSON

Backend relationships

flowchart TD
  User["User"] --> Student["Student / course enrollment"]
  User --> Teacher["Teacher"]
  Teacher --> Course["Course"]
  Student --> Course
  Course --> Post["Forum posts"]
  Course --> Quiz["Quiz tests and tasks"]
  Course --> Event["Calendar entries"]
  Course --> Resource["Learning resources"]
  Post --> Reply["Replies / child posts"]
Loading

Conceptual relationships; refer to models.py for exact fields and Django relationships.

Archived API documentation

The Swagger UI reference is generated from the locally running Django endpoint /?format=openapi, sanitized to use api.example.invalid as a non-operational host, and published as static JSON + UI files. Try it out is disabled. There is no public API server.

flowchart LR
  Local["Local Django /?format=openapi"] --> Export["export_openapi.py"]
  Export --> JSON["api-docs/openapi.json"]
  JSON --> Swagger["Read-only Swagger UI"]
  Swagger --> Pages["GitHub Pages /ydl-api/"]
Loading

Important safety and maintenance notes

The historical backend is not a modern production-ready service. Some legacy endpoint permissions were permissive; do not expose it publicly without a dedicated security review and modernization. The static UI is safe as a non-executable reference only because no live backend is provided and submissions are disabled.

Do not publish old database dumps, real accounts, secrets, credentials or environment files.

Next: Local development Β· Deployment and hosting

Clone this wiki locally