Introducing a new way to review your PRs.

Read the announcement

frappe / builder

Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly

View on GitHub

20 documents · Updated Nov 23, 2026

docs / plugin-extensibility

Plugin extensibility

Builder plugins extend the visual editor with trusted Vue code. A plugin is installed for the site, loaded into the editor used by each person, and allowed to add editor surfaces, page actions, block tools, and settings. The plugin model joins a small package contract with a stable SDK, site-level installation records, user-level state, and controlled Hub updates. See Visual builder workspace for the editor around this model, Builder content documents for the page data that plugins can affect, and Server API and events for the wider request and event model.

Plugin model

Plugin identity and trust

The plugin identity is a lower-case publisher/name value. Builder treats the plugin as trusted editor code rather than as isolated code, so it runs with the permissions of the user who opens the editor; the manifest has no permission grant that limits this access. Only System Managers and Website Managers can install, enable, disable, update, or remove a site plugin.

The same identity has one site installation at a time. An installation records its source, release version, enabled state, entry URL, and install status. A page reader can receive the safe installation summary needed to load the editor without reading the protected installation record.

References: frontend/…/README.md• L3-12 frontend/…/README.md• L82-96 builder/…/access.py• L4-14 builder/…/access.py• L22-55 builder/…/builder_plugin.json• L22-60

Plugin manifest

The manifest is the package's public identity and load contract. It names the plugin, describes it for the Plugins panel, declares its version, and points Builder to the fixed main.js entry. The protocol version lets Builder and the publishing service reject releases that use a newer contract.

The allowed manifest shape is intentionally small:

FieldPurpose
vPlugin protocol version.
nameLower-case publisher/name identity.
labelHuman-facing name.
descriptionShort plain-text summary.
versionSemantic release version.
entryFixed main.js entry module.
iconOptional root SVG used by the editor.

The manifest does not declare permissions. Its protocol and text rules are shared by the SDK and the server package checks, so an invalid or unknown field fails before the package becomes an installation.

References: frontend/…/manifest.js• L6-18 frontend/…/manifest.js• L45-66 frontend/…/README.md• L82-96 builder/…/package.py• L168-205 builder/…/constants.py• L10-35

SDK tooling

The SDK gives plugin authors a project template, the Vite integration for builds and development serving, the public Builder types, and the commands used to create and package a plugin. It has no runtime copy of Builder: the editor supplies the builder, Vue, Pinia, and Frappe UI modules when it loads the plugin.

The normal authoring path is:

  1. Create a project with builder-plugin create.
  2. Run the Vite development server against a Builder site.
  3. Load the development URL from the Plugins panel in developer mode.
  4. Build and run builder-plugin package for a release package.

The package command checks the built output, writes a .builderplugin release, and prints its SHA-256. A tagged release can use the supplied GitHub workflow to publish that package for Builder Hub.

References: frontend/…/README.md• L3-20 frontend/…/README.md• L98-116 frontend/…/builder-plugin.js• L6-23 frontend/…/package.json• L12-31

Editor integration

Runtime loading

The editor loads enabled, ready installations before its first render. It imports each entry as a Vue plugin and calls its install(app, context) function once. A failed import or install is reported and skipped, so one broken plugin does not prevent the editor from starting.

The entry URL includes the package checksum. A new package therefore has a new URL while the current release can continue to run. Builder tracks running plugins, their entry URLs, and registered items during the session because a Vue plugin cannot be fully removed from a running app. A replacement can remove the old registered items and install the new version, but the old module remains in memory until reload.

The loading flow connects the site installation list to the editor runtime:

flowchart LR
    A[Site installation list] --> B{Enabled and ready?}
    B -- No --> C[Show in Plugins panel]
    B -- Yes --> D[Import main.js]
    D --> E[Call install with plugin context]
    E --> F[Register editor items]
    D -. failure .-> G[Report and skip plugin]

References: frontend/…/plugins.ts• L66-115 frontend/…/loader.ts• L6-18 frontend/…/loader.ts• L22-70 frontend/…/loader.ts• L73-99

Plugin context

Builder passes a context that connects the plugin to its installation. It includes the plugin identity and version, a state store for the current user, and an open handler for the plugin details view. The open handler lets a plugin direct the user to its own editor surface.

