# Writing a Runway plugin — the authoring guide > **Audience:** a developer starting a **new Runway plugin from scratch**. > **Scope:** the complete plugin contract of the Runway kernel at **SPI `1.0.0`** (Runway `1.0.0`; frozen — > within `1.x` it changes only additively, see the kernel's `docs/SPI-STABILITY.md`) — the descriptor, every extension > axis, the **service tier** through which a plugin reaches the kernel, the `POST`/CSRF rules, the build, the > install, how to verify, and the traps. Everything here is grounded in the kernel as built and verified against the > packaged host jar; a gap is called a gap. > > **A plugin links only the Runway SPI** (`mx.quest.runway.spi.*`). The kernel **blocks** a plugin that links its > internal classes, breaks the Spring-context rules (§5) or declares no `requiresSpi` floor of at least `0.4.0` (§4) > — the plugin is skipped with the reason in the log and on the Plugins screen; the platform still boots. Every > first-party plugin under `plugins/` is on the service tier; this guide describes only that contract. > > The **`demo`** plugin (`../demo/`, walkthrough in `../demo/docs/DEMO-PLUGIN.md`) is the worked reference: it uses > every axis and every service once, where a real plugin would, with a comment saying when to use it. Copying > `demo/` and deleting what you don't need is the fastest correct start. The kernel's own developer guide is > [`docs/PLUGIN-DEVELOPMENT.md`](../../docs/PLUGIN-DEVELOPMENT.md) at the root of the repository. --- ## 1. What a Runway plugin *is* - **A folder**, deployed under the host's external tree at `external/plugins//`, containing: - `plugin.yml` — the declarative descriptor (required, at the folder root); - one **thin** `*.jar` — only *your* classes (never the kernel, never Spring; see §3); - optional `lib/` (bundled third-party jars, scanned one level deep), `static/`, `templates/`, `i18n/`. - **Trusted first-party code, not a sandbox.** Plugin jars load into one shared child classloader whose parent is the application classloader; your `mainClass` `@Configuration` is registered into the host Spring context *before* refresh, so your beans wire like the kernel's — and receive the kernel's **services** (§7) by ordinary injection. - **Restart-to-install, degrade-don't-crash.** Install / upgrade / remove = change the folder and **restart** (no hot reload). A malformed, disabled or broken plugin is logged and skipped; a plugin that breaks the boot is **quarantined** (the kernel writes `external/plugin-quarantine/.yml`, relaunches, and the next boot shows it Blocked); the platform always comes up. - **Your package MUST live outside `mx.quest.runway`** (e.g. `com.acme.myplugin`): the host would scan it, and the kernel treats a plugin class under `mx.quest.runway` as host linkage. --- ## 2. Prerequisites - **JDK 25**. - **Maven**. - **`mx.quest:runway-spi` and `mx.quest:runway-spi-testkit` in your `~/.m2`**, at the version of the kernel you build for (`ls ~/.m2/repository/mx/quest/runway-spi/`). That is all of Runway a plugin compiles against. Their Maven version is the **kernel's release version**, not the SPI level: `1.0.0` carries SPI `1.0.0` (the jar's `RunwaySpi.VERSION` says which), and a later kernel such as `1.0.1` may carry the same SPI. - **Where those jars come from: the kernel release's assets.** No Maven repository serves them. Every kernel release on the releases page () attaches, for its version ``, `runway-spi-.jar`, `runway-spi-testkit-.jar`, their `-sources.jar` and a standalone pom for each (no parent, versions resolved — the testkit's names `runway-spi` at the same version), all listed in that release's `SHA256SUMS`. Install them once per kernel version you build against: ```sh V=1.0.0 # Download the six runway-spi* files and SHA256SUMS from the v$V release page. sha256sum -c --ignore-missing SHA256SUMS # each of the six must print OK; fails if none was verified mvn install:install-file -Dfile=runway-spi-$V.jar -DpomFile=runway-spi-$V.pom \ -Dsources=runway-spi-$V-sources.jar mvn install:install-file -Dfile=runway-spi-testkit-$V.jar -DpomFile=runway-spi-testkit-$V.pom \ -Dsources=runway-spi-testkit-$V-sources.jar ``` **Do not skip the checksum:** a download that returns an HTML page (a sign-in or error page) with HTTP 200 instead of the asset passes `curl -f`, and `install:install-file` would install it as a "jar". **Install with the pom** (`-DpomFile`), not `-DgroupId/-DartifactId`, so Maven knows the testkit needs `runway-spi`. A local build of the kernel's source puts the same artifacts in `~/.m2` too — but a release of your plugin is built against a **released** kernel version, never the kernel's `-SNAPSHOT` (§3, point 4). The kernel's `docs/PLUGIN-DEVELOPMENT.md` §3, *Getting the jars*, says the same. --- ## 3. The project (pom.xml) A plugin is an ordinary Maven `jar` project: 1. **Depend on `runway-spi` (`provided`) and `runway-spi-testkit` (`test`) — never on `runway-app`, in any scope.** A host import then does not compile, which is the point. `provided` says what is true: the kernel supplies the SPI at runtime and the plugin never ships it (the kernel docs recommend the same). The plugins in this repo declare it with the default `compile` scope, which is harmless here: `runway-spi` is resolved parent-first at runtime, and their zips are built from an explicit file list that never includes a dependency jar. 2. **Platform libraries are `provided`.** The host supplies Spring Framework 7, Spring Boot 4, Spring MVC, Spring Security, Thymeleaf, Jackson 3 (incl. `jackson-dataformat-yaml`) and the Jakarta EE 11 APIs; the kernel's MAJOR line pins their MAJOR lines. Compile against the ones you use; never bundle them (a second copy is a second `Class` identity, and by-type collection of your beans silently breaks). 3. **No `spring-boot-maven-plugin` repackage** — `mvn package` produces a thin jar of only your classes. Inherit `spring-boot-starter-parent` to get the host's managed versions. 4. **Reproducible builds**: set `project.build.outputTimestamp` (bump it per release) so two builds are byte-identical. Build a release against a **released** kernel artifact, never a `-SNAPSHOT`: a snapshot changes under the same version, and so does your jar — compile-time constants such as `RunwaySpi.VERSION` are copied into your classes, and the jar embeds your `pom.xml` (`META-INF/maven/…`). The same holds for any pom edit, the kernel version included: a rebuild with it no longer matches the published archive, so it ships as a new version. ```xml org.springframework.bootspring-boot-starter-parent 4.0.6 com.acmerunway-plugin-myplugin1.0.0 25 2026-10-18T00:00:00Z 1.0.0 mx.questrunway-spi${runway.version} mx.questrunway-spi-testkit${runway.version} test org.springframework.bootspring-boot-starter provided org.springframework.bootspring-boot-starter-test test runway-plugin-myplugin ``` (A plugin release pins a **released** kernel in `runway.version` — one published on the kernel's releases page — never a `-SNAPSHOT` (point 4). Moving the pin is a new plugin version; a plugin that needs nothing new from the kernel keeps its pin until its next release. When you copy a first-party pom, `demo/pom.xml` included, set `runway.version` to the release you build against.) --- ## 4. The descriptor (plugin.yml) Parsed with unknown keys ignored (forward/backward compatible). The **install folder name MUST equal `id`**. ```yaml id: myplugin # REQUIRED. Path-safe (/[A-Za-z0-9][A-Za-z0-9._-]*/). == install-dir name. name: My Plugin # REQUIRED. Shown in the management UI. version: 1.0.0 # REQUIRED. STRICT plain MAJOR.MINOR.PATCH — no qualifiers. mainClass: com.acme.myplugin.MyPluginConfig # the @Configuration; omit for a code-less library/asset plugin. # The LOWEST SPI level whose types you use (the newest type decides): ">=0.4.0" PluginSettings/PluginInfo/ # PluginLifecycle; ">=0.5.0" PluginSiteFiles, Sites, RequestContext, AccessCheck, Messages, SitePages, anonymous # routes, siteData; ">=0.6.0" ContentCatalogView, ContentChanges, SiteEventListener, @ConsoleScreen; ">=1.0.0" # HeadContext.origin(). All four are 1.x floors: a plugin declaring any of them loads on every 1.x kernel. A kernel # below it BLOCKS the plugin with a reason. A plugin with a mainClass MUST declare a floor >= 0.4.0: without one it is # blocked as "built for the pre-1.0 plugin contract" (a code-less library plugin is exempt). requiresSpi: ">=0.6.0" enabled: true # optional (default true) — the operator's disable switch. essential: false # honored ONLY for kernel security-floor ids on the allowlist ('protection'). requires: [ other >= 1.2.0 ] # optional. Forms: `id`, `id >= v`, `id == v` (single space). Never an essential id. conflicts: [ legacy ] # optional. The declaring plugin steps aside if a listed id is installed and enabled. # Personal data in your per-site folder (sites//plugins//): left OUT of a site's transfer copy and # listed in its manifest; full backups keep it. A trailing "/" names a folder. Rule: any file holding visitor or # user input is personal. siteData: personal: - submissions.tsv # Grantable control points, namespaced |. defaultRoles: leave EMPTY — a control point starts ungranted; # administrators hold it via the wildcard tier and a superadmin grants it explicitly. A reserved/master tier in # defaultRoles is a hard startup failure. The reserved id `settings` gates the per-site settings form. permissions: - { id: settings, realm: tenant, label: myplugin.perm.settings, defaultRoles: [] } - { id: manage, realm: tenant, label: myplugin.perm.manage, defaultRoles: [] } # App-level settings (PLATFORM concerns): bound as runway.plugin.. from external/plugin-settings/.yml, # applied on RESTART, read through your own @ConfigurationProperties bean (§7.2). settings: - { key: some.flag, type: boolean, default: true, label: myplugin.settings.flag } # Per-site settings (tenant-owned BEHAVIOUR): sites//plugins/.yml, applied IMMEDIATELY, read with # PluginSettings (§7.2). `settings` gates the form. siteSettings: - { key: enabled, type: boolean, default: true, label: myplugin.settings.enabled } - { key: style, type: enum, default: info, range: "info,warning,danger", label: myplugin.settings.style } - { key: apiKey, type: secret, label: myplugin.settings.apiKey } # Per-placement widget settings, keyed by the ContentWidget key(): sites//widget-instances.yml; the values # reach the widget as WidgetView.config(). Keep defaults in code. widgetSettings: myhero: - { key: heading, type: string, label: myplugin.widget.heading } # Console menu entry. `permission` is the FULL key; visibility is UX only. `icon`: a Font Awesome class. menu: - { realm: tenant, region: menu, order: 60, label: myplugin.menu.link, path: "/__admin/myplugin", permission: "myplugin|manage", icon: "fa-solid fa-feather-pointed" } # Dashboard card: `fragment` resolves to __plugin__// = templates/.html. dashboardCards: - { realm: tenant, order: 20, fragment: dashboard, permission: "myplugin|manage" } ``` Also understood: `settingGroups` (titled sections of the settings forms) and `helpUrl` — see the kernel's PLUGIN-DEVELOPMENT §5. ### 4.1 Setting types (and their traps) | `type` | Java value | Notes / trap | |-----------|-------------------|--------------| | `string` | `String` | trimmed; blank ⇒ null. Also the fallback for an unknown/misspelled `type` (silent!). | | `secret` | `String` | stored **encrypted** `ENC(...)`. Per-site: absent from `PluginSettings.site()`, read in clear only with `PluginSettings.secret(site, key)`. App-level: the property map carries the ciphertext. | | `text` | `String` | **verbatim** — NOT trimmed, blank NOT nulled (whitespace significant). The only such type. | | `int` | `Long` | `range: "min..max"` / `"min.."` / `"..max"` enforced by the form. Read with `SettingsView.integer(key, fallback, min, max)` to clamp a hand-edited value too. | | `decimal` | `BigDecimal` | **`range` is IGNORED** for decimal. Non-numeric ⇒ form error. | | `boolean` | `Boolean` | truthy iff value ∈ {`true`,`on`,`yes`,`1`} (case-insensitive). | | `enum` | `String` | `range: "a,b,c"` or `"a|b|c"`; value must be a member. | | `list` | `List` | split on comma **or** newline; trimmed; empties dropped. | --- ## 5. The mainClass @Configuration Register **every** bean **explicitly** with `@Bean` — no `@ComponentScan` of your own package. The kernel's services (§7) arrive as `@Bean` method parameters: ```java package com.acme.myplugin; // OUTSIDE mx.quest.runway @Configuration(proxyBeanMethods = false) public class MyPluginConfig { @Bean @ConfigurationProperties("runway.plugin.myplugin") // app-level settings (not @EnableConfigurationProperties) public MyAppProps myPluginAppProps() { return new MyAppProps(); } @Bean public MyWidget myPluginWidget(PluginSettings settings, Messages messages) { // plugin-scoped + kernel singleton return new MyWidget(settings, messages); } @Bean public MyEndpoints myPluginEndpoints(AccessCheck access, PluginSiteFiles files) { return new MyEndpoints(access, files); } } ``` The kernel checks these rules **before and after refresh**. Before refresh a violation **blocks** the plugin (`plugin '' is blocked: breaks the plugin rules for Runway's shared Spring context (SPI 1.0): bean name '…' does not start with '' …`); one that only shows after refresh (a bean the pre-check cannot see) **quarantines** it (§1) with the same reason: - **Bean names start with your id in lowerCamelCase** (`my-plugin` → `myPlugin…`). Plugins share one bean namespace with the kernel and each other. The host registers `mainClass` itself as `plugin:`. Use the method name as the bean name. `@EnableConfigurationProperties(X.class)` names its bean `-` and breaks the rule — declare the properties bean with `@Bean @ConfigurationProperties(...)` instead. Templates follow the names (`${@myPluginAdminModel…}`). - **Allowed Spring surface:** SPI implementations and plain beans; `@Controller`s whose every mapping lies under `/__admin/` or `/__app/`; `@ControllerAdvice` restricted to your own packages, types or annotations. **Not allowed:** servlet `Filter`s / `FilterRegistrationBean`s (§6.6), `SecurityFilterChain`s, `BeanPostProcessor`s / `BeanFactoryPostProcessor`s, an unrestricted `@ControllerAdvice`. - **No host linkage.** At startup the kernel reads the constant pool of every class in your jars and **blocks** the plugin, before wiring, for any reference to an `mx.quest.runway` class outside `mx.quest.runway.spi` or a class of yours under `mx.quest.runway` (`plugin '' linkage scan: uses Runway's internal classes, which the plugin contract (SPI 1.0) does not allow (links N kernel classes: …)`), and for a reference to an **SPI type this kernel does not have** (`… needs SPI types this Runway does not have: …`) — then `plugin '' is blocked: …`. - **Collected contributions are plain `@Bean`s — never `@Primary`.** `@Primary` is only for the singleton kernel seams the essential `protection` plugin arms. Return the **concrete** class from a `@Bean` method, so Spring sees every interface it implements before creating it (a class that is both a `ContentSource` and a `SiteEventListener` is collected as both). --- ## 6. The extension axes All live in `mx.quest.runway.spi`; their immutable model records in `mx.quest.runway.spi.model`. Each has a **`String key()`** that must be **unique and namespaced** (`"myplugin/thing"`): a blank or colliding plugin key is **refused** (logged as an ERROR naming both sides, the plugin marked degraded; its other contributions load). Each has a `default Capabilities capabilities()` — lowercase-dotted flags the host may branch on. Implementations are **functions of their immutable inputs plus the services they were given**: thread-safe, no request objects, return plain values. **Containment.** A `RuntimeException`/`LinkageError` from your code on a request path is caught, logged (the first time with the stack, then at most once a minute) and counted on the plugins screen: a head or widget failure yields empty output and the page is served `no-store`; a quality check yields one `WARNING` `check.failed`; an endpoint answers `500` `no-store`; a listener or lifecycle callback is skipped. `BackupParticipant.export` is **not** contained: its failure fails the backup. ### 6.1 `HeadContributor` — edge `` injection ```java String key(); String render(HeadContext ctx); // "" (never null) for nothing default List headInputs(String siteId) // site-relative files you read: "plugins/.yml" ``` Collected (`@Order`-honored), spliced before `` on every rendered page — no tenant template edit. Order after the kernel's own (SEO `@Order(100)`, icons `@Order(90)`) with e.g. `@Order(200)`. You own HTML escaping. Head markup is spliced *after* the page `ETag` is computed: list the per-site files you read in `headInputs` so a change to them moves the validator. Emit plain `