Files
Docwell/Database
tajniak81andClaude Opus 5.5 e927653e4b
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / go (Server) (push) Failing after 8m12s
CI / go (Web-App) (push) Successful in 11m16s
CI / frontend (push) Failing after 7m33s
CI / desktop (ubuntu-latest) (push) Successful in 1h25m49s
CI / mobile (push) Failing after 5m48s
CI / docker (push) Successful in 41m19s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Add edgeless mode: pages as a canvas with their text as a live note
Phase D of docs/AFFINE.md (ADR-14).

The canvas lives in the page's Y.Doc next to its text, in
ydoc.getMap("surface"): one Y.Map per element, each field its own entry so
concurrent edits merge. The page's text is a note on the canvas bound to
the same "default" fragment, so typing on the canvas is typing in the page.
Canvas edits have their own undo history through a Y.UndoManager.

- New package @docwell/canvas: viewport with pan, zoom and pinch;
  selection, marquee, snapping, resize and rotate; notes, text, shapes
  (plain or scribbled), connectors (straight, curve, elbow, with arrowheads
  and labels), pen and eraser, frames, groups, pictures, embeds and link
  cards, and mind maps (right, left or both sides; Tab, Enter, arrows).
  A style bar over the selection; the last style per kind is the default.
- Presentation through frames, stickers and templates, PNG and SVG export.
- Page/Edgeless switch in the header, ?mode= in page and share links, a
  per-page default (pages.default_mode) and a per-device default for new
  pages; share links show the canvas read-only.
- Server: yrs writes the canvas into the document JSON as "surface",
  adds its text to search, and writes it back on restores and templates.
- Phone: the bridge draws the canvas read-only (protocol 3) and the page
  screen has a canvas button.

Strings are translated into all five languages and the user guide covers
edgeless mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:20:20 +01:00
..

Database schema

docwell-db is a stock PocketBase: the stack runs tajniak81/pocketbase-docker-root (source) as it is. There is no Docwell image for it any more. docwell-server brings PocketBase up to Docwell's schema itself, every time it starts (Server/internal/pbschema): missing collections and fields are created, existing ones keep their data. It also writes the DOCWELL_* settings (app name and URL, mail, file storage) and sends Docwell's own emails, so PocketBase needs no hooks either.

This folder is where that schema is written:

  • pb_migrations/ holds the JS migrations, the source of truth for the schema.
  • export-schema.sh turns them into Server/internal/pbschema/schema.json, the snapshot docwell-server embeds and applies.
  • All collection API rules are null, so only superusers have access. Never expose PocketBase publicly; only docwell-server talks to it.

Changing the schema

  1. Add a migration to pb_migrations/ (pocketbase migrate create "add_comments" --migrationsDir ./pb_migrations, or copy an existing file). Leave earlier migrations alone.

  2. Regenerate the snapshot (needs Docker and Go):

    sh Database/export-schema.sh
    
  3. Commit the migration and the new schema.json together. go test ./internal/pbschema checks the snapshot.

Removing a collection or a field is not done by the snapshot: it only adds and updates. Do that by hand, once, in the PocketBase dashboard of each install, after the release that stops using it.

The admin panel manages two parts of the users collection itself, the OAuth2 providers and the magic link switch (otp.enabled), so the snapshot leaves them out and they keep whatever is set.

Run locally

Download PocketBase v0.40.6 for your OS into Database/bin/, then:

./bin/pocketbase superuser upsert admin@docwell.test devpassword123 --dir ./pb_data
./bin/pocketbase serve --dir ./pb_data --http 127.0.0.1:8070

Start docwell-server against it (DOCWELL_PB_EMAIL and DOCWELL_PB_PASSWORD set to that superuser) and it creates the collections. The PocketBase dashboard is at http://127.0.0.1:8070/_/.