Chroma-Fs
Plugin system
How Chroma plugins are declared in chroma.json, installed by the CLI, and loaded at runtime.
Chroma apps extend the engine with plugins — optional packages vendored into plugins/<name>/ and listed in chroma.json.
Declaring plugins
{
"name": "my-app",
"mode": "dynamic",
"plugins": ["chroma-fs"],
...
}Install and scaffold
chroma install— builds Chroma-Fs from the workspace checkout (whenChroma-Fs/is present) into$CHROMA_HOME/plugins/chroma-fs. Also buildschroma-desktopfor develop mode whenChroma-Desktop/is available.chroma new— copies each plugin from$CHROMA_HOME/plugins/<name>into the new project'splugins/directory. The standard template includes Chroma-Fs by default; static/dynamic add it whenplugins: ["chroma-fs"]is set.
Runtime loader
Templates include plugins/loader.js:
export async function loadPlugins() {
const manifest = await fetch("./chroma.json", { cache: "no-store" }).then((r) => r.json());
const loaded = {};
for (const name of manifest.plugins ?? []) {
if (name === "chroma-fs") {
const { createStorage } = await import("./chroma-fs/index.js");
loaded.fs = await createStorage({ configPath: "./chroma-fs.json" });
}
}
return loaded;
}Call loadPlugins() before render() so storage is ready when components mount.
Build output
chroma build copies plugins/ and chroma-fs.json into dist/ for both static and dynamic modes, so packaged apps keep the plugin and its config at runtime.
Adding more plugins
To add a future plugin:
- Ship it under
$CHROMA_HOME/plugins/<name>viachroma install - Add
"<name>"topluginsinchroma.json - Extend
plugins/loader.jswith the import/init logic for that plugin