All Projects

Notes App

Live Demo
Role
Frontend, PKM Engine & Offline-First Engineering
Read
3 min read
Table of Contents
  1. Project Overview
  2. Problem Statement
  3. Solution Architecture
  4. Technical Deep Dives
    1. Svelte 5 Runes, Bi-Directional WikiLinks & Knowledge Graph
    2. Obsidian Authoring, KaTeX Math & Hardened Sanitization
    3. Multi-Tab Synced Split View, 4 Themes & Offline Persistence
  5. Algorithm & Benchmarks
  6. Architecture Trade-Offs
  7. Project Results

Project Overview

An offline-first, Obsidian-class Markdown and Personal Knowledge Management (PKM) vault built with Svelte 5 Runes, Vite 6, Marked.js, KaTeX, and IndexedDB. It pairs bi-directional [[WikiLinks]], backlinks, unlinked mentions, and an interactive force-directed Knowledge Graph with a Right Inspector sidebar, slash commands, Obsidian callouts, YAML frontmatter pills, multi-tabs, and a resizable scroll-synced split view.

Problem Statement

Browser-based Markdown tools rarely bridge the gap between lightweight note pads and full PKM vaults like Obsidian. Supporting bi-directional linking, live math rendering, multi-tab editing, and graph visualization offline—without XSS vulnerabilities, async race conditions, or main-thread typing lag—requires fine-grained reactivity and hardened local persistence.

Solution Architecture

Svelte 5 Runes drive fine-grained reactive state across open tabs, the editor, and the Right Inspector. Keystrokes feed a sanitized Marked.js + KaTeX + Highlight.js + DOMPurify rendering pipeline while debounced transactions persist notes, version history, and disk sync into IndexedDB.

Live architecture & logic flow
Service Data store External
keystrokes & cmds AST + math async persist sanitized HTML graph & backlinks Svelte 5 Editor & Tabs Svelte 5 Runes PKM Store Marked + KaTeX + DOMPurify IndexedDB & Version History Split View, Inspector & Graph
Click or focus any node to inspect architectural details.

Technical Deep Dives

  • Upgraded the reactive core to Svelte 5 Runes, indexing [[Note Title]] and aliased links across the vault to power incoming Backlinks, Unlinked Mentions (with 1-click auto-link), note embeds, and instant creation of unresolved notes.
  • Built an interactive pan/zoom force-directed SVG Knowledge Graph (Ctrl+G) visualizing note clusters and hub connections alongside a collapsible Right Inspector (live H1–H6 Outline, Links, and Folder/Tag Properties).

Obsidian Authoring, KaTeX Math & Hardened Sanitization

  • Added [[ WikiLink autocomplete, a / Slash Command menu, smart list continuation with native Undo/Redo preservation, clipboard image paste, interactive preview task checkboxes, and 1-click Daily Notes.
  • Supports KaTeX math equations, styled & collapsible Obsidian callouts (> [!NOTE], > [!FAQ]-), YAML frontmatter property pills, and theme-adaptive Highlight.js code blocks—all sanitized through DOMPurify with XSS and race-condition fixes.

Multi-Tab Synced Split View, 4 Themes & Offline Persistence

  • Engineered a multi-tab bar with a draggable split-pane divider (25%–75%) and proportional scroll synchronization between Editor and Preview, plus dedicated print styles and 4 palettes (Dark Obsidian, Clean Light, Pure OLED Black, Warm Sepia).
  • Persists notes, version history, and disk sync asynchronously in IndexedDB with safe single-note .md/.html export and full-vault .json merge backup.

Algorithm & Complexity Benchmarks

Markdown + KaTeX + DOMPurify Render

vs O(N) VDOM re-render
Time: O(N) Space: O(N)

Fine-grained Svelte 5 Runes updates keep live split-view preview compilation under 15ms.

IndexedDB Vault Lookup & Graph Index

vs synchronous localStorage
Time: O(V + E) Space: O(V + E)

Async IndexedDB persistence and incremental WikiLink indexing avoid main-thread typing stalls.

Architecture Trade-Offs

Offline Knowledge Vault Storage

Chosen: IndexedDB + Version History + JSON Merge Backup Over: localStorage JSON Strings

Handles rich notes, pasted images, and version snapshots asynchronously without hitting the 5MB synchronous storage ceiling.

Reactivity & Graph Rendering

Chosen: Svelte 5 Runes + Native Force-Directed SVG Over: Heavy Virtual-DOM + External Graph Library

Delivers obsidian-class WikiLinks, multi-tabs, and pan/zoom graph navigation while keeping the Vite 6 bundle lightweight and memory usage low.

Project Results

Obsidian-Class PKM

Delivers WikiLinks, backlinks, unlinked mentions, Knowledge Graph, KaTeX math, callouts, and Right Inspector 100% offline in the browser.

Hardened & Fast

Eliminated XSS and async race loopholes while maintaining sub-15ms live preview compilation with Svelte 5 Runes.

Workspace Ergonomics

Multi-tabs, resizable scroll-synced split view, slash/WikiLink autocomplete, and 4 adaptive themes with zero cloud lock-in.

Keyboard Shortcuts

Global Navigation

  • Open Command Palette Cmd / CtrlK
  • Toggle Bruce's AI Assistant Shell ~or`
  • Show keyboard shortcuts ?
  • Close active modal or dialog Esc

Case Studies & Diagrams

  • Jump to next article section J
  • Jump to previous article section K
  • Inspect focused architecture node Enter / Space

Interactive Shell

  • Autocomplete commands, routes, & slugs Tab
  • Cycle command history ↑↓