yamlite
v0.45.1
Published
Sync YAML files and SQLite in both directions
Maintainers
Readme
YAMLite keeps a folder of YAML files and a local SQLite database in sync, in both directions, continuously. Edit a file in your editor and the row changes. Run an UPDATE and the file changes — with your comments still in place.
Why
YAML is great for data humans write: readable, diffable, comment-friendly, git-native. It is terrible to query. SQLite is the opposite. YAMLite lets you keep both without choosing:
- Hand-written data, SQL queries — tasks, notes, contacts, configs, fixtures. Keep editing YAML; ask questions with SQL, Datasette, or any SQLite tool.
- App-written data, git history — let a script or app write to SQLite and get every change as a reviewable YAML diff.
flowchart LR
ED["✏️ your editor"] --> Y["📄 YAML files"]
Y <-->|"yamlite sync / watch"| D[("🗄️ SQLite")]
Y --> G["git diff · pull requests"]
D --> Q["SQL · Datasette · your app"]
Q --> DFeatures
- Two-way, continuous sync —
yamlite watchreacts to file saves and to commits from any process writing the database. - One schema file —
yamlite initwritesyamlite.yamlfrom your data. Commit it next to your YAML: it pins every column's type, and YAMLite keeps the database matching it. - Comment-preserving writes — only changed fields are rewritten; comments, key order and flow style (
[a, b]) survive. - Typed columns —
true→BOOLEAN,1→INTEGER,1.5→REAL, maps/lists →JSON, inferred from your data. - Safe by default — broken YAML is never overwritten or treated as deleted, mass deletions are refused, and the losing side of a conflict is always backed up.
- Rebuildable — the database is a cache. Delete it, run
sync, and it comes back from YAML. - CLI and library — use the
yamlitecommand orimport { open } from "yamlite". - No native dependencies — built on Node's built-in
node:sqlite.
Installation
Requires Node.js 24.16 or later.
npm install -g yamlite
# or
pnpm add -g yamliteOr run it without installing:
npx yamlite status ./notesQuick Start
Each entry directly under the root becomes a table:
notes/
├── tasks/ # directory → one record per file, key = path (subfolders too)
│ ├── buy-milk.yaml
│ └── write-blog.yaml
└── people.yaml # file → a list of records, key = `id`# tasks/buy-milk.yaml
title: 牛乳を買う
done: falseyamlite init notes # infer yamlite.yaml from your files
yamlite sync notes
yamlite query "select title from tasks where done = 0" notesDocumentation
Full documentation: https://yamlite.com/docs/
