How kaiiiz/obsidian-raindrop-highlights-plugin works
Project Type and Purpose
• This is an Obsidian community plugin (TypeScript + Svelte) that synchronizes article highlights/annotations from Raindrop.io into an Obsidian vault.
File Structure
• src/main.ts: plugin entry point (registers commands, settings, event hooks)
• src/api.ts & src/tokenManager.ts: handle Raindrop HTTP API calls, rate-limiting, authentication
• src/sync.ts: orchestrates fetch-transform-write pipeline for “full sync”, “incremental sync” and “single bookmark” operations
• src/renderer.ts: transforms raw API data into front-matter + Markdown via Nunjucks templates (src/templates & src/assets)
• src/modal/*.svelte & *.ts: UI layer for configuring API token and managing collections in Obsidian’s modal dialogs
• src/settings.ts & src/constants.ts: plugin configuration definitions and defaults
• manifest.json & package.json & esbuild.config.mjs: plugin metadata, dependency management, build pipeline
Core Components & Interactions
a. Obsidian Host Environment
• Plugin Loader (reads manifest.json, initializes main.ts)
• Vault FS API (read/write Markdown files)
• Settings Storage (persist plugin settings via Obsidian API + localStorage for token)
• Command Palette / UI Integration
b. UI Layer (Svelte Modals)
• API Token Modal
• Collections Management Modal
––– these emit events/commands back to main.ts for persisting settings
c. Business Logic Layer
• Command Handlers (registered in main.ts)
• Sync Service (sync.ts)
• Template Engine (renderer.ts + Nunjucks templates)
• API Service (api.ts + tokenManager.ts, handles OAuth token, rate-limit, pagination)
d. External Service
• Raindrop.io REST API (HTTPS)
e. Local Storage & File System
• localStorage (stores API token)
• Obsidian Vault FS (writes .md files with front-matter and highlights)
Architectural Patterns & Design Principles
• Modular layering: clear separation of UI (Svelte) → orchestration (main) → services (Sync, API) → persistence (Vault, localStorage)
• Template-driven rendering: using Nunjucks as pluggable template engine
• Command-based triggers: all sync operations are exposed as Obsidian commands
• Rate-limit resilience: API service waits and retries when HTTP 429 received