### Backup, Stop, Setup, and Start LearnHouse Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt A sequence of commands to back up your current instance, stop all services, reset the setup, and then start fresh. ```bash # Back up current data (optional) learnhouse backup # Stop all services learnhouse stop # Re-run setup learnhouse setup # Start fresh learnhouse start ``` -------------------------------- ### Install Dependencies and Start Development Server Source: https://github.com/learnhouse/docs/blob/main/content/developers/architecture/backend.mdx Use the 'uv' package manager to install project dependencies and start the development server. The server runs internally using Uvicorn. ```bash uv sync # install dependencies uv run python app.py # start the dev server (which calls uvicorn internally) ``` -------------------------------- ### Install LearnHouse CLI (Quick Start) Source: https://github.com/learnhouse/docs/blob/main/content/cli/index.mdx Use this command to quickly install and set up the LearnHouse CLI. It's the recommended method for most users. ```bash npx learnhouse@latest setup ``` -------------------------------- ### Install Dependencies and Start Dev Server Source: https://github.com/learnhouse/docs/blob/main/README.md Use these commands to set up the local development environment. Requires Bun to be installed. ```bash bun install ``` ```bash bun dev ``` -------------------------------- ### Start Local Development Environment Source: https://github.com/learnhouse/docs/blob/main/content/cli/dev-mode.mdx Run this command to start the full local development environment with hot reload for all services. Ensure Docker, bun, and uv are installed. ```bash npx learnhouse dev ``` -------------------------------- ### Clone Repository and Start Development Environment Source: https://github.com/learnhouse/docs/blob/main/content/developers/contributing/dev-environment.mdx This command clones the LearnHouse repository, navigates into the directory, and starts the entire development environment. It handles starting backend services, installing dependencies (Python and JavaScript), and launching the API and frontend with hot reload. ```bash git clone https://github.com/learnhouse/learnhouse && cd learnhouse && npx learnhouse dev ``` -------------------------------- ### Install LearnHouse CLI (macOS/Linux) Source: https://github.com/learnhouse/docs/blob/main/content/cli/index.mdx A one-line installation script for macOS and Linux that installs Docker, Node.js, and launches the CLI. ```bash curl -fsSL https://raw.githubusercontent.com/learnhouse/learnhouse/main/apps/cli/install.sh | bash ``` -------------------------------- ### Run Interactive Setup Wizard Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/installation/cli-reference.mdx Initiates the interactive setup wizard to generate configuration files like `docker-compose.yml`, `.env`, and `learnhouse.config.json`. Existing configurations are preserved as defaults in prompts. ```bash learnhouse setup ``` -------------------------------- ### Start LearnHouse Services Source: https://github.com/learnhouse/docs/blob/main/content/cli/commands.mdx Starts all Docker containers required for your LearnHouse deployment. ```bash npx learnhouse start ``` -------------------------------- ### Start LearnHouse Services Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/installation/cli-reference.mdx Starts all LearnHouse services. On the first run, it pulls the necessary Docker images before starting the containers. ```bash learnhouse start ``` -------------------------------- ### Install LearnHouse CLI (Windows PowerShell) Source: https://github.com/learnhouse/docs/blob/main/content/cli/index.mdx Use this PowerShell command to install the LearnHouse CLI on Windows. It installs necessary dependencies and starts the CLI. ```powershell irm https://raw.githubusercontent.com/learnhouse/learnhouse/main/apps/cli/install.ps1 | iex ``` -------------------------------- ### Start Development Server with Turbopack Source: https://github.com/learnhouse/docs/blob/main/content/developers/architecture/frontend.mdx Command to start the Next.js development server with Turbopack for faster builds. ```bash bun dev # runs next dev --turbopack ``` -------------------------------- ### Start Dev Environment with Admin Credentials Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Starts the local development environment, bypassing the interactive prompt for admin email and password by providing them directly as flags. ```bash npx learnhouse dev --admin-email --admin-password ``` -------------------------------- ### Full .env Example for Self-Hosting Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/configuration/environment-variables.mdx A comprehensive example of a .env file for self-hosting LearnHouse, including settings for general configuration, hosting, database, Redis, authentication, initial admin, frontend, AI, email, and content storage. ```env # General LEARNHOUSE_SITE_NAME=LearnHouse LEARNHOUSE_SITE_DESCRIPTION=An open-source learning platform LEARNHOUSE_CONTACT_EMAIL=admin@example.com LEARNHOUSE_SELF_HOSTED=true LEARNHOUSE_ENV=production # Hosting LEARNHOUSE_DOMAIN=learn.example.com LEARNHOUSE_SSL=true LEARNHOUSE_ALLOWED_ORIGINS=https://learn.example.com LEARNHOUSE_COOKIE_DOMAIN=.example.com LEARNHOUSE_PORT=9000 # Database LEARNHOUSE_SQL_CONNECTION_STRING=postgresql://learnhouse:learnhouse@db:5432/learnhouse # Redis LEARNHOUSE_REDIS_CONNECTION_STRING=redis://redis:6379/learnhouse # Authentication LEARNHOUSE_AUTH_JWT_SECRET_KEY=your-generated-jwt-secret NEXTAUTH_SECRET=your-generated-nextauth-secret NEXTAUTH_URL=https://learn.example.com/ # Initial Admin LEARNHOUSE_INITIAL_ADMIN_EMAIL=admin@example.com LEARNHOUSE_INITIAL_ADMIN_PASSWORD=change-this-password # Frontend NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=defaultorg NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost/api/v1/ NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost NEXT_PUBLIC_LEARNHOUSE_HTTPS=false # AI (optional) LEARNHOUSE_GEMINI_API_KEY= LEARNHOUSE_IS_AI_ENABLED=false # Email (optional) LEARNHOUSE_EMAIL_PROVIDER=resend LEARNHOUSE_RESEND_API_KEY= LEARNHOUSE_SYSTEM_EMAIL_ADDRESS= # Content Storage LEARNHOUSE_CONTENT_DELIVERY_TYPE=filesystem ``` -------------------------------- ### Start Development Environment Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/installation/cli-reference.mdx Launches a full development environment, including PostgreSQL and Redis in Docker, with the API, web, and collaboration services running locally. ```bash learnhouse dev ``` -------------------------------- ### Dynamic Page Initial Content Example Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/activity-types.mdx Example of the JSON structure for a dynamic page activity's initial content, using TipTap format. This includes headings, paragraphs, and lists. ```json { "name": "Welcome to the course", "chapter_id": 7, "activity_type": "TYPE_DYNAMIC", "activity_sub_type": "SUBTYPE_DYNAMIC_PAGE", "content": { "type": "doc", "content": [ { "type": "heading", "attrs": { "level": 1 }, "content": [{ "type": "text", "text": "Welcome" }] }, { "type": "paragraph", "content": [ { "type": "text", "text": "This is a " }, { "type": "text", "text": "bold", "marks": [{ "type": "bold" }] }, { "type": "text", "text": " introduction." } ] }, { "type": "bulletList", "content": [ { "type": "listItem", "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Learning objective 1" }] }] }, { "type": "listItem", "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Learning objective 2" }] }] } ] } ] } } ``` -------------------------------- ### Display LearnHouse Configuration Source: https://github.com/learnhouse/docs/blob/main/content/cli/commands.mdx Shows current installation metadata, including version, directory, URL, organization slug, and file locations. ```bash npx learnhouse config ``` -------------------------------- ### Create and Publish YouTube Video Activity Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt This example creates an activity for an external YouTube video and then publishes it. It requires the YouTube video URI and chapter ID. ```shell YT=$(post_json "$API/activities/external_video" "{\"name\":\"YouTube embed\",\"uri\":\"https://www.youtube.com/watch?v=jNQXAC9IVRw\",\"type\":\"youtube\",\"chapter_id\":\"$CH2_ID\",\"details\":\"{\\\"startTime\\\":0,\\\ ``` -------------------------------- ### Start Dev Mode with Enterprise Edition Source: https://github.com/learnhouse/docs/blob/main/content/cli/dev-mode.mdx Use the `--ee` flag to enable Enterprise Edition features during local development. This command starts the development environment with EE features activated. ```bash npx learnhouse dev --ee ``` -------------------------------- ### Check Docker Status Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/maintenance/troubleshooting.mdx Verify if the Docker daemon is running. If not, start it. This is a common prerequisite for LearnHouse services. ```bash docker info ``` -------------------------------- ### Suggest Course Structure Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/assisted.mdx Use this command to send course details to the API and get a suggested structure for migration. Ensure you have set the ORG_ID, TEMP_ID, COURSE_NAME, and TOKEN environment variables. ```bash STRUCTURE=$(curl -fsS -X POST "$API/courses/migrate/suggest?org_id=$ORG_ID" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d "{\"temp_id\":\"$TEMP_ID\",\"course_name\":\"$COURSE_NAME\"}") ``` -------------------------------- ### Automate Daily Backups with Cron Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/maintenance/backups.mdx Schedule daily backups using a cron job to ensure regular data protection. This example sets up a backup at 2:00 AM daily. ```bash # Edit your crontab crontab -e # Add this line for daily backups at 2 AM 0 2 * * * /usr/local/bin/learnhouse backup ``` -------------------------------- ### Suggest Course Structure Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/assisted.mdx Send a temporary ID and course name to get an AI-generated course structure. This endpoint groups files into chapters and proposes activity titles. ```bash curl -X POST "http://localhost:1338/api/v1/courses/migrate/suggest?org_id=1" \ -H "Authorization: Bearer lh_your_api_token" \ -H "Content-Type: application/json" \ -d '{ "temp_id": "9c4e3...-d8f1-4...", "course_name": "Introduction to Astronomy", "description": "Self-paced intro to astronomy concepts." }' ``` -------------------------------- ### Common LearnHouse Management Commands Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/index.mdx A collection of essential CLI commands for managing LearnHouse services, including stopping, starting, viewing logs, configuring, backing up, and diagnosing issues. ```bash npx learnhouse stop # Stop all services ``` ```bash npx learnhouse start # Start all services ``` ```bash npx learnhouse logs # Stream container logs ``` ```bash npx learnhouse config # View current configuration ``` ```bash npx learnhouse backup # Backup or restore the database ``` ```bash npx learnhouse doctor # Diagnose issues ``` -------------------------------- ### Create a Course with Thumbnail Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/programmatic.mdx Create a new course via the API, including a name, description, and a JPEG thumbnail image. ```bash # ── 1. Course (multipart, with a real JPEG thumbnail) ─────────────────────── COURSE=$(curl -fsS -X POST "$API/courses/?org_id=$ORG_ID" \ -H "Authorization: Bearer $TOKEN" \ -F 'name=The Complete Demo Course' \ -F 'description=One of every activity type, built via the API' \ -F 'about=Created end-to-end by the LearnHouse migration quickstart script.' \ -F 'public=true' \ -F 'thumbnail_type=image' \ -F "thumbnail=@$ASSETS/thumbnail.jpg;type=image/jpeg") CID=$(echo "$COURSE" | jq -r .id) CUUID=$(echo "$COURSE" | jq -r .course_uuid) echo "→ course $CUUID (id=$CID)" ``` -------------------------------- ### Image Block Upload Response Example Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Example JSON response after successfully uploading an image block. The 'content.file_id' is used by the renderer to fetch the asset. ```json { "id": 13, "block_uuid": "block_2a8...", "block_type": "BLOCK_IMAGE", "content": { "file_id": "90b8f12e-fb6b-4726-85ef-f6b511e319e5_block_2a8...", "file_format": "png", "file_name": "diagram.png", "file_size": 24576, "file_type": "image/png", "activity_uuid": "activity_91c..." }, "org_id": 1, "course_id": 42, "chapter_id": null, "activity_id": 99, "creation_date": "...", "update_date": "..." } ``` -------------------------------- ### Create a Course Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/programmatic.mdx Use this endpoint to create a new course. It accepts multipart form data for course details and an optional thumbnail. Ensure you capture both the `id` and `course_uuid` from the response. ```bash curl -X POST "http://localhost:1338/api/v1/courses/?org_id=1" \ -H "Authorization: Bearer lh_your_api_token" \ -F 'name=Introduction to Python' \ -F 'description=A beginner-friendly Python course' \ -F 'public=false' \ -F 'about=Hands-on Python from zero to writing your first scripts.' \ -F 'thumbnail_type=image' \ -F 'thumbnail=@./thumbnail.png' ``` -------------------------------- ### TipTap Inline Link Example Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/activity-types.mdx Example of a text node with an inline link mark in TipTap JSON. The 'marks' array specifies the link type and its attributes, including the URL. ```json { "type": "text", "text": "see link", "marks": [ { "type": "link", "attrs": { "href": "https://example.com" } } ] } ``` -------------------------------- ### LearnHouse Configuration Files Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt After confirmation, the wizard creates these configuration files for your deployment. ```bash {installDir}/\n├── docker-compose.yml # Service definitions\n├── .env # All configuration variables\n├── learnhouse.config.json # CLI metadata\n└── extra/\n ├── Caddyfile # If auto-SSL enabled\n └── nginx.prod.conf # If manual SSL or HTTP ``` -------------------------------- ### Create Chapters for a Course Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Create three chapters for the newly created course by making POST requests to the chapters endpoint. Each chapter includes a name, description, course ID, and organization ID. ```bash # ── 2. Three chapters ─────────────────────────────────────────────────────── CH1_ID=$(post_json "$API/chapters/" \ "{\"name\":\"1. Dynamic content\",\"description\":\"Pages, embeds, markdown\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) CH2_ID=$(post_json "$API/chapters/" \ "{\"name\":\"2. Media\",\"description\":\"Hosted video, YouTube, PDF\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) CH3_ID=$(post_json "$API/chapters/" \ "{\"name\":\"3. Interactive\",\"description\":\"Assignment\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) ``` -------------------------------- ### Create LearnHouse Backup Source: https://github.com/learnhouse/docs/blob/main/content/cli/commands.mdx Creates a database backup as a .tar.gz archive, optionally including the .env file. Backups are saved to the `{installDir}/backups/` directory. ```bash npx learnhouse backup ``` -------------------------------- ### Users - Get Profile Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx Retrieves the profile information for the currently authenticated user. ```APIDOC ## GET /api/v1/users/profile ### Description Retrieves the profile information for the currently authenticated user. ### Method GET ### Endpoint /api/v1/users/profile ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```bash curl http://localhost:1338/api/v1/users/profile \ -H "Authorization: Bearer " ``` ``` -------------------------------- ### GET /api/v1/auth/refresh Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Refreshes an expired JWT token if within the 30-day refresh window. ```APIDOC ## GET /api/v1/auth/refresh ### Description Renews an expired JWT access token. This endpoint is available within a 30-day refresh window after the initial login. ### Method GET ### Endpoint /api/v1/auth/refresh ### Parameters None ### Response #### Success Response (200) - **access_token** (string) - A new JWT access token. - **token_type** (string) - The type of token (e.g., Bearer). #### Response Example ```json { "access_token": "", "token_type": "bearer" } ``` ``` -------------------------------- ### Create Course Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Creates a new course using multipart form data. Requires organization ID and authorization token. Includes fields for name, description, and public status. ```bash # Create a new course (multipart form data) curl -X POST "http://localhost:1338/api/v1/courses/?org_id=1" \ -H "Authorization: Bearer " \ -F 'name=Introduction to Python' \ -F 'description=A beginner-friendly Python course' \ -F 'public=false' \ -F 'about=...' ``` -------------------------------- ### Get an endpoint Source: https://github.com/learnhouse/docs/blob/main/content/platform/automations/webhooks.mdx Retrieves the details of a specific webhook endpoint using its unique identifier. ```APIDOC ## GET /api/v1/{org_id}/webhooks/{webhook_uuid} ### Description Retrieves the details of a specific webhook endpoint. ### Method GET ### Endpoint /api/v1/{org_id}/webhooks/{webhook_uuid} ### Parameters #### Path Parameters - **webhook_uuid** (string) - Required - The unique identifier of the webhook endpoint. ``` -------------------------------- ### Create Database Backup Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/installation/cli-reference.mdx Creates a PostgreSQL dump archive of the instance's database and a copy of the `.env` file. Archives are saved in the `/backups/` directory. ```bash learnhouse backup ``` -------------------------------- ### Get Course Metadata Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/index.mdx Retrieves course metadata, including unpublished activities if requested. ```APIDOC ## GET /courses/{course_uuid}/meta ### Description Retrieves metadata for a course. ### Method GET ### Endpoint /courses/{course_uuid}/meta ### Parameters #### Path Parameters - **course_uuid** (string) - Required - The UUID of the course. #### Query Parameters - **with_unpublished_activities** (boolean) - Optional - If true, includes unpublished activities in the response. ### Response #### Success Response (200) - **activities** (array) - A list of activities within the course. ``` -------------------------------- ### Create a Course Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/index.mdx Initiates the creation of a new course. Capture the `course_uuid` and `id` from the response for subsequent steps. ```bash POST /api/v1/courses/?org_id={org_id} (multipart) ``` -------------------------------- ### Organizations - Get Details by Slug Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx Retrieves the details of an organization using its unique slug. ```APIDOC ## GET /api/v1/orgs/slug/{org_slug} ### Description Retrieves the details of an organization using its unique slug. ### Method GET ### Endpoint /api/v1/orgs/slug/{org_slug} ### Parameters #### Path Parameters - **org_slug** (string) - Required - The unique slug of the organization. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ### Request Example ```bash curl http://localhost:1338/api/v1/orgs/slug/your_org_slug \ -H "Authorization: Bearer " ``` ``` -------------------------------- ### Create Typed Activity (Video) Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/index.mdx Uploads a self-hosted video file and creates a video activity. ```bash /activities/video (multipart) ``` -------------------------------- ### Get a Specific Webhook Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/platform/automations/webhooks.mdx Retrieve details for a specific webhook endpoint using its unique identifier. ```http GET /api/v1/{org_id}/webhooks/{webhook_uuid} ``` -------------------------------- ### Create Course from Suggested Structure Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/assisted.mdx After suggesting and potentially editing the structure, use this command to create the course in the system. This command requires the ORG_ID, TEMP_ID, STRUCTURE, and TOKEN. ```bash curl -fsS -X POST "$API/courses/migrate/create?org_id=$ORG_ID" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d "{\"temp_id\":\"$TEMP_ID\",\"structure\":$STRUCTURE}" ``` -------------------------------- ### Login Endpoint (Form-Encoded) Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Example of logging in using form-encoded username and password. This endpoint is part of the Authentication group. ```bash # Login (form-encoded, not JSON) curl -X POST http://localhost:1338/api/v1/auth/login \ -F 'username=user@example.com' \ -F 'password=password' ``` -------------------------------- ### Get Meta with Unpublished Activities Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/index.mdx Retrieves course metadata including unpublished activities, useful for previewing before publishing. ```bash GET /courses/{course_uuid}/meta?with_unpublished_activities=true ``` -------------------------------- ### Instance Information API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx A GET request to the /api/v1/instance/info endpoint to retrieve public information about the current instance. ```bash GET /api/v1/instance/info ``` -------------------------------- ### Health Check API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx A GET request to the /api/v1/health endpoint to check the system's health status. ```bash GET /api/v1/health ``` -------------------------------- ### Create Chapters for a Course Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/programmatic.mdx Create three chapters for a course using the `post_json` helper function. Each chapter has a name, description, course ID, and organization ID. ```bash # ── 2. Three chapters ─────────────────────────────────────────────────────── CH1_ID=$(post_json "$API/chapters/" "{\"name\":\"1. Dynamic content\",\"description\":\"Pages, embeds, markdown\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) CH2_ID=$(post_json "$API/chapters/" "{\"name\":\"2. Media\",\"description\":\"Hosted video, YouTube, PDF\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) CH3_ID=$(post_json "$API/chapters/" "{\"name\":\"3. Interactive\",\"description\":\"Assignment\",\"course_id\":$CID,\"org_id\":$ORG_ID}" | jq -r .id) ``` -------------------------------- ### Fetch and Inspect Course Structure Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/programmatic.mdx Use this command to fetch the course tree after migration and verify its structure. The `slim=true` parameter optimizes the request by omitting the `content` field. ```bash curl "http://localhost:1338/api/v1/courses/$CUUID/meta?with_unpublished_activities=true&slim=true" \ -H "Authorization: Bearer $TOKEN" | jq \ '{chapters: (.chapters | length), activities: (.chapters | map(.activities | length) | add)}' ``` -------------------------------- ### Add Backend Dependency Source: https://github.com/learnhouse/docs/blob/main/content/developers/contributing/guidelines.mdx Use 'uv' to add new Python dependencies for the backend. This command manages package installations. ```bash uv add ``` -------------------------------- ### OpenAPI Specification API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx A GET request to the /openapi.json endpoint to retrieve the OpenAPI specification. This is available in development mode only. ```bash GET /openapi.json ``` -------------------------------- ### Content Delivery API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx A GET request to the /api/v1/content/... endpoint for delivering content, which can be sourced from the filesystem or S3. ```bash GET /api/v1/content/... ``` -------------------------------- ### View Current Configuration Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/installation/cli-reference.mdx Displays the current configuration settings of LearnHouse. ```bash learnhouse config ``` -------------------------------- ### Verify System Prerequisites Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Run these commands to check if your system meets the minimum version requirements for Docker, Docker Compose, Node.js, and npm. ```bash # Check Docker docker --version # Check Docker Compose docker compose version # Check Node.js node --version # Check npm npm --version ``` -------------------------------- ### Add Frontend Dependency Source: https://github.com/learnhouse/docs/blob/main/content/developers/contributing/guidelines.mdx Use 'bun' to add new JavaScript or TypeScript dependencies for the frontend. This command manages package installations. ```bash bun add ``` -------------------------------- ### Create Typed Activity (PDF Document) Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/index.mdx Uploads a PDF document and creates a document activity. ```bash /activities/documentpdf (multipart) ``` -------------------------------- ### Get Current User Profile Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Retrieve the profile information for the currently authenticated user. Requires an Authorization header with a valid token. ```bash # Get current user profile curl http://localhost:1338/api/v1/users/profile \ -H "Authorization: Bearer " ``` -------------------------------- ### Create Video Activity Source: https://github.com/learnhouse/docs/blob/main/public/llms-full.txt Use this multipart endpoint to create self-hosted video activities. This endpoint also creates the activity with published set to false. ```bash /activities/video (multipart, for hosted media) ``` -------------------------------- ### Create Hosted Video Activity Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/activity-types.mdx Creates a hosted video activity using a multipart POST request. The activity is initially published: false and requires a subsequent PUT request to publish. ```bash curl -X POST "http://localhost:1338/api/v1/activities/video" \ -H "Authorization: Bearer lh_your_api_token" \ -F 'name=Lesson 1 walkthrough' \ -F 'chapter_id=7' \ -F 'video_file=@./lesson-01.mp4;type=video/mp4' \ -F 'details={"startTime":0,"endTime":null,"autoplay":false,"muted":false}' ``` -------------------------------- ### AI - Stream Editor Message Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx Sends a message to the AI course assistant and receives a streaming response. This is an example of an AI streaming endpoint. ```APIDOC ## POST /api/v1/ai/stream/editor/message ### Description Sends a message to the AI course assistant and receives a streaming response. This is an example of an AI streaming endpoint. ### Method POST ### Endpoint /api/v1/ai/stream/editor/message ### Parameters #### Request Body - **message** (string) - Required - The user's message to the AI assistant. ### Request Example (Example not provided in source, refer to Swagger UI at /docs for full details) ### Response (Streaming response, refer to Swagger UI at /docs for full details) ``` -------------------------------- ### Get Organization Details API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx Fetch details of an organization using its unique slug. An Authorization header with a Bearer token is required. ```bash curl http://localhost:1338/api/v1/orgs/slug/{org_slug} \ -H "Authorization: Bearer " ``` -------------------------------- ### End-to-End Migration Script Source: https://github.com/learnhouse/docs/blob/main/content/developers/migration/assisted.mdx A bash script demonstrating the full migration process, from uploading files to creating the course, including token authentication. ```bash #!/usr/bin/env bash set -euo pipefail API=http://localhost:1338/api/v1 API_TOKEN=lh_your_api_token # Pro-plan API token ORG_SLUG=default ORG_ID=1 USER_ID=1 # the user to act as COURSE_NAME="Migrated content" # 0. Swap the API token for a user JWT (migrate/* endpoints reject API tokens) TOKEN=$(curl -fsS -X POST "$API/admin/$ORG_SLUG/auth/token" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"user_id":$USER_ID}' | jq -r .access_token) # 1. Upload everything in ./content/ UPLOAD_RESP=$(curl -fsS -X POST "$API/courses/migrate/upload?org_id=$ORG_ID" \ -H "Authorization: Bearer $TOKEN" \ $(for f in ./content/*; do echo -n "-F files=@$f "; done)) TEMP_ID=$(echo "$UPLOAD_RESP" | jq -r '.temp_id') ``` -------------------------------- ### Recommended Update Procedure for LearnHouse Source: https://github.com/learnhouse/docs/blob/main/content/self-hosting/maintenance/updates.mdx Follow these steps for a safe and reliable update process. This includes backing up your data, performing the update, and verifying the system's health. ```bash # 1. Create a backup learnhouse backup # 2. Run the update learnhouse update # 3. Verify all services are healthy learnhouse doctor # 4. Check logs for any errors learnhouse logs ``` -------------------------------- ### AI Streaming Message API Endpoint Source: https://github.com/learnhouse/docs/blob/main/content/developers/api/endpoints.mdx An example of a streaming endpoint for AI features, specifically for sending messages to an editor. This is part of the AI-powered features. ```bash POST /api/v1/ai/stream/editor/message ```