The database of your node
Every element keeps its tables here, each in its own database file opened by its own key. The deploy journal and the log of agent conversations live here too, on your own computer.
OpenSource Web4 agent & app starter kitHow a row goes
An element sends a row
It reads and writes its tables through /db with its own key, which the installer put into its environment.
Its own file keeps it
The element's tables sit in their own database file, data/elements/<id>.db, next to the node's file.
The node sees every file
The core, the native elements and the main agent open any element's file with the node's data key.
The journals stay beside it
Every deploy leaves a record, and the agents keep their conversations here, the last 10 000 of them.
Through the Cloudflare tunnel every door answers 404, with a key or without.
Always on
The node never turns this element off: the other elements depend on it. It starts with the node and does not sleep, even when memory is short.
What changes for you
| Without it | With the database element |
|---|---|
| Every element would keep its data its own way | Every element keeps its tables behind one door |
| Two elements could write into one table by accident | Each element has its own database file, and a neighbour's table does not exist for it |
| A failed deploy leaves no trace | Every deploy leaves a record: when it ran, how long it took, how it ended |
| Your data sits on someone else's server | It stays on your computer, inside your node |
Whose table it is
The main agent of the node
Opens every element's database file and sees whose each table is.
Mom's element
Only its own: her tables and her rows.
Son's element
Only its own: his lessons and his answers.
Your site
Only its own: the tables of its pages.
Each element opens the database with its own key, and a neighbour's table does not exist for it.
A call with an element's key works on that element's file. SQL that reaches for another file, such as ATTACH, is refused.
The node's data key works on the node's own file, and on any element's file when the call names it with ?space=<element>. Tables an element wrote into the node's file before it had its own are copied over by the architect's word (/db/claim).
The database keeps the doors apart, not the disk: every file lies in this element's folder on your computer, and all elements run as one user of it.
Connect your element
Every element of the node already has the database address and its own key. Read ten rows of a table:
const r = await fetch(`${process.env.REMOTE_DATA_URL}/db/tables/notes?limit=10`, {
headers: { 'X-Element-Key': process.env.ELEMENT_KEY },
})
const { columns, rows, total } = await r.json()A table is declared by the element that owns it, once, at its start: CREATE TABLE IF NOT EXISTS through POST /db/migrate. A call returns at most 1000 rows, and columns such as password never leave the database.
Under the hood
Part
What it does
- SQLite
- One file for each element and one for the node, in this element's folder, never in git
- /db/tables
- Rows: read with search, limit and offset, insert one, edit one by its id
- /db/migrate
- The schema and any SQL, with a key only, never from a browser session
- /deploy-runs
- The deploy journal of every element of the node
- /a2a-log
- The agents' conversations, the last 10 000, fields named like secrets stripped
- /media, /vectors
- Passed on to the storage and vectors elements, the answers unchanged
Your own builder comes with it
Every element of the node comes with its own Claude Code agent and can get its own Telegram bot. When something in this element should change, write to its bot from your phone, and the agent updates the logic or the design.
The agent works only in its element's folder and never reads the whole node, so each change costs fewer tokens. Your Claude Code subscription pays for it.
- The element's bot is connected in the core, on its «Telegram» page.
- The agent returns a commit; you look at it in «Preview» and accept it or turn it down.
- At the computer, the agent's terminal is in the core, in this element's «Build».
Open source
Built by Fractera for the Lagrix protocol and for any web2 project that needs a database. MIT license, the code is at github.com/Fractera/fractera-data-starter.
Questions and answers
- Do I need a database schema?
- Each table needs one, but the node has no shared schema file. The element that owns a table declares it itself: at its start it sends CREATE TABLE IF NOT EXISTS to POST /db/migrate, and the database creates what is not there yet.
- Who writes that declaration?
- The element's agent, together with the code that uses the table. You describe what to keep in words; the agent turns it into the table and its start-up migration.
- Can one element read another's tables?
- No. A call with an element's own key works only with that element's file; SQL that reaches for another file, ATTACH for one, is refused. The core and the native elements open any file with the node's data key.
- How many rows does a call return?
- At most 1000, and columns such as password never leave the database.
- Can I keep backups?
- Yes. The element is ready for its programmer agent to set up backups on a schedule or by hand: tell the element's agent in Telegram or in the terminal. It makes no copies on its own until you ask.