How to Create an Online Course and Community with Svelte and SvelteKit

Practical guide to build an online course and community in SvelteKit using Embedin.

How to Create an Online Course and Community with Svelte and SvelteKit
Diego Oliveira

Diego Oliveira

Aug 10, 2024

How to Create an Online Course and Community with Svelte and SvelteKit

SvelteKit is ideal when you want performance and simple developer experience.

By combining SvelteKit with Embedin, you can launch course delivery and community in the same product with very little overhead.

Why this setup works

Step 1: Build your course in Embedin

Create your course, modules, and lessons in Embedin. Publish your first version and copy the course ID.

You can find the course ID in course settings in Embedin.

Step 2: Allow your SvelteKit domains

Add allowed domains in Embedin course settings:

Step 3: Add an embedded course route in SvelteKit

Example route: src/routes/academy/+page.svelte

<script lang="ts">
  import { onMount } from 'svelte'

  const courseId = 'YOUR_COURSE_ID'
  let scriptEl: HTMLScriptElement

  onMount(() => {
    scriptEl = document.createElement('script')
    scriptEl.type = 'module'
    scriptEl.src = 'https://embed.embedin.com/course.js'
    scriptEl.setAttribute('data-courseid', courseId)
    document.body.appendChild(scriptEl)

    return () => {
      document.body.removeChild(scriptEl)
    }
  })
</script>

<main>
  <h1>Academy</h1>
  <div id={courseId} data-courseid={courseId}></div>
</main>

Replace YOUR_COURSE_ID with your real course ID from settings.

Step 4: Enable Community in Embedin

After enabling Community, learners can discuss lessons directly in the learning context.

Use this to increase completion and reduce drop-off between sessions.

Step 5: Prepare the first week of discussions

Add starter prompts before launch:

Final thought

SvelteKit plus Embedin gives you a clean, fast stack for modern course businesses. You can focus on learner outcomes instead of infrastructure.

Latest posts

© Embedin. All rights reserved.