Skip to content

Getting started

Requirements

  • Node.js 18+
  • npm
  • Python 3 for Moodle build helpers and docs
  • Git

Local setup

git clone https://github.com/ateeducacion/moodle-playground.git
cd moodle-playground
npm install

Building the runtime

# Install deps and build the worker bundle
make prepare

# Build the default Moodle bundle (ZIP + install snapshot)
make bundle

# Build all Moodle bundles (parallelizable via JOBS=...)
make bundle-all JOBS=2

# Build just the PHP worker bundle
npm run build:worker

Running locally

make serve

This starts a local HTTP server at http://localhost:8080.

Validation commands

Quick syntax checks for the main 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/shell/main.js
node --check src/remote/main.js
node --check src/blueprint/index.js

Run the blueprint unit tests:

npm run test:blueprint

Building the documentation

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-docs.txt
mkdocs serve

Preview at http://127.0.0.1:8000.

Configuration

The playground supports URL parameters to select Moodle and PHP versions:

Parameter Example Description
moodle ?moodle=4.4 Moodle version
php ?php=8.3 PHP version
blueprint ?blueprint=<json-or-base64> Inline blueprint (JSON, base64, or data-URL)
blueprint-url ?blueprint-url=<url> URL to a remote blueprint file

These can also be set via the Settings panel in the UI.

Blueprints

Blueprints are step-based JSON files that configure and provision a playground instance at boot. They can create users, categories, courses, enrolments, course modules, and more.

{
  "steps": [
    { "step": "installMoodle", "options": { "siteName": "My Moodle" } },
    { "step": "login", "username": "admin" },
    { "step": "createCourse", "fullname": "Demo", "shortname": "DEMO1", "category": "Miscellaneous" }
  ]
}

See the Blueprint reference for the full format and all step types.

The default blueprint is at assets/blueprints/default.blueprint.json. Example blueprints are in assets/blueprints/examples/.