Chroma-Fs
Chroma-Fs
Configuration-driven storage for Chroma apps — IndexedDB in the browser, filesystem on desktop via Chroma Desktop.
Chroma-Fs (@chroma/fs) is a sibling JavaScript library in the Chroma ecosystem. It gives apps a single storage API that automatically picks the right backend:
- Static apps (browser) → IndexedDB by default
- Dynamic apps in Chroma Desktop → real filesystem under per-app data directories
- Dynamic apps in a plain browser → IndexedDB unless you force
filesystemin config (which requires a Tauri host)
Chroma-Fs is not a Chroma engine plugin. Apps import it as an npm package and configure it with chroma-fs.json.
Quick start
# Recommended: standard template with Chroma-Fs demo
chroma new my-app --template standard
cd my-app && chroma dev
# Or add storage to an existing app
chroma fs init # creates chroma-fs.json with template defaults
chroma fs link # links @chroma/fs from the workspace (monorepo dev)import { createChromaFs } from "@chroma/fs";
const fs = await createChromaFs({ configPath: "./chroma-fs.json" });
await fs.writeFile("notes/todo.txt", "Buy milk");
const text = await fs.readText("notes/todo.txt");Where data lives
| Context | Backend | Location |
|---|---|---|
| Static template / browser | IndexedDB | Browser profile (chroma-fs database) |
| Dynamic + Chroma Desktop | Filesystem | <app-data>/apps/<app-id>/data/ |
chroma dev (develop mode) | Filesystem | <app-data>/apps/develop/data/ |
On desktop, apps run inside an iframe without direct Tauri access. Chroma Desktop bridges filesystem calls via postMessage — see Backends.
Related
- Templates —
standardtemplate with file explorer demo - CLI —
chroma fs init,chroma fs link, dynamic develop mode - Desktop — iframe hosting and develop mode
- Configuration —
chroma-fs.jsonschema - API — full method reference