A local database · alpha · open source

A local database for the tools you build.

Your app gets a database on the user’s own Mac, with optional encrypted backup and sharing. There is no backend for you to run, and you never hold the user’s data.

01 · The problem

Every app rebuilds the same backend.

An app that stores personal data usually needs a server. You run a database, you write sync, and you hold every user’s data in an account that you must protect.

The next app does all of it again. The user ends up with one copy of their life in each app, and owns none of them.

02 · How it works

Three ideas hold it together.

  1. 01

    The database runs on the user’s Mac.

    LastDB is one background service. Your app reads and writes it over a local Unix socket. Nothing in this step needs a server of yours.

  2. 02

    Your app declares what it stores.

    A schema names its fields, its primary key, and any alternate keys. Each app keeps its own records. No app owns the database.

  3. 03

    The user decides what leaves the machine.

    Backup to the cloud is optional and encrypted. Sharing a database with another person is an invitation that the user sends.

Open the interactive guide →

03 · The requests

Any language that can send HTTP over a Unix socket can use LastDB. Shown with curl.

Declare, write, read.

Declare a schema a note, found by id or 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" }
    }
  }'
Write a record
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" }
  }'
Read it by key
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"}}'

Read the developer guide →

04 · What you get

The parts an app needs, on the device.

01 · ON DEVICE

Database

Records found by key. No read walks a whole schema, so a read stays fast as the data grows.

02 · OPT-IN

Backup

Encrypted cloud backup, and recovery onto a new Mac. No name or email address.

03 · BY INVITATION

Sharing

The user invites another person to a database. The invitation is encrypted for that person.

04 · SIGNED

App Registry

A signed list of apps. The user installs an app by name, at a commit proved with their release.

Two starter apps show how it is done: Brain for notes and decisions, and LastSecrets for credentials. Coming: LastSeek, semantic search beside the database. It is not in the App Registry yet.

Install

Two steps, about five minutes.

You need Apple Silicon, Homebrew, and Bun. The installer checks for all three and stops if one is missing. Read the script first: install.sh.

1. Install LastDB and review the plan

curl -fsSL https://thelastdb.com/install.sh -o install.sh
sh install.sh

The first run installs LastDB, prints the plan for the starter apps, and stops with RESULT: CONSENT NEEDED. That stop is expected.

2. Consent to the starter apps

sh install.sh --accept-install
brain init

It ends with RESULT: PASS when the apps are current and healthy.

What it changes

  • Homebrew installs the lastdb and lastdbd commands and starts the LastDB service.
  • The App Registry clones each starter app into ~/.local/share/lastdb-apps and links its commands into ~/.local/bin.
  • The first app install adds a background job that checks the registry and upgrades the apps on the stable channel.
  • It does not edit your shell profile, and it does not install Bun.

Remove it

launchctl bootout "gui/$(id -u)/com.edgevector.lastdb-app-registry"
rm "$HOME/Library/LaunchAgents/com.edgevector.lastdb-app-registry.plist"
rm -rf "$HOME/.local/share/lastdb-apps" "$HOME/.local/state/lastdb-app-registry"
brew services stop lastdb
brew uninstall lastdb

Your data stays in ~/.lastdb. Delete that folder only if you want to lose the data. This cannot be undone.

Database only

brew install edgevector/lastdb/lastdb
brew services start lastdb
lastdb status

Add apps later with lastdb app install.

05 · Questions
Is it open source?
Yes. The database is Apache-2.0 at github.com/EdgeVector/lastdb. The starter apps are public repositories too.
What does it run on?
macOS on Apple Silicon. There is no Intel, Linux, or Windows release today.
Is it ready for production?
No. LastDB is alpha. The storage format and the socket requests can still change between releases.
Do I need an account?
Not for local use. Cloud backup connects your database without a name or an email address.
What does it cost?
The database and the apps are free. Cloud storage for backup is a paid subscription, managed with lastdb cloud payment.
What does the cloud hold?
Encrypted copies of your data, for backup and recovery. Reads and writes happen on your Mac.
Can I query it with SQL?
No. LastDB finds a record by its key. A schema declares a primary key and any named alternate keys, and every read names one of them. This keeps a read the same speed as the data grows.
Is there a desktop app?
No. LastDB is a background service with a command line. Apps bring their own interface.

Why LastDB exists →   How we build it →