ForgeCrowdBookWe don't sell the fish – we give you the rod.

Online Courses

If you know something that others want to learn — baking, yoga, a language, building websites with AI — you can teach it online. Course platforms take a share of every sale and own the relationship with your students. The courses module runs on your own site: lessons as Markdown, videos from YouTube or PeerTube, payment through Stripe, and you know your participants.

Goal

By the end of this chapter you can:

  • build a course with chapters, lessons and free previews,
  • sell it, or give access by invitation,
  • see the progress of your participants,
  • keep paid lessons out of public view.

Switching it on

Please add online courses at /courses. I am the admin (me@mybakery.com).
Payment by card through Stripe (test mode first). Terms at /terms,
withdrawal at /withdrawal, privacy at /privacy.

In app.sml:

Courses {
    path:       "/courses"
    title:      "Courses"
    admins:     "me@mybakery.com"
    terms:      "/terms"
    withdrawal: "/withdrawal"
    privacy:    "/privacy"
}

plus Stripe { } (chapter 13) and mail on the server (chapter 10): participants log in with an emailed link. On a page, Courses { } shows the overview.

A course

The list of courses is in courses.sml:

Courses {
    Course {
        id:        "sourdough-at-home"
        title:     "Sourdough at home"
        teaser:    "From the first starter to a loaf you are proud of, in eight short lessons."
        image:     "/static/courses/sourdough.jpg"
        price:     "29"
        lang:      "en"
        published: true
    }
}

price is in euros; "0" or no price makes the course free (participants still log in, so their progress is kept). published: false hides a course from everyone but the admins while you build it.

Each course has a folder courses/<id>/ with its outline and lessons:

Outline {
    intro: "intro.md"
    Chapter {
        title: "The starter"
        Lesson { id: "welcome" title: "Welcome"          file: "01-welcome.md" free: true duration: "3 min" }
        Lesson { id: "starter" title: "Making a starter" file: "02-starter.md" duration: "10 min" }
    }
    Chapter {
        title: "The first loaf"
        Lesson { id: "dough"   title: "The dough"        file: "03-dough.md"   duration: "12 min" }
    }
}

A lesson is a Markdown file. A line with only a YouTube or PeerTube address becomes a video player, so a typical lesson is a video and some text below it. free: true lessons can be read by everyone: a preview that shows what the course is like.

A course page

Buying and learning

On the course page, a visitor sees the intro, the outline (locked lessons with a 🔒) and the buy box. To buy, they log in, tick the box that they want access right away (which ends the right of withdrawal for digital content), and are sent to Stripe. Back on your site, they are in, and get a mail with the link, the consent and your terms.

Inside the course, each lesson has the outline at the side, links to the previous and next lesson, and a Done button. A ✓ marks finished lessons, and the course page offers "Continue: ". /courses/my lists all courses of a participant with their progress.

Invitations and members

Not every course is sold. For a closed group (members of an association, the participants of an in-person workshop, a school class) set invite: true on the course: there is no buy button, and only people you invite get in. At /courses/admin you enter an email address, and that person gets a mail with the link, even before they have an account.

The same page shows, per course, who is in (bought, invited, free), how far each participant got and which lesson they opened last. You can also revoke access.

Keeping lessons private

Your content repo on Codeberg is public (chapter 5). For pages that is fine; for paid lessons it is not, because anyone could read them there. So for a paid course, ask the AI to keep the course files on the server instead:

My course lessons must not be readable on Codeberg. Please move the course
files into a folder on the server and set local_path in Courses.

local_path in Courses { } then names that folder. The pages of your site still come from Codeberg; only the course files are read from the server.

Two languages

A course has one language. A course in another language is a second course, linked with translation: "<id of the other>" on both. Visitors then see the one in their language, a purchase counts for both, and the progress is shared.

Pitfalls

  • A course does not appear: published: true is missing, or the id in courses.sml does not match the folder name.
  • "Log in to buy" but no Stripe page: Stripe is not set up, or still has no key. Free courses and invitations work without Stripe.
  • Test purchases disappear after going live: that is on purpose. Purchases made in Stripe test mode only count in test mode.
  • Lessons readable on Codeberg: set local_path before you sell.

What you learned

  • Courses { } and courses.sml define the courses; each has an outline of chapters and Markdown lessons, with videos and free previews.
  • Participants log in by email, buy through Stripe, and see their progress; you see it too.
  • invite: true makes a closed course for people you grant access.
  • Paid lessons belong on the server (local_path), not in the public repo.