Skip to main content

Worked examples

The best examples are the shipping plugins — each one is the reference implementation of a pattern. Generated skeletons stay fresh by construction: node tools/scripts/create-plugin.mjs sample --surfaces console,tenantApi scaffolds a complete, test-passing plugin you can read and delete. First-party plugin libs are deliberately not duplicated as "example" libs — they would rot, and the scaffolder and the live plugins can't. The one checked-in example is the sandbox marketplace plugin below, which exists because the sandbox contract has no first-party equivalent to read.

PatternRead thisWhy
Console-only pluginlibs/plugins/redirectsThe minimal shape: one nav item + page, server-side enforcement, no canvas bundle
Full-stack featurelibs/plugins/commercePages, widgets, canvas components, page resolvers, APIs, billing hooks — everything at once
Site enricher + runtime pairlibs/plugins/marketingServer enricher writes page props; the registered runtime reads them back
Plugin→plugin compositionlibs/plugins/inboxComposes a section from marketing — the dependency direction plugins are allowed
Site canvas componentslibs/plugins/bookingsCanvas component + console manager + APIs + a config schema (maxDaysAhead) and a scheduled job
Custom field typelibs/plugins/marketplace (rating)Pure-data type + client Input, registered from both surfaces
Plugin permissionslibs/plugins/commerce (managePos)Per-tier defaults riding every resolved role set
Marketplace realm bundletools/plugin-loader/realm/demo (+ EXPLAINED.md)The standalone track, narrated line by line
Marketplace startertools/plugin-loader/realm/templateWhat you actually copy to begin
Sandbox marketplace pluginexamples/plugins/promo-countdownA complete, publishable sandbox plugin with no build step — register(), render, props, config scheme, emitted events, and cleanup. Passes the bundle verifier as-is, so it doubles as the worked example for uploading a plugin
Declared network originexamples/plugins/zen-quoteThe only example that DECLARES an origin and calls it (capabilities.network). Shows both jobs that one line does: the publish-time diff refuses an undeclared origin, and the frame's connect-src refuses one at runtime. Write the URL inline — a URL in a const is not yet followed (AGL-1093)
Declared connection, server-rendered elementexamples/plugins/google-reviewsThe Aglyn org's Google reviews plugin. Its manifest declares an OAuth connection (an account and location picker, a six-hourly sync, a typed record) and an image host. Its one site element reads the record with usePluginConnectionRecord, draws with the site's MUI, and renders nothing until there are real reviews. Built with Rollup from src/; google-reviews.test.mjs renders the shipped bundle on the server against a fixture record