# cerpus/edlib architecture

> Architecture diagram of the GitHub repository cerpus/edlib, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cerpus/edlib
- Repository: https://github.com/cerpus/edlib

## Overview

Edlib is a learning-content authoring and reuse platform. Authors create or edit interactive H5P resources, save them with publication, sharing, and licensing choices, and can version, copy, or translate resources. Learners and educators can discover and reuse published content in the Hub or insert it into an LMS through LTI. The README also documents broad H5P support and optional media/translation integrations. Hub discovery is documented, but its search implementation was not sampled; the graph therefore omits internal search wiring.

Main entry points: [`sourcecode/apis/contentauthor/app/Http/Controllers/H5PController.php`](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Http/Controllers/H5PController.php) (H5P workflows), [`sourcecode/hub/app/Http/Controllers/ContentController.php`](https://github.com/cerpus/edlib/blob/master/sourcecode/hub/app/Http/Controllers/ContentController.php) (Hub content use), [`sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php`](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php) (H5P storage), [`sourcecode/apis/contentauthor/app/ContentVersion.php`](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/ContentVersion.php) (Versions and variants)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_author["Authoring"]
  node_h5p_controller["H5P workflows<br/>[H5PController.php]"]
  node_storage_request["Save validation"]
end

subgraph group_h5p["H5P Runtime"]
  node_h5p_editor["H5P editor<br/>[EditorStorage.php]"]
  node_h5p_storage["H5P storage"]
  node_library_store[("H5P library database<br/>[H5PLibrary.php]")]
end

subgraph group_content["Content Lifecycle"]
  node_h5p_content["H5P resources<br/>[H5PContent.php]"]
  node_content_versions["Versions and variants<br/>[ContentVersion.php]"]
  node_version_listeners["Version handling"]
  node_license["License rules<br/>[LicenseContent.php]"]
  node_content_store[("Content database<br/>[H5PContent.php]")]
end

subgraph group_hub["Hub and LTI"]
  node_hub_content["Hub content use"]
  node_hub_discovery["Find and reuse"]
  node_lti_selection["Legacy LTI selection"]
end

subgraph group_integrations["External Services"]
  node_media_adapters["Media adapters"]
  node_translation_adapters["Translation adapters"]
end

node_author(("Authors"))
node_learner(("Learners and LMS"))
node_media_services["Media APIs"]
node_translation_service["Translation API"]
node_filesystem[("File storage")]

node_author -->|"creates or edits"| node_h5p_controller
node_h5p_controller -->|"validates saves"| node_storage_request
node_h5p_controller -->|"configures editor"| node_h5p_editor
node_h5p_controller -->|"persists resource"| node_h5p_content
node_h5p_storage -->|"stores resource data"| node_content_store
node_h5p_storage -->|"manages libraries"| node_library_store
node_h5p_storage -->|"reads and writes files"| node_filesystem
node_h5p_editor -->|"loads library metadata"| node_library_store
node_h5p_content -->|"has versions"| node_content_versions
node_content_versions -->|"dispatches lifecycle events"| node_version_listeners
node_h5p_controller -->|"checks license"| node_license
node_h5p_controller -.->|"requests media"| node_media_adapters
node_media_adapters -.->|"calls media APIs"| node_media_services
node_h5p_controller -.->|"requests translation"| node_translation_adapters
node_translation_adapters -.->|"calls translation API"| node_translation_service
node_learner -->|"finds content"| node_hub_discovery
node_author -->|"shares or copies"| node_hub_content
node_hub_discovery -->|"opens or reuses"| node_hub_content
node_hub_content -->|"selects for LMS"| node_lti_selection
node_lti_selection -->|"returns LTI link"| node_learner
node_hub_content -->|"creates linked version"| node_content_versions

click node_h5p_controller "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Http/Controllers/H5PController.php"
click node_storage_request "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Http/Requests/H5PStorageRequest.php"
click node_h5p_editor "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/EditorStorage.php"
click node_h5p_storage "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php"
click node_h5p_content "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PContent.php"
click node_content_versions "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/ContentVersion.php"
click node_version_listeners "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Listeners/H5P/HandleVersioning.php"
click node_license "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Rules/LicenseContent.php"
click node_media_adapters "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/Video/NDLAVideoAdapter.php"
click node_translation_adapters "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/TranslationServices/NynorobotAdapter.php"
click node_hub_content "https://github.com/cerpus/edlib/blob/master/sourcecode/hub/app/Http/Controllers/ContentController.php"
click node_hub_discovery "https://github.com/cerpus/edlib/tree/master/sourcecode/hub/app/Http/Controllers"
click node_lti_selection "https://github.com/cerpus/edlib/blob/master/sourcecode/hub/app/Http/Controllers/NdlaLegacy/SelectController.php"
click node_content_store "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PContent.php"
click node_library_store "https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PLibrary.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_h5p_controller,node_storage_request toneBlue
class node_h5p_editor,node_h5p_storage,node_library_store,node_filesystem toneAmber
class node_h5p_content,node_content_versions,node_version_listeners,node_license,node_content_store,node_media_services,node_translation_service toneMint
class node_hub_content,node_hub_discovery,node_lti_selection toneRose
class node_media_adapters,node_translation_adapters,node_author,node_learner toneIndigo
```

## Components

### Authoring

- [H5P workflows](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Http/Controllers/H5PController.php): `sourcecode/apis/contentauthor/app/Http/Controllers/H5PController.php`
- [Save validation](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Http/Requests/H5PStorageRequest.php): `sourcecode/apis/contentauthor/app/Http/Requests/H5PStorageRequest.php`

### H5P Runtime

- [H5P editor](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/EditorStorage.php): `sourcecode/apis/contentauthor/app/Libraries/H5P/EditorStorage.php`
- [H5P storage](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php): `sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php`
- [H5P library database](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PLibrary.php): `sourcecode/apis/contentauthor/app/H5PLibrary.php`

### Content Lifecycle

- [H5P resources](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PContent.php): `sourcecode/apis/contentauthor/app/H5PContent.php`
- [Versions and variants](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/ContentVersion.php): `sourcecode/apis/contentauthor/app/ContentVersion.php`
- [Version handling](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Listeners/H5P/HandleVersioning.php): `sourcecode/apis/contentauthor/app/Listeners/H5P/HandleVersioning.php`
- [License rules](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Rules/LicenseContent.php): `sourcecode/apis/contentauthor/app/Rules/LicenseContent.php`
- [Content database](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/H5PContent.php): `sourcecode/apis/contentauthor/app/H5PContent.php`

### Hub and LTI

- [Hub content use](https://github.com/cerpus/edlib/blob/master/sourcecode/hub/app/Http/Controllers/ContentController.php): `sourcecode/hub/app/Http/Controllers/ContentController.php`
- [Find and reuse](https://github.com/cerpus/edlib/tree/master/sourcecode/hub/app/Http/Controllers): `sourcecode/hub/app/Http/Controllers`
- [Legacy LTI selection](https://github.com/cerpus/edlib/blob/master/sourcecode/hub/app/Http/Controllers/NdlaLegacy/SelectController.php): `sourcecode/hub/app/Http/Controllers/NdlaLegacy/SelectController.php`

### External Services

- [Media adapters](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/Video/NDLAVideoAdapter.php): `sourcecode/apis/contentauthor/app/Libraries/H5P/Video/NDLAVideoAdapter.php`
- [Translation adapters](https://github.com/cerpus/edlib/blob/master/sourcecode/apis/contentauthor/app/Libraries/H5P/TranslationServices/NynorobotAdapter.php): `sourcecode/apis/contentauthor/app/Libraries/H5P/TranslationServices/NynorobotAdapter.php`

### Other components

- **Authors**
- **Learners and LMS**
- **Media APIs**
- **Translation API**
- **File storage**

## Connections

- Authors → H5P workflows: creates or edits
- H5P workflows → Save validation: validates saves
- H5P workflows → H5P editor: configures editor
- H5P workflows → H5P resources: persists resource
- H5P storage → Content database: stores resource data
- H5P storage → H5P library database: manages libraries
- H5P storage → File storage: reads and writes files
- H5P editor → H5P library database: loads library metadata
- H5P resources → Versions and variants: has versions
- Versions and variants → Version handling: dispatches lifecycle events
- H5P workflows → License rules: checks license
- H5P workflows → Media adapters: requests media
- Media adapters → Media APIs: calls media APIs
- H5P workflows → Translation adapters: requests translation
- Translation adapters → Translation API: calls translation API
- Learners and LMS → Find and reuse: finds content
- Authors → Hub content use: shares or copies
- Find and reuse → Hub content use: opens or reuses
- Hub content use → Legacy LTI selection: selects for LMS
- Legacy LTI selection → Learners and LMS: returns LTI link
- Hub content use → Versions and variants: creates linked version
