Lompat ke konten
Rahman FakhruDiskusi proyek

Pelajaran 02 / 02

Skema Course dan Lesson

Panduan struktur data untuk membuat course dan lesson di Classroom.

Overview

Classroom menggunakan dua tabel utama di Convex: classroomCourses untuk data course dan classroomLessons untuk isi pelajaran. Field bertanda ? bersifat opsional.

Field slug dipakai langsung di URL, jadi gunakan format lowercase, dash, dan tanpa leading slash. Contoh yang benar: prompt-engineering-101.

Course Schema

Course adalah container utama untuk beberapa lesson. Data ini muncul di halaman listing dan landing course.

FieldTypeDescription
slugstringURL slug, lowercase + dashes, tanpa leading slash. Contoh: ship-with-convex
titlestringJudul course yang tampil di UI.
excerptstringPitch singkat 1–2 kalimat untuk card listing.
description?stringDeskripsi HTML panjang untuk landing page course.
cover?stringImage URL atau Convex storage ID.
category?stringTag bebas seperti Backend, AI, Design.
levelbeginner | intermediate | advancedLevel kesulitan course.
ordernumberUrutan tampil di halaman classroom. Angka kecil tampil lebih dulu.
publishedbooleanJika false, course dianggap draft.

Lesson Schema

Lesson adalah isi pembelajaran di dalam sebuah course. Lesson bisa menggunakan body tunggal atau blocks multi-section.

FieldTypeDescription
courseIdId<'classroomCourses'>Diisi setelah course dibuat.
module?stringLabel section, contoh: Module 1 — Setup.
slugstringURL slug lesson di bawah course.
titlestringJudul lesson.
summary?stringRingkasan satu baris di atas body.
contentTyperichtext | html | copypasteDipakai jika blocks kosong.
bodystringHTML untuk richtext/html, plain text untuk copypaste.
blocks?arrayMulti-section content. Jika tidak kosong, body dan contentType diabaikan saat render.
durationMin?numberEstimasi durasi belajar dalam menit.
ordernumberUrutan lesson di dalam course.
publishedbooleanJika false, lesson dianggap draft.

Jenis Block yang Didukung

Slide 1 / 4

Prompt untuk Generate Banyak Lesson

You are a structured content generator for a Convex-powered Classroom CMS.

Generate a JSON array of lessons that follows this schema exactly:

{
  "courseId": "<paste classroomCourses id here>",
  "module": "string optional",
  "slug": "lowercase-dash-slug-no-leading-slash",
  "title": "string",
  "summary": "string optional",
  "contentType": "richtext | html | copypaste",
  "body": "string",
  "blocks": [
    {
      "id": "unique-block-id",
      "kind": "richtext | html | copypaste | carousel",
      "title": "string optional",
      "body": "string optional",
      "slides": [
        {
          "id": "unique-slide-id",
          "title": "string optional",
          "body": "string",
          "kind": "html | richtext"
        }
      ]
    }
  ],
  "durationMin": 5,
  "order": 0,
  "published": true
}

Rules:
- Output only valid JSON array.
- Do not wrap in markdown code fences.
- Use lowercase dash slugs.
- Do not add leading slash to slugs.
- If blocks is non-empty, keep body as an empty string.
- Use richtext for normal explanation.
- Use html for visual tables, cards, or layouts.
- Use copypaste for prompts, commands, snippets, or reusable templates.
- Use carousel for step-by-step walkthroughs.
- Make every block id unique.
- Make every slide id unique.
- Keep lesson order sequential starting from 0.

Example Lesson JSON

{
  "courseId": "<paste classroomCourses id here>",
  "module": "Module 1 — Foundation",
  "slug": "system-prompt-template",
  "title": "Template system prompt",
  "summary": "Prompt dasar untuk membuat asisten yang fokus.",
  "contentType": "copypaste",
  "body": "You are a senior {role}. Speak in {tone}.\nGoal: {goal}\nConstraints:\n- ...\n- ...\nOutput format:\n- ...",
  "blocks": [
    {
      "id": "b1",
      "kind": "richtext",
      "title": "Pengantar",
      "body": "<p>Kenapa pakai system prompt? Penjelasan singkat di sini.</p>"
    },
    {
      "id": "b2",
      "kind": "carousel",
      "title": "Walkthrough",
      "slides": [
        {
          "id": "s1",
          "title": "Step 1 — Role",
          "body": "<p>Tetapkan peran asisten.</p>",
          "kind": "richtext"
        },
        {
          "id": "s2",
          "title": "Step 2 — Tone",
          "body": "<p>Atur gaya bicara.</p>",
          "kind": "richtext"
        },
        {
          "id": "s3",
          "title": "Step 3 — Goal",
          "body": "<p>Definisikan tujuan dan constraint.</p>",
          "kind": "richtext"
        }
      ]
    },
    {
      "id": "b3",
      "kind": "copypaste",
      "title": "Template siap pakai",
      "body": "You are a senior {role}.\nGoal: {goal}\n..."
    }
  ],
  "durationMin": 3,
  "order": 0,
  "published": true
}

Workflow Admin yang Disarankan

  1. Buat course terlebih dahulu di admin.
  2. Copy ID dari data classroomCourses.
  3. Generate lesson menggunakan prompt di atas.
  4. Paste courseId ke setiap lesson.
  5. Pastikan slug lowercase, dash, dan tanpa leading slash.
  6. Publish lesson jika sudah siap tampil.