This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
H5P Integration Kit - A comprehensive collection of examples for integrating H5P interactive content into applications without h5p.com, WordPress, or built-in LMS plugins.
- H5P Server (port 3000) - Node.js server using
@lumieducation/h5p-serverv10.x - Simple Examples - Single-file integrations in Flask, FastAPI, PHP, .NET
- Django Example - Full Django app with reusable
django_h5pplugin - LTI Provider - LTI 1.3 tool provider for LMS integration
Note: We use nvm (Node Version Manager) for Node.js. Node.js v24.11.0 is installed via nvm at /home/chris/.nvm/versions/node/v24.11.0/.
h5p-integration-kit/
├── h5p-server/ # Shared Node.js H5P server
├── examples/
│ ├── python-flask/ # Single-file Flask example
│ ├── python-fastapi/ # Single-file FastAPI example
│ ├── php/ # Single-file PHP example
│ ├── dotnet/ # Single-file .NET 8 example
│ ├── django/ # Full Django example
│ │ ├── django_h5p/ # Reusable plugin
│ │ ├── sample_lms/ # Demo LMS app
│ │ └── lms_project/ # Django settings
│ └── lti-provider/ # LTI 1.3 tool provider
└── docker-compose.yml
export PATH="/home/chris/.nvm/versions/node/v24.11.0/bin:$PATH"
cd h5p-server && npm start# Flask
cd examples/python-flask && pip install flask && python app.py
# FastAPI
cd examples/python-fastapi && pip install fastapi uvicorn aiosqlite && uvicorn app:app --port 5000
# PHP
cd examples/php && php -S localhost:5000
# .NET
cd examples/dotnet && dotnet run
# Django
cd examples/django && source .venv/bin/activate && python manage.py runserver
# LTI Provider
cd examples/lti-provider && pip install -r requirements.txt && python app.pyIMPORTANT: When restarting servers, ALWAYS use run_in_background: true. Server processes never terminate.
# Kill and restart H5P server
lsof -ti:3000 | xargs -r kill -9
cd h5p-server && export PATH="/home/chris/.nvm/versions/node/v24.11.0/bin:$PATH" && npm start
# (use run_in_background: true)All examples follow the same pattern:
Your App (Flask/FastAPI/PHP/.NET/Django)
│
├── /create → opens popup to H5P /new
├── /callback → receives contentId after save
├── /play/<id> → embeds iframe to H5P /play/<id>
└── /webhook → receives xAPI scores
│
▼
H5P Server (localhost:3000)
├── /new → H5P editor for new content
├── /edit/:id → H5P editor for existing content
├── /play/:id → H5P player
├── /api/content → content listing API
└── /health → health check
| Endpoint | Method | Description |
|---|---|---|
/new |
GET | Editor for new content |
/edit/{id} |
GET | Editor for existing content |
/play/{id} |
GET | Player for content |
/api/content |
GET | List all content |
/api/content/{id} |
DELETE | Delete content |
/health |
GET | Health check |
Query parameters:
returnUrl- Callback URL after save (for /new, /edit)userId- User ID for tracking (for /play)
All examples receive xAPI scores at their /webhook endpoint:
{
"contentId": "abc123",
"userId": "demo-user",
"statement": {
"verb": { "id": "http://adlnet.gov/expapi/verbs/completed" },
"result": {
"score": { "raw": 8, "max": 10 },
"completion": true
}
}
}app.py- Complete Flask application (~250 lines)
app.py- Complete FastAPI application (~250 lines)
index.php- Complete PHP application (~300 lines)
Program.cs- Complete .NET 8 application (~300 lines)H5PExample.csproj- Project file
django_h5p/models.py- H5PContent, H5PGrade modelsdjango_h5p/views.py- xAPI webhook, player, editor viewssample_lms/views.py- Activity CRUD viewssample_lms/models.py- Course, Activity models
app.py- LTI 1.3 tool provider (~400 lines)tool_config.json- LMS configuration (create this)private.key,public.key- RSA keys (generate these)
- H5P Server: http://localhost:3000
- Flask Example: http://localhost:5000
- FastAPI Example: http://localhost:5000
- PHP Example: http://localhost:5000
- .NET Example: http://localhost:5000
- Django Example: http://localhost:8000
- LTI Provider: http://localhost:5001
PORT=3000
H5P_BASE_URL=http://localhost:3000
H5P_DATA_PATH=/data/h5pMost examples use constants at the top of the file:
H5P_SERVER = 'http://localhost:3000'
APP_URL = 'http://localhost:5000'
DATABASE = 'h5p_data.db'Each example can be tested with the same flow:
- Start H5P server:
cd h5p-server && npm start - Start example:
python app.py(or equivalent) - Open browser to example URL
- Click "Create New Content"
- Create H5P content in editor
- Save - popup closes, content appears in list
- Click "Play" to interact with content
- Check "Grades" to see scores