LearnHouseHeadless

How to build it.

Write your courses in LearnHouse, pull them through the API and build any interface you want around them. Or describe what you want to a coding assistant and let it do the typing.

The API

Available

Everything the 50 demos show comes from a handful of read endpoints. Public courses need no token. For private content, create an API token in your organization settings (Pro plan) and send it from your server.

GET /api/v1/courses/org_slug/{slug}/page/{n}/limit/{n}Courses in the organization
GET /api/v1/courses/{uuid}/metaA course with its chapter and lesson tree
GET /api/v1/activities/{uuid}One lesson, content included
GET /api/v1/search/org_slug/{slug}?query=Courses, lessons, discussions and podcasts
GET /api/v1/certifications/course/{uuid}Certificates for a course
GET /content/orgs/{org}/…Thumbnails, images, video, audio and PDFs
Fetching courses and lessons
// Server-side only: keep the token out of the browser.
const LH = process.env.LEARNHOUSE_API_URL;
const headers = { Authorization: `Bearer ${process.env.LEARNHOUSE_API_TOKEN}` };

// Every course in the organization
const courses = await fetch(`${LH}/api/v1/courses/org_slug/${ORG}/page/1/limit/50`, { headers })
  .then((r) => r.json());

// One course with its chapters and lessons, in a single call
const course = await fetch(`${LH}/api/v1/courses/${courseUuid}/meta`, { headers })
  .then((r) => r.json());

// A lesson, with its content as JSON
const lesson = await fetch(`${LH}/api/v1/activities/${activityUuid}`, { headers })
  .then((r) => r.json());

Full reference: docs.learnhouse.app. Every endpoint, parameter and response is also listed in the interactive docs at /docs on a development instance.

Render lessons in React

In this repo

Lessons arrive as structured JSON: headings, text, images, video, quizzes, flashcards. The lesson renderer in this repo turns that into plain React with working quizzes, and every demo restyles it with a few CSS variables. Copy src/components/lesson into your app, or use the official @learnhouse/react package to render activities exactly as LearnHouse does.

Rendering a lesson
import ActivityBody from "@/components/lesson/activity-body";

export function Lesson({ lesson, course }) {
  return (
    <ActivityBody
      activity={lesson}
      orgUuid={course.org_uuid}
      courseUuid={course.course_uuid}
      onQuiz={({ correct, total }) => saveScore(lesson.activity_uuid, correct, total)}
    />
  );
}

/* Style it your way: every element has an lh-* class,
   and the look comes from CSS variables. */