The public builder module is the compatibility boundary. It exposes registries for editor surfaces, selected blocks and block-tree access, page and canvas stores, block insertion and drag helpers, icons, and property controls. Imports from builder/internal/* can reach editor modules but have no stability promise and can break when Builder changes.

References: frontend/…/context.ts• L4-35 frontend/…/context.ts• L52-61 frontend/…/builder.ts• L1-29 frontend/…/builder.d.ts• L88-156 frontend/…/builder.d.ts• L159-168

Authoring surfaces

Plugins join the same registries that power Builder's own editor surfaces. They can add left-panel tabs, toolbar items, block context-menu actions, property sections, and settings items. They can also insert blocks or start a block drag, which connects plugin actions to the page tree and the normal editor undo flow.

Each registered item has a stable name. A plugin can place an item before or after another item and can provide a condition for live visibility. Builder records which plugin owns each registration, so a new release can remove the old items before it adds the new set.

References: frontend/…/builder.ts• L8-28 frontend/…/createRegistry.ts• L21-39 frontend/…/createRegistry.ts• L41-72 frontend/…/createRegistry.ts• L102-121 frontend/…/blocks.ts• L6-25 frontend/…/README.md• L22-63

Development loading

Development plugins use a Vite-served entry instead of a packaged site file. The site creates a temporary Development installation only in developer mode, and the editor reads the entry from the authoring server. Builder prevents an enabled packaged copy and a development copy with the same identity from running together.

Development loading is session-oriented. The browser keeps the development plugin until the editor reloads, and its state uses browser storage rather than the site's user state. This keeps author experiments separate from persisted site data.

References: frontend/…/README.md• L98-105 builder/…/development.py• L4-9 builder/…/development.py• L22-54 frontend/…/context.ts• L37-49 frontend/…/plugins.ts• L125-139

Plugin quality checks

Bob's load path can inspect a plugin after it enters the editor. It records registrations and test-renders plugin components in the editor's theme. The checks help identify load errors, empty icons, native controls, fixed colors, and unreadable text without changing the package contract.

These checks improve the authoring experience rather than grant runtime safety. The plugin still runs with the editor user's access, and package validation plus server permissions remain the controls for what the site accepts and who can manage it.

References: frontend/…/tryPlugin.ts• L67-119 frontend/…/tryPlugin.ts• L121-159 frontend/…/tryPlugin.ts• L213-257 builder/…/test_plugin_syntax_check.py• L12-20

Package lifecycle

Package validation

Builder validates the exact package bytes before it writes a release to the site. A .builderplugin is a ZIP with manifest.json, main.js, an optional root icon, and build files under chunks/ or assets/. The checks cover identity, protocol, file types, safe relative paths, size limits, duplicate names, and safe SVG content.

The server repeats the checks used by the publishing service. This means a Hub response is still treated as an input to verify, not as proof that the downloaded bytes are safe. Packages that request a permissions field are rejected because this trusted runtime does not provide a sandboxed plugin model.

References: builder/…/package.py• L4-15 builder/…/package.py• L70-84 builder/…/package.py• L94-156 builder/…/package.py• L168-205 builder/…/package.py• L229-271 builder/…/constants.py• L17-19 builder/…/constants.py• L56-64

Installation sources

An installation describes where the editor's entry came from. Hub releases are downloaded and checked by a background job. App plugins are supplied by a Frappe app. Development plugins point at an authoring server. Bob can load a release during an assisted editing session.

The Plugins panel and the editor use one installation list. The panel keeps disabled and failed records visible so a manager can recover them, while the editor turns only enabled, ready records with a usable entry URL into runnable plugins. A site-wide disable stops the plugin for every user on the next editor load.

References: frontend/…/plugins.ts• L32-63 frontend/…/plugins.ts• L66-115 builder/…/builder_plugin.json• L34-60 builder/…/installations.py• L4-12 builder/…/installations.py• L30-62 builder/…/installations.py• L107-127

Installation jobs

Hub installation is asynchronous. Builder first creates an Installing record, then a worker downloads and validates the selected release. The record becomes Ready or Failed, and the editor receives a realtime event that refreshes the list and loads a successful plugin.

The installation stores each release under a checksum-based folder. The active entry URL therefore remains tied to the exact package, while a small number of previous releases can remain available for an editor that still has old chunks in memory. Removing an installation also removes its package files and all plugin-owned user state, but it does not remove documents that the plugin created elsewhere.

References: frontend/…/plugins.ts• L294-302 frontend/…/plugins.ts• L327-346 builder/…/builder_plugin.py• L78-105 builder/…/builder_plugin.py• L125-163 builder/…/builder_plugin.py• L165-170

Release updates

Only a ready Hub installation can update from Hub. Builder checks for a newer published version, starts a background job, downloads the release, validates it, and applies it as a new checksum-based release. The installed version keeps running until the job succeeds.

An update failure keeps the current release and reports the error. A successful update changes what the next editor load imports. If the current editor replaces a running plugin, its registered items are swapped while the old module remains in memory; a reload is needed for a clean module state.

References: frontend/…/plugins.ts• L304-323 frontend/…/plugins.ts• L334-346 builder/…/updates.py• L4-8 builder/…/updates.py• L34-69 builder/…/updates.py• L73-105

Persisted plugin state

User state

Plugin state is a small JSON store owned by one plugin installation and one signed-in user. The plugin reads it through context.state, can merge top-level values with set, and can remove one key with unset. The server derives the user from the session, so a plugin cannot choose another user's state.

The state follows the user between browsers instead of being shared through browser storage. The store has a size limit, and concurrent first writes are handled so separate parts of a plugin do not silently erase each other's keys. Disabling or uninstalling the plugin blocks or removes access to this state as part of the installation lifecycle.

References: frontend/…/context.ts• L4-9 frontend/…/context.ts• L29-35 builder/…/state.py• L4-17 builder/…/state.py• L30-80 builder/…/state.py• L83-126 builder/…/builder_plugin_state.json• L12-40

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the protocol version and manifest rules aligned between frontend/…/manifest.js, builder/…/constants.py, and builder/…/package.py.
  • Keep the public exports in frontend/…/builder.ts aligned with frontend/…/builder.d.ts; a mismatch can let a plugin build but fail when the editor loads it.
  • Keep installation fields and the Installation client shape aligned so disabled, pending, failed, and development rows do not become runnable by mistake.
  • Keep checksum-based entry URLs and release cleanup compatible with update, live replacement, and reload behavior; removing the last prior release can break an editor that still requests old chunks.
  • Keep plugin state access tied to the installation identity and session user when changing the state API or the Builder Plugin State uniqueness rule.
  • Keep install and update realtime event names aligned with the long-lived client listeners.

Important failure modes

TriggerConsequenceGuard
Manifest protocol is newer than Builder's protocolThe release is rejected before download or package write.Shared protocol version and package validation.
Package entry or path is missing or unsafeBuilder refuses the package instead of serving its files.ZIP path, file-set, size, and entry checks.
Plugin import or install throwsThat plugin does not load, but the editor can still start.Per-plugin import and install error handling.
A running plugin is replaced or unloadedIts old module stays in memory even after its registered items change.Registration tracking and reload for clean module state.
Hub download or validation fails during an updateThe current release stays active and the panel reports the error.Background update transaction and failure event.
Plugin state request uses a disabled or unknown installationThe request is refused.Session user, Builder access, and enabled-installation checks.

Key files

FileWhy to read it
frontend/…/README.mdEnd-to-end author view of creation, runtime APIs, development, and packaging.
frontend/…/builder.tsPublic API boundary exposed to plugin code.
frontend/…/loader.tsStartup, live loading, replacement, and unload behavior.
frontend/…/context.tsRuntime context and state interface.
frontend/…/plugins.tsClient view of installations, Hub catalog, install jobs, and updates.
builder/…/package.pyServer-side package and manifest acceptance boundary.
builder/…/installations.pySite installation list and manager actions.
builder/…/updates.pyHub release discovery and update lifecycle.
builder/…/state.pyUser-scoped persisted state contract.
builder/…/builder_plugin.pySite record, release files, entry URLs, and cleanup.
builder/…/builder_plugin_state.pyOne-state-row-per-user-and-installation rule.