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.
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_msstill 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
submitproposal. Direct writers can send multi-mutation atomic batches, while asubmitproposal 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
writegrants. Direct writers hold whole-record last-writer-wins until their grant end passes. Rather than inventing central moderation, every client stores mutedcreated_bykeys locally inLASTDB_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 tileEvery 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.
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
writewith owner stopped:writerplaced a 928-byte stamp directly onto its own signed stream whileownerwas shut down.readersynced and rendered it in 506 ms. - Sealed
submitproposal settlement:contributordropped a sticky note whileownerwas offline; it stayedpendingwith a pulsing dashed outline. Startingownersettled and replicated it toreaderin 1.27 s (2.29–2.35 s end-to-end from a browser click). - Layer 2 drag and delete protection: When
contributortried dragging or deleting anowner-createdExeMem Relaycard, LastDB refused with HTTP403 not_record_creatorand the UI snapped the card right back. Dragging and editingcontributor’s own yellow RFC sticky note proposed and settled cleanly. - Local-first search: Pressing
⌘Kfiltered 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.0went live onnextandstableand installed cleanly vialastdb app install, it did not appear on thelastdb.com/apps. Modern manifests carry adependenciesmap, 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 causedlastdb app review --env prodto 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-characteruser_hashwhile records stamp the 64-character Ed25519created_bynode key, so optimistic writes needed a quick local readback to match author colors identically across nodes; and@lastdb/app-sdk@0.27.0didn’t yet expose the daemon’s newerrefresh: trueflag ondb.changes(), so VectorPlace feature-detects it overudsTransportwith 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
writestreams all polling and appending at once. Measuring multi-writer stream fan-out againstsubmitfan-in on a localreference_relayis next. - Open stranger onboarding without a signup server. Public read links (
any) carryreadonly. Opening a community canvas where strangers can draw immediately still needs either People invitations or a lightweight publisher-side grant dispenser issuing short-livedsubmitgrants.
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
vectorplaceRunning 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