Plugin Platform Overview¶
RefMD plugins combine an Extism-powered backend with a browser-based frontend. The host loads plugin manifests at runtime, exposes APIs for storage and rendering, and routes matching URLs into plugin-controlled views.
Runtime at a Glance¶
- Manifest discovery — The API aggregates manifests from global (
plugins/global/*) and per-user (plugins/<user-id>/*) directories via/api/me/plugins/manifest. - Frontend loading — The React app resolves
frontend.entryto an ESM module and imports it dynamically (seefeatures/plugins/lib/runtime.ts). - Backend execution — Plugin actions call into Extism WASM modules. Results can return
effectsthat the host applies on the server (document CRUD, records, KV) or in the client (navigate,showToast). - Routing —
mountsand optionalcanOpen/getRouteexports let plugins take over specific routes and documents.
Key Concepts¶
- Host object: When a plugin module runs, it receives a host with
exec,api,ui, andcontexthelpers. This is the primary bridge back into RefMD. - Scopes: Records and KV storage currently use the
docscope. Future revisions may add user- or workspace-level scopes. - Effects: Extism backends return JSON effects. Recognised server-side effects include
createDocument,putKv,createRecord,updateRecord,deleteRecord,navigate, andlog. Unknown effects are forwarded to the frontend module for client-side handling. - UI affordances: Plugins can inject commands into the toolbar/command palette and attach icons to documents in the file tree via the
uimanifest section.
Reference Material¶
- Manifest Specification details every field in
plugin.jsonand how the host interprets it. - Development Guide walks through building, packaging, and installing a plugin using the sample repository.
The sample-plugin repository doubles as a living example and is referenced throughout the guides below.