LastDB is in alpha. It runs as one local daemon. Your apps send HTTP requests to it over a Unix socket. Build your app for one person first: steps 1 to 7. Then let people share a database (step 8) and publish the app (step 9).
Install first if you do not have a node yet. The install by hand and the node checks are in the Docs.
Steps 1 to 7 are an app for one person. No account and no network.
LastDB is a key-value database. You find a record by its key. There is no read that returns everything, except the key listing in step 5.
lastdbd. It holds the data on this machine.~/.lastdb/data/folddb.sock. Your requests go to this file. The name is the real file name; it is not a product name.hash, the first part of the key. A schema can also use a range, the second part. This guide uses a hash only.Run these two requests. Both use the socket.
curl -s --unix-socket ~/.lastdb/data/folddb.sock http://localhost/health curl -s --unix-socket ~/.lastdb/data/folddb.sock http://localhost/api/status
/health returns {"status":"ok", ...} with the API version and the node instance id. /api/status returns a summary of the running node.
A schema must exist before you write to it. This example declares a note. Each note has an id, a tag, and a body. The id is the primary key. The tag is an alternate key, so you can find notes by tag.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \
-X POST http://localhost/api/schemas/declare \
-H "Content-Type: application/json" \
-d '{
"namespace": "notes",
"schema": {
"name": "note",
"schema_type": "Hash",
"record_keys": {
"primary": { "kind": "hash" },
"alternates": { "by_tag": { "kind": "hash" } }
},
"fields": ["id", "tag", "body"],
"field_types": { "id": "String", "tag": "String", "body": "String" }
}
}'namespace is your app name. It cannot contain a slash. The schema becomes notes/note. Use that name in the next steps.
Declaring the same shape again is safe. The reply shows resolution as reuse when the schema already exists, and register when it is new. Changing a field or a key of an installed schema is refused. Declare a new schema name instead.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \
-X POST http://localhost/api/mutation \
-H "Content-Type: application/json" \
-d '{
"type": "mutation",
"schema": "notes/note",
"record": { "id": "n1", "tag": "work", "body": "Ship the page" },
"key_value": { "hash": "n1", "range": null },
"alternates": { "by_tag": { "hash": "work", "range": null } },
"mutation_type": "create",
"expected": { "type": "absent" }
}'key_value is the primary key. alternates gives one value for each named alternate key. Every field in record must be declared in step 3. expected set to absent means the key must not exist yet. The reply has ok: true and success: true.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \
-X POST http://localhost/api/query \
-H "Content-Type: application/json" \
-d '{"schema_name":"notes/note","filter":{"HashKey":"n1"}}'HashKey selects one record by its primary hash. The reply has ok: true and a results list. Each result has a key and its fields. A schema with a range uses HashRangeKey with both hash and range.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \
-X POST http://localhost/api/query \
-H "Content-Type: application/json" \
-d '{"schema_name":"notes/note","filter":{"HashKey":"work"},"key_name":"by_tag"}'Add key_name to read by an alternate key. The HashKey value is the alternate key value, here the tag.
This is the one whole-schema read. It lists every key of the schema. It returns one page at a time, and it does not return the field values. Use it to find keys, then read each record by key in step 4.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \ "http://localhost/api/list?schema=notes/note&limit=2"
limit sets the page size. The default is 100. The maximum is 1000. The reply has list.keys, list.has_more, and list.next_cursor.
curl -s --unix-socket ~/.lastdb/data/folddb.sock \ "http://localhost/api/list?schema=notes/note&limit=2&cursor=CURSOR"
Replace CURSOR with the next_cursor value from the last reply, percent-encoded. Stop when has_more is false. Add &hash=n1 to list only the keys under one hash.
The lastdb command runs the same reads. Add --json for the raw reply.
lastdb status lastdb get notes/note --key-hash n1 lastdb get-keys notes/note --limit 2 lastdb get-keys notes/note --key-hash work --key-name by_tag
get reads one record by key. get-keys lists keys, as step 5 does. --key-name needs --key-hash. Writes go through the socket request in step 4.
A failed request returns a 4xx or 5xx status. A 400 from this socket returns a JSON body that names the problem. This example comes from a read with no key:
{
"ok": false,
"kind": "full_schema_scan_not_allowed",
"error": "product apps are keyed-access only; unfiltered schema queries are not supported",
"message": "full_schema_scan_not_allowed: unfiltered query on product schema 'note' is not supported; add a keyed filter using the structured remediation",
"schema_name": "note",
"schema_id": "notes/note",
"remediation": { "action": "add_key_filter", "request_key": "filter", "...": "trimmed" }
}kind is the error code. Fix the request and send it again. A malformed mutation or query body returns kind, error, and sometimes key and try, with a corrected example.
An app has no server, so there is nothing to deploy. A release is a signed entry in the App Registry.
lastdb app publish --manifest manifest.json lastdb app install your-app
The manifest names the app, its schemas, and the commit to install. Each person installs the app by name, and it runs on their own Mac.
Publishing needs a paid Exemem subscription. Exemem is the cloud service that LastDB uses for backup and sharing. People who use a published app pay nothing to use it. Building and running an app on your own Mac needs no subscription.
The interactive guide shows the layers, their parts, and their connections.
Explore the system → Full catalog of apps → Install and node health: Docs →