← Journal

Building VectorPlace: A Multiplayer Canvas With No Central Database

Most local-first demos are two-person todo lists. To actually stress-test LastDB’s grants-only sharing and App Registry, we wanted something where you immediately feel other users in the same space — fun enough to click around in ten seconds, useful enough for real engineering work, and far simpler than rebuilding Git.

We built VectorPlace: a multiplayer vector architecture canvas, sticky-note review board, and stamp mural where every participant runs against their own local LastDB replica. There is no central Postgres, no WebSocket room server, no central search cluster, and no backend ACL service. Four completely independent lastdbd nodes sync through a blind encrypted relay while every pan, zoom, search, export, and replay runs locally on disk.

This post is what worked, what surprised us, what broke along the way, and what is still unproven.

WRITER NODE role: write direct signed stream works with owner offline 506 ms to reader CONTRIBUTOR role: submit sealed proposal Layer 2: own records only 1.3–2.3 s via owner BLIND RELAY encrypted logs only no query engine no canvas logic OWNER NODE role: owner direct write + grants settles submit inbox publishes snapshots READER NODE role: read local replica on disk 0.4 ms offline search local mute + replay signed write sealed proposal inbox published all streams Each VectorPlace UI talks only to its own local lastdbd over apps.sock — the four web servers never talk to each other.
Fig. 1 — Four independent nodes sharing one VectorPlace database. Each UI connects only to its own local apps.sock; the relay routes encrypted logs and never parses canvas state.

Start with a skeptical design spike

Before writing UI code, we checked the idea against LastDB’s real storage and sharing invariants instead of assuming a generic cloud backend. Four constraints shaped the whole architecture from hour one:

  • No log-history replay API. LastDB keeps current values only; applied log entries are discarded locally and trimmed on the relay after routine snapshots. An early assumption that we would get “free edit-history time-lapse from the mutation log” did not survive contact with the code. Ordering append-mostly records by created_ms still gives us a clean local creation-order replay without touching historical logs.
  • Snapshot trims punish tiny high-frequency writes. Routine owner snapshots fire every 25,000 entries and trim covered relay entries immediately; a laptop returning from sleep catches up by soft-restarting its daemon to install the snapshot. Streaming mouse coordinates or per-pixel edits would thrash users’ nodes. Committing coarse-grained objects — one simplified Bézier sketch, stamp, service card, sticky note, or Mermaid batch per record — keeps log volume 20× to 50× lower.
  • One mutation per submit proposal. Direct writers can send multi-mutation atomic batches, while a submit proposal carries one mutation at a time. That directly guided how cross-tile drags and batch Mermaid imports work for each role.
  • No immediate revoke on write grants. Direct writers hold whole-record last-writer-wins until their grant end passes. Rather than inventing central moderation, every client stores muted created_by keys locally in LASTDB_APP_DATA — hiding spam instantly without mutating the shared database.

One HashRange schema for an infinite canvas

The entire canvas lives in a single schema, vectorplace/Element, declared in lastdb-app.json with zero schema advisor warnings:

primary key: HashRange
  hash  = "t:<col>:<row>"              // 1024 × 1024 spatial tile
  range = "<14-digit-created_ms>#<id>" // chronological z-order per tile

Every element carries its bounding box, a kind (sketch, stamp, diagram, text, sticky, card, or frame), and a sanitized JSON array of vector primitives under 48 KiB. Nothing ever inserts raw untrusted SVG strings into the DOM; the client constructs every SVG element via createElementNS from validated primitives.

To keep structured blocks editable without breaking existing records or triggering migrations, cards, sticky notes, and frames embed a small validated meta primitive alongside their rendered geometry. That let us evolve from playful neon stamps into double-click-editable architecture blocks with zero schema changes.

Incremental updates run over POST /v1/x/changes (which works identically on owned and received databases), passing refresh: true while a browser tab is active so the local daemon pulls fresh relay turns promptly, then batch-reading changed keys in chunks of 64.

The biggest surprise: Protected Diagrams + Open Review

Going in, the split between write and submit looked like friction we would have to explain away. Once we added Service Cards, Sticky Notes, and drag-to-move, it turned out to be a cleaner collaboration primitive than hosted whiteboards offer out of the box.

HASH KEY: t:0:0 (1024 × 1024 WORLD UNITS) ExeMem Relay kind: card · created_by: owner range: 017964…#card-1 RFC Review Sticky kind: sticky · created_by: contributor Contributor drags owner card 403 not_record_creator UI snaps card back intact Contributor edits own sticky 202 pending → owner settles propagates to all readers One schema (vectorplace/Element). No custom ACL server. Record ownership comes straight from LastDB Layer 2.
Fig. 2 — Core team members (write) build and rearrange the architecture diagram. Reviewers (submit) drop and edit their own signed sticky notes while LastDB Layer 2 blocks accidental edits to anyone else's cards.

