How mizcausevic-dev/sveska works
Purpose and principal workflow: Sveska is a local-first notebook PWA, with a separate browser-extension side panel for lightweight notebook and task-list editing. In the main PWA workflow, a person opens the web app and edits or creates a note; the React application persists note state in browser storage and can render Markdown, export content, or request streamed AI assistance. The extension is a distinct entry point and uses Chrome local storage rather than the PWA’s IndexedDB store.
Components
PWA application
• PWA bootstrap — src/main.tsx: Hydrates theme, UI, editor preferences and tabs before mounting the app, and installs lazy-chunk recovery.
• Application shell and routes — src/app/App.tsx: Defines browser routes, shared modal hosts and global UI, and handles URL-hash note imports.
• Person using Sveska — null: Opens the web app, edits notes, and initiates actions such as exports or AI requests.
• Editor and writing workspace — src/editor/Editor.tsx: Provides the note-editing workflow; the editor subsystem also covers autosave, draft recovery, Markdown modes, snapshots, search and writing tools.
• Note storage and navigation — src/notes/noteRepo.ts: Implements note persistence and note operations; the notes subsystem also contains the database, attachment, draft, snapshot, directory and tab repositories and stores.
• Markdown processing — src/markdown/render.ts: Renders Markdown for the application; the Markdown subsystem also provides AST and export functionality.
• Canvas workspace — src/canvas/ExcalidrawCanvas.tsx: Provides the Excalidraw drawing surface; the README documents per-note canvas use and PNG export.
• AI client and result UI — src/ai/aiClient.ts: Calls the /api/ai endpoint and parses streamed text deltas for AI consumers; the AI subsystem includes prompts and result presentation.
• AI edge endpoint — functions/api/ai.ts: Implements the documented Cloudflare Pages Function endpoint used as the Anthropic proxy. Its implementation details were not sampled.
• Anthropic API — null: External model provider documented by the AI client and README.
• Platform and content surfaces — src/platform/content.ts: Supports the platform surface, including documented glossary, blog and changelog content, consent, SEO and lead capture.
• PWA/browser storage — null: Browser IndexedDB is the persistence medium documented for local notes and attachments; this is not an external cloud storage service.
Browser extension
• Extension panel bootstrap and app — extension/src/main.tsx: Mounts the extension’s React side panel; extension/src/App.tsx hydrates extension state and selects the Tasks or Notebook panel.
• Extension note storage — extension/src/storage/notesStorage.ts: Reads and writes notes and active-note, tab and theme preferences in chrome.storage.local, serializing note mutations through a promise chain.
• Extension task-list UI — extension/src/panels/TasksPanel.tsx: Presents checklist-mode notes and uses checklist parsing and serialization for interactive task edits.
• Chrome extension runtime — null: Supplies the side-panel host and chrome.storage.local API used by the extension.
Relationships
• Person using Sveska -> PWA bootstrap: Opens the web app; bootstrap hydrates persisted preferences and tabs before mounting the application.
• PWA bootstrap -> Application shell and routes: Mounts the React application after bootstrap.
• Application shell and routes -> Editor and writing workspace: Renders the home route within the shared layout; the route defines the page, while the editor subsystem supplies note-editing behavior.
• Editor and writing workspace -> Note storage and navigation: Autosave calls saveNoteBody; image paste persists attachments through the attachment repository.
• Note storage and navigation -> PWA/browser storage: Persists local application state in IndexedDB, as documented and reflected by the database/repository subsystem.
• Editor and writing workspace -> Markdown processing: Uses Markdown rendering/export functionality; the README documents edit, split and preview modes.
• Editor and writing workspace -> Canvas workspace: Offers the per-note drawing surface documented by the README; exact invocation wiring was not sampled.
• Editor and writing workspace -> AI client and result UI: AI actions use the client to request streamed completion text; individual slash-command call sites were not sampled.
• AI client and result UI -> AI edge endpoint: Sends a POST to /api/ai and parses the response as an SSE stream.
• AI edge endpoint -> Anthropic API: Acts as the documented Anthropic proxy; direct implementation details and request behavior were not sampled.
• Person using Sveska -> Chrome extension runtime: Opens the extension side panel; the specific browser action or event that opens it is not established.
• Chrome extension runtime -> Extension panel bootstrap and app: Hosts the extension panel entry point.
• Extension panel bootstrap and app -> Extension note storage: Hydrates notes and preferences, then invokes storage operations for user edits and selection.
• Extension panel bootstrap and app -> Extension task-list UI: Renders the task panel when the active tab is Tasks.
• Extension task-list UI -> Extension panel bootstrap and app: Calls the app’s callbacks to create, select, edit and delete notes.
• Extension note storage -> Chrome extension runtime: Reads and writes persisted extension data using chrome.storage.local.
Coverage limits: The README describes additional features and integrations, but their concrete runtime wiring was not established from the sampled source. In particular, the Cloudflare Function implementation, canvas provider flow and the extension’s browser manifest/launch configuration were not supplied; no further relationships are asserted for them.
Main entry points: Editor.tsx Editor workspace · src/main.tsx Extension panel app · src/main.tsx PWA bootstrap · App.tsx App shell and routes
Components 15
PWA
Main notebook application
- PWA bootstrap · Hydrates preferences and tabs before mounting the app
src/main.tsx - App shell and routes
src/app/App.tsx
Notes and content
Note editing, persistence, and rendering
- Editor workspace · Note editing, autosave, and writing tools
src/editor/Editor.tsx - Note storage and navigation · Note operations and related repositories and stores
src/notes/noteRepo.ts - Markdown processing
src/markdown/render.ts - Canvas workspace · Per-note drawing surface
src/canvas/ExcalidrawCanvas.tsx
AI assistance
Streamed AI request path
- AI client and results · Requests streamed completions and parses text deltas
src/ai/aiClient.ts - AI edge endpoint · Cloudflare Pages Function Anthropic proxy
functions/api/ai.ts
Browser extension
Side-panel notebook and task editing
- Extension panel app · Mounts the side panel and selects its active panel
extension/src/main.tsx - Extension note storage · Serializes note mutations and stores extension preferences
extension/src/storage/notesStorage.ts - Extension task panel · Edits checklist-mode notes
extension/src/panels/TasksPanel.tsx
External actors and stores
- Person
- PWA browser storage · Local persistence for notes and attachments
- Anthropic API
- Chrome extension runtime · Hosts the side panel and provides chrome.storage.local
Connections 16
- Person → PWA bootstrap: opens
- PWA bootstrap → App shell and routes: mounts
- App shell and routes → Editor workspace: renders
- Editor workspace → Note storage and navigation: saves notes
- Note storage and navigation → PWA browser storage: persists state
- Editor workspace → Markdown processing: renders and exports
- Editor workspace → Canvas workspace: offers drawing
- Editor workspace → AI client and results: requests completion
- AI client and results → AI edge endpoint: posts request · Receives streamed response text
- AI edge endpoint → Anthropic API: proxies to
- Person → Chrome extension runtime: opens side panel
- Chrome extension runtime → Extension panel app: hosts
- Extension panel app → Extension note storage: hydrates and updates
- Extension panel app → Extension task panel: renders Tasks
- Extension task panel → Extension panel app: calls callbacks · Creates, selects, edits, and deletes notes
- Extension note storage → Chrome extension runtime: reads and writes · Uses chrome.storage.local