Developers

Get Started

~5 min

Build your first Meteorack module against the portable SDK contracts while WordPress hosts it today.

Prerequisites

  • WordPress 6.4+ and PHP 8.2+
  • Meteorack Hub installed and active
  • WP-CLI access on the target site

Build your first Meteorack module against the portable SDK contracts while the Hub plugin hosts it inside WordPress today.

Portable package surfaces live in @meteorack/modules-sdk-core and @meteorack/modules-sdk-ui. The Hub and runtime-wp are the current compatibility host, not the long-term permanent runtime.

Install the Hub

The Hub provides the current runtime-wp host: crash isolation, module discovery, module-scoped services, asset loading, and CLI tools.

wp plugin install meteorack-suite --activate

Scaffold a module

Use the scaffold command instead of inventing a custom directory layout. The generated structure matches the current host runtime, React entry conventions, and test locations while keeping the module on the path toward portable contracts and durable package exports.

wp meteorack scaffold my-first-module

Review module.json

module.json is parsed before boot. It defines identity, compatibility, capabilities, dependencies, and entrypoints.

As the runtime boundary evolves, the same manifest shape is expected to describe portable module entrypoints first and WordPress bootstrap glue second.

{
  "slug": "my-first-module",
  "name": "My First Module",
  "version": "1.0.0",
  "minSdkVersion": "1.0.0",
  "maxTestedSdkVersion": "1.0.0",
  "kind": "provider",
  "category": "Other",
  "tags": [],
  "builderConfigurable": false,
  "capabilities": ["manage_options"],
  "requires": [],
  "priority": 10,
  "reactMode": "wp",
  "runtimeTargets": ["wp"],
  "provider": "acme",
  "entrypoints": {
    "admin": ["my-first-module"],
    "wpBootstrap": "bootstrap.php"
  },
  "description": "My first Meteorack module"
}

Customize bootstrap.php

The current WordPress host loads bootstrap.php and expects it to return an AbstractModule instance. onSdkReady() is the main place to wire host bootstrap behavior today.

Keep long-lived business logic and UI logic on the portable side where possible. Treat bootstrap.php as host glue rather than the permanent center of the module architecture.

<?php

declare(strict_types=1);

use Meteorack\Sdk\Core\SdkContext;
use Meteorack\Sdk\RuntimeWp\AbstractModule;

class MyFirstModule extends AbstractModule
{
    public function getSlug(): string { return 'my-first-module'; }
    public function getName(): string { return 'My First Module'; }
    public function getVersion(): string { return '1.0.0'; }

    public function onSdkReady(SdkContext $ctx): void
    {
        parent::onSdkReady($ctx);

        $ctx->logger()->info('my_first_module.boot', []);
        $this->setSetting('enabled', true);
    }
}

return new MyFirstModule();

Activate and verify

Activate the module and confirm discovery through WP-CLI.

wp meteorack modules activate my-first-module
wp meteorack modules list

Expected result:

+------------------+------------------+---------+--------+---------+
| Slug             | Name             | Version | Status | License |
+------------------+------------------+---------+--------+---------+
| my-first-module  | My First Module  | 1.0.0   | active | trial   |
+------------------+------------------+---------+--------+---------+

At this point the Hub has discovered the module, booted it in isolation, and injected a module-scoped compatibility context for the WordPress host runtime.