In a four-node local org (lastdb dev up --preset org), we measured the actual behavior across separate lastdbd daemons syncing over the loopback relay:

  • Direct write with owner stopped: writer placed a 928-byte stamp directly onto its own signed stream while owner was shut down. reader synced and rendered it in 506 ms.
  • Sealed submit proposal settlement: contributor dropped a sticky note while owner was offline; it stayed pending with a pulsing dashed outline. Starting owner settled and replicated it to reader in 1.27 s (2.29–2.35 s end-to-end from a browser click).
  • Layer 2 drag and delete protection: When contributor tried dragging or deleting an owner-created ExeMem Relay card, LastDB refused with HTTP 403 not_record_creator and the UI snapped the card right back. Dragging and editing contributor’s own yellow RFC sticky note proposed and settled cleanly.
  • Local-first search: Pressing ⌘K filtered all frames, service cards, sticky notes, authors, and tiles in 0.4 ms offline and flew the camera directly to the match.

Playfulness gets the click; scriptable utility makes it stick

Neon stamps and live sync blooms make the zero-central-DB story obvious in ten seconds, but nobody keeps a doodle toy open on Tuesday morning. Adding real diagramming tools — drag-to-move with Shift grid snapping, port-snapping arrows, named frames, ⌘K search, one-click standalone SVG export for PRs, and an in-app multi-canvas switcher — pushed it over the line from demo to usable tool.

The most interesting consequence wasn’t even a UI feature. Because VectorPlace sits directly on a local LastDB socket with a CLI, AI agents and shell scripts are first-class drawers:

# An agent lays out an editable architecture diagram onto a shared canvas
vectorplace import-mermaid architecture.mmd --frame "LastDB Sharing Architecture"

# A local script flips one service card's live status; every teammate sees it sync
vectorplace update --tile t:0:0 --range <range_key> \
  --status warn --subtitle "Direct Stream · 506ms sync"

An agent can read a repository, drop an editable Mermaid flowchart onto your team’s shared canvas, and let humans rearrange the boxes and attach signed sticky-note reviews on top — no OAuth dance, no hosted whiteboard API tokens, and no lock-in because one click copies clean SVG back out.

What shipping a real app exposed in our own stack

The developer inner loop held up well: going from lastdb dev init vectorplace through four-node org testing, lastdb dev check --json, lastdb app publish --env prod, and a clean isolated install from S3 took one working session with zero cloud boilerplate.

At the same time, dogfooding a brand-new public app immediately caught real rough edges that synthetic proofs did not:

  • The website was still reading frozen v1 registry lists. Right after vectorplace 0.1.0 went live on next and stable and installed cleanly via lastdb app install, it did not appear on thelastdb.com/apps. Modern manifests carry a dependencies map, which the registry puts in the signed v2 catalogue (releases.json / releases.signed.json) and omits from legacy v1 lists. Filing the papercut prompted our decision to deprecate v1 list projections altogether and landed the website v2 migration minutes later.
  • Catalog fallback in lastdb app review. A stale 404 commit pointer on an older catalog entry caused lastdb app review --env prod to fall back to offline vocabulary advice instead of skipping the unreachable listing (filed as a papercut).
  • Two small SDK paper edges. databases(list) reports a 32-character user_hash while records stamp the 64-character Ed25519 created_by node key, so optimistic writes needed a quick local readback to match author colors identically across nodes; and @lastdb/app-sdk@0.27.0 didn’t yet expose the daemon’s newer refresh: true flag on db.changes(), so VectorPlace feature-detects it over udsTransport with clean fallback.

Four local nodes syncing in half a second proves the programming model and the UX, not internet-scale crowd load. Two hard questions remain open for the next round of measurement:

  • Hundreds of simultaneous direct writers. We have proven 3,001 members in a grant roster, but 3,001 readers is very different from 200–500 active write streams all polling and appending at once. Measuring multi-writer stream fan-out against submit fan-in on a local reference_relay is next.
  • Open stranger onboarding without a signup server. Public read links (any) carry read only. Opening a community canvas where strangers can draw immediately still needs either People invitations or a lightweight publisher-side grant dispenser issuing short-lived submit grants.

Try it yourself

VectorPlace 0.1.0 is published on the public LastDB App Registry (stable and next) and open source at EdgeVector/vectorplace:

lastdb app install vectorplace
vectorplace

Running vectorplace with no arguments starts a local server against your LastDB node, picks an open port starting at 3100, and opens your browser. From there you can sketch on your personal database, import a Mermaid diagram, or switch into a shared database to watch strokes and sticky notes sync with no central database in sight.

Related: One Database, Two Layers of Permission · How Sharing Works · App Registry · Journal index

← Journal