.my-app { --lh-font: "Inter"; --lh-accent: #4f46e5; --lh-radius: 12px; }

Embeds

Available

Need a lesson inside a page you don't control, like a blog post or a help center? Every LearnHouse activity has an embed URL. Set the background with bgcolor, the text with textcolor and hide the logo with showlearnhouselogo=false. Course and activity IDs go in without their course_ and activity_ prefixes.

Embedding an activity
<iframe
  src="https://your-academy.learnhouse.app/embed/{orgslug}/course/{course_id}/activity/{activity_id}?bgcolor=FFFFFF&textcolor=111111&showlearnhouselogo=false"
  width="100%" height="640" style="border:0" allowfullscreen>
</iframe>

The SDK

Available

@learnhouse/sdk is a typed client for the whole API that runs in browsers, Node, Bun, edge workers and React Native. @learnhouse/react and @learnhouse/vue render any activity (pages, quizzes, flipcards, code, video) exactly as LearnHouse does. Their versions match the LearnHouse release they were built from.

SDK and React
npm install @learnhouse/sdk @learnhouse/react

// On your server: typed API client, token stays out of the browser
import { createClient } from "@learnhouse/sdk";

const lh = createClient({
  baseUrl: process.env.LEARNHOUSE_API_URL,
  token: process.env.LEARNHOUSE_API_TOKEN,
});
const courses = await lh.courses.list(ORG, { limit: 12 });
const activity = await lh.activities.get("activity_...");

// In React: render any activity exactly as LearnHouse does
import { LearnHouseActivity } from "@learnhouse/react";
import "@learnhouse/react/styles.css";

<LearnHouseActivity activity={activity} courseId="course_..." />

Guides: SDK, React and Vue on docs.learnhouse.app.

Or let AI build it for you

You can build anything on top of LearnHouse: a product, a widget, a game, a kiosk. You don't have to write it by hand. Copy this brief into Claude, Codex or any coding assistant, describe your product in the first section and let it build the app against your organization.

  1. Copy the brief.
  2. Replace the first section with what you want to build.
  3. Paste it into your assistant, in a new or existing project.
  4. Add your LearnHouse URL and organization slug to the env file it creates.
Brief for your coding assistant
You are building a custom learning platform frontend on top of LearnHouse, used headless through its REST API.

## What to build
<Describe your product here: who it is for, the main screens, the look and feel. Example: "A mobile-first microlearning app for retail staff: today's lesson, a 3-question quiz, a streak.">

## Stack
- Next.js (App Router) + TypeScript. Plain CSS or Tailwind, your choice.
- Environment variables (server only): LEARNHOUSE_API_URL, LEARNHOUSE_API_TOKEN (optional for public courses), LEARNHOUSE_ORG_SLUG.
- Use @learnhouse/sdk (typed API client, createClient({ baseUrl, token })) for API calls and @learnhouse/react (<LearnHouseActivity />) to render lessons. Docs: https://docs.learnhouse.app/developers/sdk and https://docs.learnhouse.app/developers/react

## LearnHouse API (all GET, JSON)
- Courses: {LEARNHOUSE_API_URL}/api/v1/courses/org_slug/{slug}/page/1/limit/50
- Course tree (chapters → activities): /api/v1/courses/{course_uuid}/meta?with_unpublished_activities=false&slim=true
- Lesson with content: /api/v1/activities/{activity_uuid}
- Org-wide search: /api/v1/search/org_slug/{slug}?query={q}&page=1&limit=10
- Files (thumbnails, lesson media): {LEARNHOUSE_API_URL}/content/orgs/{org_uuid}/courses/{course_uuid}/thumbnails/{file}
  Lesson block media: /content/orgs/{org_uuid}/courses/{course_uuid}/activities/{activity_uuid}/dynamic/blocks/{imageBlock|videoBlock|audioBlock}/{block_uuid}/{file_id}.{file_format}
- Auth: send "Authorization: Bearer <token>" from the server only. Never expose the token to the browser: proxy through your own API routes and cache responses (60s is fine).

## Lesson content
- Activities have activity_type: TYPE_DYNAMIC (rich lesson), TYPE_VIDEO, TYPE_DOCUMENT (PDF), TYPE_ASSIGNMENT.
- TYPE_DYNAMIC content is a TipTap/ProseMirror JSON doc: { type: "doc", content: [...] }. Node types include paragraph, heading, bulletList, orderedList, table, codeBlock, blockquote, callout, blockImage, blockVideo, blockAudio, blockQuiz (attrs.questions[] with answers[] and correct flags), flipcard / flipcardGrid, blockMathEquation.
- Render it natively with React components (one per node type) rather than an iframe, so it matches the product's design. Quizzes should be interactive.
- Reference implementation to copy from: https://github.com/learnhouse/headless-examples (src/components/lesson, src/lib/learnhouse.ts, src/lib/api.ts).

## Learner state
API tokens act for the organization, not a learner. Keep progress, quiz scores and streaks in the app (localStorage for a prototype, your own database for production).

## Quality bar
Responsive down to 375px, keyboard accessible, real loading/empty/error states, no placeholder text: use the real courses from the API.

Start from a demo

All 50 demos are open source. Pick the one closest to your idea, point it at your organization and change what you need.

Run the demos locally
git clone https://github.com/learnhouse/headless-examples
cd headless-examples && bun install
cp .env.example .env.local   # set LEARNHOUSE_API_URL and LEARNHOUSE_ORG_SLUG
bun dev --port 3100

Your platform. Our engine.

Create a LearnHouse organization, write a course and start building on top of it today.