# Learnitive Learn LMS v2 — implementation notes

## Scope

This source snapshot replaces the previous module/Markdown Learn CMS with a clean-slate LMS v2 built directly into Learnitive.

Core changes include:

- MasterStudy-inspired admin course library and course-builder shell.
- Section/item curriculum model with lesson, quiz and assignment items.
- Accessible dnd-kit curriculum sorting and cross-section moves.
- Editor.js structured lesson authoring; no Markdown/HTML lesson fallback.
- Native React lesson renderer for learners (Editor.js is admin-only).
- Interactive lesson blocks for code, terminal, code exercises, video, audio, images, files, checkpoints, solutions, tabs and accordions.
- Learnitive terminal/runtime reuse rather than WebContainers.
- Secure Free/Pro access, sequential learning, prerequisites, enrollment and progress.
- Protected solutions, checkpoint answers and hidden code tests kept server-side.
- Private LMS media with course/item access checks.
- Quiz authoring/attempts and assignment item support.
- Destructive migration 50 that drops the old Learn tables and creates LMS v2.
- Legacy Learn CMS/router/frontend removed from the active application.

## Verification completed in the build container

- `node --check server/learn-v2.mjs`: PASS.
- Focused LMS + SaaS router tests: 23/23 PASS.
- LMS migration tests: 3/3 PASS.
- Combined focused server verification: 26/26 PASS.
- New Learn TS/TSX + `saas-app.tsx` syntactic transpile using TypeScript: 10 files, 0 syntax errors.
- Relative import audit for `packages/core/app/src/learn`: 0 missing relative imports.
- Workspace dependency-version audit: PASS for 69 workspace packages.
- Public asset audit: PASS (14/14 required assets).

## Dependency/lockfile note

The four LMS frontend dependencies are pinned in `packages/core/app/package.json` and are now fully represented in `pnpm-lock.yaml`:

- `@dnd-kit/core` `6.3.1`
- `@dnd-kit/sortable` `10.0.0`
- `@dnd-kit/utilities` `3.2.2`
- `@editorjs/editorjs` `2.31.6`

The lockfile includes their transitive package/snapshot graph (including dnd-kit accessibility and Editor.js caret/DOM/notifier/tooltip dependencies). `node scripts/verify-pnpm-lock-sync.mjs` passes. The artifact-generation container still cannot resolve `registry.npmjs.org`, so an actual network-backed `pnpm install --frozen-lockfile` could not be executed here; the staging installer should perform that final fetch/install check on the connected host.

## Required deployment verification on a networked build host

Run from repository root:

```bash
corepack pnpm install
pnpm lint:ci
pnpm test:ci
pnpm build
```

Then run the normal Learnitive release/runtime and browser smoke tests used for staging.

## Database

A ready-to-import staging SQL artifact is supplied separately as:

`learnitive_os-learn-v2-20260908.sql`

It contains the supplied staging dump followed by the destructive Learn v2 migration and records migration 50. Importing it intentionally deletes the old Learn course/module/lesson data.

## 2026-09-08 MasterStudy + Laravel Editor.js parity pass

The LMS now combines the MasterStudy course-builder/player structure with the production Laravel training LMS's Editor.js authoring affordances. Important changes include the admin avatar link, custom Learn/Admin dialogs, removal of author-time runtime validation, clipboard image upload, language-selectable runnable code with stdin, server-owned timed quiz attempts, MasterStudy-style Drip/Pricing/Settings navigation, categories, protected course materials, percentage prerequisites, course-page display settings, learner-visible custom fields and a completion-gated certificate route.

See `LMS_MASTERSTUDY_PARITY_AUDIT.md` for the feature-by-feature parity boundary and deliberately excluded external/add-on modules.
