Skip to content

Architecture

memrynote is a pnpm + Turborepo monorepo with an Electron desktop app, a Cloudflare Workers sync server, and shared TypeScript packages.

Top-Level Map

PathPurpose
apps/desktopElectron 39 + React 19 + Vite. Main / renderer / preload.
apps/sync-serverCloudflare Workers + Hono. D1 + R2.
apps/docsThis documentation site (VitePress).
packages/contractsIPC and API contracts (Zod).
packages/db-schemaDrizzle ORM schemas.
packages/sharedShared utilities.

Trust Boundary

The user's device is trusted. The server is not. Everything that leaves the device is encrypted; the server stores ciphertext and serves it back.

Local Storage

Two SQLite databases via better-sqlite3 + Drizzle:

  • Data DB — notes, journals, tasks, projects, inbox, templates, settings.
  • Index DB — full-text search, link graph, embedding vectors.

Local Storage (Dual SQLite)

Sync

  • D1: encrypted sync item metadata (vector clocks, blob keys, hashes).
  • R2: encrypted payload blobs (avoids the 1 MB D1 row limit).
  • Hybrid sync: bulk snapshots through SyncItemHandler plus incremental Yjs updates through /sync/crdt/updates.

Sync Protocol · CRDT & Notes Sync · Sync Item Handlers

Cryptography

XChaCha20-Poly1305 + Ed25519 + Argon2id, all via libsodium. Per-device sealing of the vault key. Constant-time comparisons.

Cryptography

IPC Boundary

Shared Zod contracts in packages/contracts. Validated at typecheck time via pnpm ipc:check.

IPC Boundary

Observability

Local logging via electron-log; switchable telemetry that ships only enums and surface names.

Observability & Telemetry

Verification Gates

bash
pnpm lint
pnpm typecheck
pnpm test
pnpm ipc:check

Released under the GNU GPL v3.0.