Run Datanotes on your notes
By the end of this page, the engine runs on your folder of notes and your agents can reach it. You’ll also have a table of the classic films you watch, with one row in it.
You need Node.js 22 or newer and a folder for your database. It can be an empty folder, or a folder of Markdown notes.
On Windows, use Node.js 24.16 or later, or 26.1 or later. Node.js 24.0 to 24.15 and 26.0 can crash at random on local connections. datanotes serve warns at start on those versions.
The package installs two commands: datanotes and its short name dnotes. Every command works under both, so dnotes status is the same as datanotes status.
-
Start the engine on your folder:
Terminal window npx -y datanotes serve --database your_database_folderThe folder is the database: the engine keeps
metastore.yamlat its root, and serves every note in it. To use an app such as Obsidian on a vault that holds the database, start with--vaultinstead. Use Datanotes with Obsidian explains it.The engine serves the HTTP API on
http://127.0.0.1:27150. It keeps its settings and your owner token insettings.json, in its store outside the folder.npx datanotes store path --database your_database_foldershows where.To browse the database, open
http://127.0.0.1:27150/datanotes/ui/and sign in with the owner token. Browse and administer the database explains the browser.To check that the engine is running and healthy, run
npx datanotes status --database your_database_folder(see Check the engine’s status). -
Install the package, which includes a client for the HTTP API:
Terminal window npm install datanotes -
Connect to the engine with your owner token.
localEnginefinds the engine that runs on your folder, and reads the token from its settings:import { DatanotesClient } from "datanotes/client";import { localEngine } from "datanotes/local";const engine = localEngine("your_database_folder");if (!engine) throw new Error("Start the engine on the folder first");const db = new DatanotesClient({ url: engine.url, token: engine.token }); -
Create a table of films with four columns. The table and each column need a
description, which tells agents and people what they hold.filenamenames each note after the film’s title.uniqueallows one note per title.orderedkeeps the statuses in order:const created = await db.call("create_table", {name: "film",description: "Classic films I watched or want to watch",filename: "{title}",columns: [{name: "title",type: "string",required: true,unique: true,description: "The film's title, as on its poster",},{name: "year",type: "integer",description: "Year the film first came out",},{name: "minutes",type: "integer",min: 1,description: "Running time in minutes",},{name: "status",type: "enum",values: ["to watch", "watched"],ordered: true,description: "Where the film is on my list",},],});if (!created.ok) throw new Error(String(created.value));The engine writes the table’s definition into
metastore.yaml, at the root of your folder. -
Add a film:
const r = await db.call("insert_row", {table: "film",values: { title: "Nosferatu", year: 1922, minutes: 94, status: "watched" },});type Planned = { planned_creates: string[] };console.log(r.ok ? (r.value as Planned).planned_creates : r.value);When the engine accepts the row,
planned_createslists the new note. When it refuses the row,r.valueexplains which value broke which rule, and the engine writes nothing. ForMetropoliswithminutes: 0and the statusseen, it answers:insert_row refused — nothing was written:invalid main/public/film/Metropolis.md: minutes must be >= 1invalid main/public/film/Metropolis.md: status must be one of: to watch; watchedThe film is now a note,
main/public/film/Nosferatu.md:---table: main.public.filmid: 01a12230-73ea-7349-83d3-efdcc7cceb61title: Nosferatuyear: 1922minutes: 94status: watched---Your
iddiffers: the engine gives every new row its own.You can edit the note by hand at any time. The engine reads your change and checks it against the table;
check_tablelists any value that breaks a rule. -
Connect your agents through the Model Context Protocol (MCP) server,
datanotes mcp: follow Connect agents.
Learn more about tables, clients and tokens
Section titled “Learn more about tables, clients and tokens”These pages explain what you used on this page:
- How it works: tables, rows and the journal
- Operations: everything the API can do
- JavaScript client and HTTP API: the two ways your code reaches the engine
- Security: what each token can do