How homielab/noteflare works
NoteFlare is an end-to-end encrypted notes application, with a React web app, Cloudflare Worker API, and optional SDK/CLI for custom clients. The main workflow is: a visitor passes the app’s access/setup gate, unlocks or creates a vault in the browser, then reads and edits notes in the notebook. The note store and sync engine keep encrypted changes locally and synchronize them through the API; the Worker handles authenticated requests and persistence. Import/export, attachments, offline/PWA support, recovery, and integrations are additional product branches. Some Worker storage details and unsampled feature wiring are only documented, so those links are cited to the README or omitted.
Main entry points: vault.tsx Vault session · api.ts Web API client · index.ts Worker API · App.tsx App gate
Components 21
Web experience
- App gate
src/App.tsx - Unlock screen
src/components/UnlockScreen.tsx - Notebook
src/components/Notebook.tsx - Note editor
src/components/NoteEditor.tsx
Vault and notes
- Vault session
src/lib/vault.tsx - Encryption
packages/client/src/crypto.ts - Note store
src/lib/notes.ts - Sync engine
src/lib/sync/engine.ts - Local store
src/lib/sync/localStore.ts
Worker service
- Web API client
src/lib/api.ts - Worker API
worker/index.ts - Access auth
worker/auth.ts - D1 database
- R2 bucket
External clients
- TypeScript SDK
packages/client/src/client.ts - CLI
packages/cli/bin/noteflare.mjs
Offline and features
- Note import
src/lib/importMarkdown.ts - Attachments
src/lib/attachments.tsx - PWA support
src/lib/pwa.ts - Offline worker
src/sw/sw.js
Other components
- Visitor
Connections 28
- Visitor → App gate: opens
src/App.tsx - App gate → Vault session: provides session
src/App.tsx - App gate → Unlock screen: gates access
src/App.tsx - App gate → Notebook: loads when unlocked
src/App.tsx - Unlock screen → Vault session: unlocks vault
src/components/UnlockScreen.tsx - Vault session → Encryption: creates and unlocks keys
src/lib/vault.tsx - Vault session → Web API client: loads vault record
src/lib/vault.tsx - Vault session → Local store: caches vault
src/lib/vault.tsx - Notebook → Note store: manages notes
src/components/Notebook.tsx - Notebook → Note editor: opens note
src/components/Notebook.tsx - Note editor → Note store: updates note
src/components/NoteEditor.tsx - Note store → Sync engine: delegates sync
src/lib/notes.ts - Note store → Local store: reads and writes
src/lib/notes.ts - Sync engine → Encryption: encrypts and decrypts
src/lib/sync/engine.ts - Sync engine → Local store: queues and caches
src/lib/sync/engine.ts - Sync engine → Web API client: pushes and fetches
src/lib/sync/engine.ts - Web API client → Worker API: sends API requests
src/lib/api.ts - Worker API → Access auth: checks access
worker/index.ts - Worker API → D1 database: persists encrypted data
README.md - Note import → Encryption: encrypts imported notes
src/lib/importMarkdown.ts - Notebook → Note import: offers import
README.md - Attachments → Encryption: encrypts images
src/lib/attachments.tsx - Attachments → Web API client: uploads and fetches blobs
src/lib/attachments.tsx - Web API client → R2 bucket: stores encrypted blobs
README.md - Vault session → PWA support: keeps offline copy
src/lib/vault.tsx - PWA support → Offline worker: supports offline app
README.md - TypeScript SDK → Worker API: uses API
README.md - CLI → Worker API: uses API
README.md