Products & Templates

Creating Products

Products are reusable WordPress site templates that define which plugins, themes, branding, and restrictions to apply when launching a demo site.

Interactive Setup

The easiest way to create a product is with the interactive script:

bash scripts/create-product.sh

The script walks you through:

  1. Basic info: Product ID (slug), display name
  2. Database engine: SQLite, MySQL 8.4, or MariaDB 11
  3. WordPress settings: Admin user credentials, landing page
  4. Plugins: WordPress.org slugs, custom ZIP URLs, or local files
  5. Themes: Theme slugs, active theme selection
  6. Demo settings: Expiration hours, concurrent site limits
  7. Branding: Banner text, description, image URL
  8. Restrictions: Disabled file mods, hidden menus, blocked capabilities

This creates a products/<product-id>.json config file and a product-assets/<product-id>/ directory for any local plugin ZIPs.

Adding Products While Running

WordPress.org plugins only

# 1. Create the product JSON config
# 2. Build the product image
bash scripts/build-wp-image.sh --product your-product
# 3. Restart the API to pick up the new product
docker compose restart api

Local/custom plugins

# 1. Place plugin ZIP files in product-assets/your-product/
# 2. Create the product JSON config referencing local sources
# 3. Build the product image
bash scripts/build-wp-image.sh --product your-product
# 4. Restart the API
docker compose restart api

Product Example: WooCommerce Demo

{
  "id": "woocommerce-demo",
  "name": "WooCommerce Store Demo",
  "database": "sqlite",
  "plugins": {
    "preinstall": ["woocommerce", "flavor"],
    "remove": ["hello", "akismet"]
  },
  "themes": {
    "install": ["flavor"],
    "active": "flavor",
    "remove": ["twentytwentyfour"]
  },
  "demo": {
    "expiration": 48,
    "maxConcurrentPerUser": 2,
    "adminUser": { "username": "shopadmin", "password": "demo123" },
    "landingPage": "/shop/"
  },
  "restrictions": {
    "disableFileModifications": true,
    "hiddenMenus": ["tools.php"],
    "blockedCapabilities": ["install_plugins", "install_themes"]
  },
  "branding": {
    "bannerText": "WooCommerce Store Demo",
    "description": "Explore a fully configured WooCommerce store",
    "image": "https://ps.w.org/woocommerce/assets/icon-256x256.gif"
  }
}

Updating Products

  1. Update plugin files in product-assets/ or modify the JSON config
  2. Rebuild the product image: bash scripts/build-wp-image.sh --product your-product
  3. Restart the API: docker compose restart api
Note: New demo sites will use the updated image. Existing running sites are unaffected — they continue with the image they were launched with.