Plugins

Accent CMS supports a WebAssembly (WASM) plugin system built on Extism. Plugins are sandboxed modules that can extend the CMS without compromising the host process. Each plugin is a compiled .wasm file paired with a plugin.toml metadata file that declares which capabilities it provides.

The Capability Surface

Plugins can provide five types of capabilities:

CapabilityDescriptionExample
HooksTransform content at lifecycle pointsSyntax highlighting, SEO injection
Media HooksAugment media discovery and processingEXIF extraction, watermarking
FiltersCustom template filters{{ value | my_filter }}
ShortcodesInline content processors[gallery]...[/gallery]
RoutesCustom HTTP endpoints/api/search, /api/contact

Plugins communicate with the host over a simple, language-agnostic JSON protocol, so they can be written in any language with an Extism PDK – Rust, Go, JavaScript, AssemblyScript, C, and more.

Enabling Plugins

Plugins are disabled by default. Enable them in config.yaml:

plugins:
  enabled: true
  directory: ./plugins    # default location

When enabled is false (the default), no plugins are loaded and no WASM runtime overhead is incurred. The plugin system is also resilient by design: a missing directory, an invalid plugin.toml, or a runtime error never prevents the server from starting or serving content.

In This Chapter

  • Structure and Metadata – the plugin directory layout and the plugin.toml file: required fields, hooks, filters, shortcodes, routes, and per-plugin configuration.
  • Communication Protocol – the JSON contract between host and plugin for every hook, filter, route handler, and media hook.
  • Writing a Plugin – a complete Rust walkthrough from project setup through build, install, and verify, plus notes on other languages.
  • Media Hooks – the on_media_discover and on_media_process hooks for enriching media metadata and transforming processed images.
  • Managing Plugins – the accent plugin CLI for listing, inspecting, installing, and removing plugins, plus hot reload and graceful error handling.
  • Security – fuel limits, compilation caching, pre-compilation, API version compatibility, and opt-in filesystem access.
  • Configuration Reference – the full config.yaml reference for the plugin system and where to go next.

In this section

  • Plugin Structure and Metadata

    How plugins are laid out on disk and how the plugin.toml file declares a plugin's name, version, and the hooks, filters, shortcodes, routes, and configuration it provides.

  • JSON Communication Protocol

    Plugins exchange JSON strings with the host. This page documents the input and output shape for every hook, filter, route handler, and media hook.

  • Writing a Plugin

    A complete walkthrough for building an Accent CMS plugin in Rust -- project setup, code, build, install, and verify -- plus how to use other languages.

  • Media Hooks

    The on_media_discover and on_media_process hooks let plugins enrich media metadata during content scanning and transform images after processing.

  • Managing Plugins

    Use the accent plugin CLI to list, inspect, install, and remove plugins, and rely on hot reload and graceful error handling during development.

  • Plugin Security

    Harden plugins in production with fuel limits, compilation caching, pre-compilation, API version checks, and opt-in sandboxed filesystem access.

  • Configuration Reference

    The full config.yaml reference for the plugin system, with every option annotated, plus pointers to related guides.