CRUD over markdown
Create, read, update, delete .md notes with flat YAML frontmatter. Nested blocks written by other tools are read and indexed.
How the vault works
A headless data layer for Bun apps that read and write .md notes — CRUD, collection queries, backlinks and full-text search over files you still own. No Obsidian, no Electron, no daemon.
bun add vaultmdRequires Bun ≥ 1.3.14 — VaultMD uses bun:sqlite and other Bun built-ins, so it does not run under Node.
import { createVault } from 'vaultmd';
const vault = await createVault({
root: '/path/to/vault',
// Read everything, but only write under Notes/.
prefixes: { read: [''], write: ['Notes/'] },
// Keep the index db outside the synced vault.
indexPath: './data/vault-index.db',
});
await vault.notes.createNote('Notes/ideas/first.md', {
frontmatter: { tags: ['idea'] },
body: '# First\n\nLinking to [[Notes/ideas/second]].',
});
const hits = vault.query.queryNotes({ tag: 'idea' });
console.log(hits.map((h) => h.path)); // ['Notes/ideas/first.md']
vault.close();The .md file on disk is the source of truth. The SQLite index is derived from it: delete the database and it rebuilds, and edits made outside the process are picked up by a background reconcile sweep.
createVault.