Plugins / Extend the pipeline

Hook the build. Never fork it.

Plugins attach to Flame's build pipeline and dev server through hooks. Register them in docu.json as an npm package, a factory with options, or a local file. Nine hooks, run in order, on Bun, Node and Deno.

How it works / Four steps

From docu.json to npm.

A plugin is a name and a setup function. Configure it, write it, pick the hooks it needs, then keep it local or publish it.

  1. 01 / Configure

    Register in docu.json

    Add a plugins array: an npm package, a factory with options, or a local file in plugins/.

  2. 02 / Setup

    Write a setup function

    A plugin is a name and a setup(build) call. Register only the hooks you need.

  3. 03 / Hook

    Hook the pipeline

    onStart, transformFrontmatter, injectHead, transformHtml, onEnd. They run in docu.json order.

  4. 04 / Ship

    Share or keep local

    Keep it in your project or publish to npm. Hooks run on Bun, Node and Deno.

Official plugins / Ready to install

One line in docu.json. One feature shipped.

Built on the same hooks
@docubook/plugin-og-imagev0.1.2

Social cards, rendered at build.

Every page gets a 1200×630 OpenGraph image built from its frontmatter. Takumi renders it natively, no browser involved.

FRONTMATTER → LAYOUTtitle · description · logo · colours
RENDERED WITH TAKUMI
DocuBook
Getting startedConfigurationEvery option in docu.json, in one place.
docs.docubook.pro
1200 × 630 · PNG · A FEW MILLISECONDS
  • No browser
  • Hashed file names
  • Only changed cards
@docubook/plugin-search-algoliav0.1.3

DocSearch, plus Ask AI.

Algolia DocSearch v5 behind Flame's own search bar and ⌘ K. Full-text results in the dialog, Ask AI in its own panel beside the document.

nginxESC

FULL-TEXT · 3 HITS12 MS
Deploy to nginx on a subpathDeployment / nginx
Generated nginx rulesGetting started / Base path
Your call: nginx or NetlifyPages / Overview
ASK AI⌘ I

How do I serve the docs under /docs with nginx?

Set basePath in docu.json and run flame build. Flame writes nginx rules that follow the prefix, so links, canonical URLs and search records stay in sync. ▍

SOURCES · deployment.mdx · base-path.mdx
  • ⌘ K search
  • ⌘ I Ask AI
  • Search-only key
Build your own / Twelve lines

Your first plugin
fits on one screen.

Export a name and a setup function. Pick a hook, return your result, and point docu.json at the file. Errors in setup stop both build and dev, so a broken plugin never ships.

@docubook/plugin-* or docubook-plugin-*
plugins/last-updated.ts
import type { DocuBookPlugin } from "@docubook/flame";

const plugin: DocuBookPlugin = {
const plugin: DocuBookPlugin
  name: "last-updated",
  setup(build) {
    build.transformFrontmatter((fm) => ({
      ...fm,
      updated: new Date().toISOString(),
    }));
  },
};

export default plugin;

docu.json → "plugins": ["./plugins/last-updated"]