Online courses

A course is a tree: modules in order, lessons in order within them. Enrollment is the relationship between a learner and a course and holds completion; progress is per lesson so a dashboard can show where someone stopped. Quizzes belong to a lesson, attempts record the answers given, and a certificate is issued once per enrollment.

Start a project from this schema
$ npx vela create my-app --schema courses
users auth
  • id* text
  • password* password
  • tokenKey* text
  • email* email
  • emailVisibility bool
  • verified bool
  • name text
  • avatar file
  • created autodate
  • updated autodate
courses
  • id* text
  • title* text
  • slug* text
  • summary text
  • description editor
  • instructor* users
  • cover file
  • level select
  • price number
  • published bool
  • created autodate
  • updated autodate
modules
  • id* text
  • course* courses
  • title* text
  • sort* number
  • created autodate
  • updated autodate
lessons
  • id* text
  • module* modules
  • title* text
  • content editor
  • video_url url
  • duration_minutes number
  • sort* number
  • free_preview bool
  • created autodate
  • updated autodate
enrollments
  • id* text
  • learner* users
  • course* courses
  • enrolled_at* date
  • completed_at date
  • progress_percent number
  • created autodate
  • updated autodate
lesson_progress
  • id* text
  • enrollment* enrollments
  • lesson* lessons
  • completed bool
  • seconds_watched number
  • last_viewed_at date
  • created autodate
  • updated autodate
quizzes
  • id* text
  • lesson* lessons
  • title* text
  • questions* json
  • pass_percent number
  • created autodate
  • updated autodate
quiz_attempts
  • id* text
  • quiz* quizzes
  • enrollment* enrollments
  • answers* json
  • score_percent number
  • passed bool
  • created autodate
  • updated autodate
certificates
  • id* text
  • enrollment* enrollments
  • number* text
  • issued_at* date
  • pdf file
  • created autodate
  • updated autodate

Every collection, field and relation above becomes a PocketBase migration in the new project. Change any of it afterwards with vela generate migration --ai, which opens this same diagram as an editor.