Getting started¶
This page gets you from a fresh clone to a running Moodle Playground instance and your first blueprint. If you just want to try it, use the hosted version at https://moodle-playground.com — no install needed.
Requirements¶
| Tool | Version | Why |
|---|---|---|
| Node.js | 18+ | Runs the shell bundler and Playwright tests. |
| npm | bundled | Package management. |
| Python 3 | 3.12+ | Moodle build helpers and docs (Zensical). |
| PHP | 8.3 | Only needed when (re)generating install snapshots. |
| Git | any | Cloning and submodule fetches. |
Tip
The hosted site does not need any of the above — all these requirements are only for local development or contributing.
Local setup¶
Building the runtime¶
Running locally¶
This starts a static HTTP server at http://localhost:8080.
Why a local HTTP server?
The playground uses a service worker to intercept requests and route them to the PHP runtime. Service workers only register on https:// or http://localhost, so opening index.html straight from the filesystem will not work.
Validation commands¶
Quick syntax checks across the runtime files:
node --check sw.js
node --check php-worker.js
node --check src/runtime/bootstrap.js
node --check src/runtime/php-loader.js
node --check src/runtime/php-compat.js
node --check src/runtime/crash-recovery.js
node --check src/shell/main.js
node --check src/remote/main.js
node --check src/blueprint/index.js
Blueprint unit tests:
Full lint + unit tests (same as CI):
Building the documentation¶
The docs site is built with Zensical, a Rust-backed static site generator that consumes the same mkdocs.yml as Material for MkDocs.
Preview at http://localhost:8000. The dev server auto-reloads on every edit.
Python 3.10+ required
Zensical's current releases target Python 3.10+. Older interpreters will resolve to a placeholder package on PyPI that has no CLI. If zensical --version errors out, double-check your interpreter.
Configuration via URL parameters¶
The playground accepts URL parameters to select Moodle and PHP versions, or to load a blueprint at boot:
| Parameter | Example | Description |
|---|---|---|
moodle |
?moodle=4.4 |
Moodle branch to load. |
php |
?php=8.3 |
PHP version to boot. |
blueprint |
?blueprint=<json-or-base64> |
Inline blueprint (JSON, base64, or data: URL). |
blueprint-url |
?blueprint-url=/path/to/blueprint.json |
Load a remote or local blueprint file. |
These parameters are also exposed as controls in the Settings panel of the UI.
First blueprint¶
Blueprints are small JSON files that describe how a playground instance should look at boot. They run as a sequence of steps — install Moodle, create a user, create a course, enrol the user, and so on.
A minimal example:
| demo.blueprint.json | |
|---|---|
Load it directly via URL:
Where blueprints live¶
| Path | Purpose |
|---|---|
assets/blueprints/default.blueprint.json |
The default blueprint loaded when no URL override is given. |
assets/blueprints/examples/ |
Example blueprints shipped with the project. |
Next steps¶
- Read the full Blueprint reference
- Browse the Blueprint gallery
- Understand the Architecture
- Set up a development environment