0xNote

2026 · Deepanjan Pati

Local first. Fast always. Finds what you meant.

0xNote

The Design Principle

0xNote is an offline-first PWA note workspace — IndexedDB is the source of truth, Supabase is the replica. Every operation completes against local state first. The network is a background concern, not a dependency.

Three separate engineering problems, each requiring a different solution: a correct Vim emulation layer, a local-first storage architecture, and semantic search that retrieves notes by concept rather than keyword.

The Vim Layer

Existing Vim emulation libraries handle roughly 60–70% of the keymap and feel subtly wrong at the edges — wrong enough to catch under daily use. 0xNote ships a hand-implemented finite state machine that tracks mode (normal, insert, visual, command), a pending keychord buffer, and cursor position.

Compound motions like ciw (change-inner-word) and dap (delete-around-paragraph) require multi-key sequence recognition, text-object boundary detection, and atomic transform application. The FSM handles look-ahead for sequences like gg=G without blocking input.

Storage & Sync

Dexie.js wraps IndexedDB as the typed primary store — reads and writes complete at local disk speed regardless of network state. Supabase sync runs on a 30-second interval, on reconnect, and on tab visibility change. Conflicts resolve via local-write-wins with timestamp comparison — no merge dialogue ever surfaces to the user.

Semantic Search

Each note write triggers a Gemini embed API call. The resulting vector is stored in Supabase pgvector and queried by cosine similarity at search time. A note written three weeks ago without tags or a useful title surfaces when you type a loose description of what you were thinking about when you wrote it.

Key Technical Decisions

  • Hand-implemented Vim FSM — compound motions (ciw, dap, gg=G) with look-ahead, no emulation library
  • Dexie.js over IndexedDB as primary store — reads at local disk speed, zero network dependency on open
  • Local-write-wins conflict resolution with timestamp-based Supabase background sync
  • Gemini embed API → Supabase pgvector → cosine similarity search by concept

What's Next

0xNote is live and used daily. The architectural principle that proved most valuable: in a local-first system, network operations should never appear in the critical path of any user action. Planned additions include end-to-end encryption before Supabase sync and a native desktop wrapper via Tauri for sub-50ms cold opens.

ReactViteSupabaseDexie.jsGemini AITailwind