feat: add notes and a real-time editing server - #41
Merged
Merged
Conversation
This was referenced Oct 5, 2026
AmrMsCLL
force-pushed
the
feat/exchange-rates
branch
from
October 5, 2026 19:03
d7c5ae4 to
8459ce4
Compare
AmrMsCLL
force-pushed
the
feat/realtime-server
branch
from
October 5, 2026 19:03
e2ad95c to
7ca6efc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
PR 3c from
.claude/.Plans/as2026-10-02-strata-phase-3-technical-design.md. Amr approved decisions 1, 2 and 5 (Yjs, Hocuspocus, real-time insideapp). Stacked on #40. Server only; the editor arrives in the next PR.New dependencies, all MIT:
yjs13.6.33,y-protocols1.0.7,@hocuspocus/server4.7.0,ws8.22.0, plus@hocuspocus/provider4.7.0 and@types/wsas dev dependencies for the tests. Two departures from the design:Hocuspocus 4 no longer attaches to an existing HTTP server, so the upgrade goes through
wsthe way Hocuspocus's own server does it.wswas already installed through Hocuspocus; it is now a direct dependency.I ran the installs inside the Linux container. The Windows npm here drops every
libcfield from the lockfile, which the Alpine images rely on. No existing lockfile lines changed.Notes:
itemsof kindnote, so tags, the trash, sharing, search and activity work as for other items;notestable holds the page tree (parent, position, icon, pinned);GETandPOST /spaces/:id/notes,GETandPATCH /notes/:id. A page's details include whether you can edit it and its breadcrumb path;Real-time (
/api/v1/realtime, same origin as the app):JwtStrategy.validate, now exported), and access tokens are not accepted. Upgrades from origins outsideAUTH_TRUSTED_ORIGINSget a 403.too-largemessage.note_documentsafter 2 seconds of quiet, or at most every 10 seconds while typing. Each save also writes the note's plain text intosearch_documents.body_text, which the existing search reads, and updates who changed the note last.Migration (runs on deploy)
20261005020000_notescreatesnotesandnote_documents, and adds anotesrow for each existing note item:Verification
Lint, the server build,
tsc --noEmitandtest/app.module.spec.tspass.The new
test/document-text.spec.tscovers turning headings, formatted text and nested lists into one line per block.The new
test/integration/notes.spec.tsuses real WebSockets with the Hocuspocus client. It covers:note_documents, the text becoming searchable, and an outsider being refused;It passes against Postgres on the local stack, together with
search.spec.tsandaccess.spec.ts. Its first run caught moved pages keeping their old position, now fixed.