Libraries
Autobase
Orders multiple writer logs so an application can build a deterministic shared view.
Verified 19 October 2026
The experimental P2P /db notes example allows two writers to edit offline and converge after reconnecting.
Status in Unstoppable Stack
The source prototype uses Autobase. Writer admission and the conflict reducer belong to the application.
How it works
Autobase orders independent writer logs and runs your reducer to produce a shared view. Your reducer determines what an operation means.
The small example uses one writer to show append → apply → view. Follow the collaborative notes guide next to run offline edits with two writers.
The P2P /db prototype uses Autobase. It is distinct from the separate experimental Autobee scaffold.
Run an example
Use Node 22.17+ and npm for installation. Start in a new directory for this example so its ./data storage cannot collide with another example. Save each file below with the exact filename shown, then run the commands in order.
mkdir autobase-demo
cd autobase-demo
npm init -y
npm install autobase@'7.28.2' corestore@'^7.13.0'Save as example.mjs:
import Autobase from 'autobase'
import Corestore from 'corestore'
const store = new Corestore('./data')
const base = new Autobase(store, null, {
valueEncoding: 'json',
open (store) { return store.get({ name: 'view', valueEncoding: 'json' }) },
async apply (nodes, view) {
for (const node of nodes) {
if (node.value !== null) await view.append(node.value)
}
},
async close (view) { await view.close() }
})
try {
await base.ready()
await base.append({ text: 'Hello ordered view' })
await base.update()
console.log((await base.view.get(base.view.length - 1)).text)
} finally {
await base.close()
await store.close()
}
Run from this example directory:
node example.mjsExpected result
Hello ordered view
Example verification
The code shown here ran successfully in a local check on 19 October 2026. This verifies the small example, not production readiness, public-network reachability or every platform.
API essentials
- new Autobase(store, key, { open, apply }): create a base or join by key and define its view.
- append(operation) and update(): write locally and process available operations. Read the derived result from base.view.
- close(): close the base before its store. Multi-writer applications also need explicit admission rules and indexer availability.
Troubleshooting and limits
- Keep apply deterministic: no random values, current timestamps or external service calls inside the reducer.
- An append or locally updated view does not prove every peer has received or durably indexed it.
- Pairing and database write authority are different permissions; the /db prototype manages membership separately.