Describes the Nastavnik monorepo (Django/DRF/Celery, FastAPI ML stub, Next.js, Docker Compose, RabbitMQ, Prometheus/Grafana). Use when editing nastavnik, running or debugging services, API contracts, migrations, frontend API URLs, tests, or release checklists. For full HTTP field lists see reference.md in the same folder.
Do not contradict README without updating it.
| Path | Role |
|---|---|
backend/ | Django project nastavnik, app lessons, Daphne ASGI, Celery worker image |
ml_service/ | FastAPI /validate, async SQLAlchemy + Redis cache |
frontend/ | Next.js App Router; в браузере API по умолчанию http://<host>:8000, опционально NEXT_PUBLIC_API_URL |
monitoring/ | Prometheus scrape config, Grafana datasource |
make up # full stack
make test # backend pytest (+ eager Celery) + ml_service pytest
make test-e2e # Playwright (нужен backend :8000; Next поднимает webServer)
make down / logs # operate compose
Backend container startup runs migrate and seed_data before Daphne.
LessonSession: unique on (session_id, lesson) — same browser id can do different lessons.POST .../lessons/{id}/start/: returns question at current_question_index, not always the first. Если сессия по уроку уже завершена, повторный start сбрасывает попытку (удаляет InteractionRecord для пары session+lesson, индекс с нуля).GET /api/statistics/: опционально lesson_id + session_id — статистика только по одному уроку; без lesson_id — по всем данным сессии.POST .../answer/submit/: must submit the current question for that session; response includes lesson_complete when no next question.POST .../lessons/{id}/complete/: creates InteractionRecord rows (empty answer, is_correct=False) for unanswered questions; returns remaining_marked_incorrect./2; cache/channels use Redis /0 (see docker-compose.yml).http://localhost:8000/api/schema/swagger-ui/ (OpenAPI из drf-spectacular).choices (3 строки) для multiple-choice UI; проверка ответа по-прежнему по тексту выбранного варианта.http://localhost:8000/api/health/./metrics, ML /metrics (Prometheus scrapes both).GET /api/questions/current/ requires session_id and lesson_id./api/....NEXT_PUBLIC_API_URL.backend/lessons/models.py.docker compose exec backend python manage.py makemigrations lessonsmake up apply migrate.make test passes; при изменениях UI — make test-e2e.make up + smoke: lesson flow, ML delay/failures, stats.