Skip to main content

Architecture Overview

Inkdown is a modern, cross-platform markdown note-taking application built with Tauri v2, React 19, and TypeScript. It follows a modular monorepo architecture with a platform-agnostic core and platform-specific adapters, enabling true cross-platform compatibility across Desktop, Web, and potentially Mobile platforms.

High-Level Architecture

The application is organized as a Bun monorepo with the following structure:
  1. Apps Layer (apps/): Platform-specific entry points. Currently includes the Desktop app using Tauri.
  2. Core Layer (packages/core/): Platform-agnostic business logic, state management, managers, and Plugin API.
  3. UI Layer (packages/ui/): Shared React component library for design consistency.
  4. Plugins Layer (packages/plugins/): Built-in plugins providing core functionality.
  5. Platform Adapters:
    • Editor Adapters: @inkdown/editor-codemirror (with future support for React Native editors)
    • Native Adapters: @inkdown/native-tauri (with future support for Web and React Native)
    • Storage Adapters: @inkdown/storage-tauri

Core System (@inkdown/core)

The Core package is the foundation of Inkdown. It exposes the main App class and various Managers that handle specific domains.

Key Managers

ManagerDescription
AppCentral hub that initializes all managers and coordinates the application lifecycle
PluginsUnified facade for built-in and community plugin access via app.plugins
WorkspaceManages file operations (CRUD) and file events. Acts as the “Vault”
WorkspaceUIManages UI state including tabs, views, and active file
PluginManagerHandles built-in plugin loading, enabling, and disabling
CommunityPluginManagerHandles community plugin discovery, installation, and updates from GitHub
ConfigManagerPersistent configuration storage (JSON files in app config directory)
ThemeManagerTheme loading, switching, and CSS injection for built-in themes
CommunityThemeManagerCommunity theme browsing, installation, and management from GitHub
FileSystemManagerBridge to the Rust backend for file system operations
EditorRegistryManages CodeMirror editor instances and provides access to active editor
EditorStateManagerManages content of open files, dirty states, and auto-saving
TabManagerHandles tab management, restoration, and persistence
CommandManagerCentral registry for all commands (plugin and built-in)
MetadataCacheCaches file metadata and frontmatter for quick access
SyncManagerHandles workspace synchronization
BookmarkManagerManages bookmarked files
FontManagerSystem font discovery and management

Initialization Flow

// App initialization order (simplified from App.ts)
async init(): Promise<void> {
    // 1. Initialize config manager (needed by other managers)
    await this.configManager.init();
    
    // 2. Load system fonts
    await this.fontManager.loadSystemFonts();
    
    // 3. Load and apply theme
    await this.loadTheme();
    
    // 4. Initialize community theme manager
    await this.communityThemeManager.init();
    
    // 5. Initialize sync manager
    await this.syncManager.init();
    
    // 6. Initialize bookmark manager
    await this.bookmarkManager.initialize();
    
    // 7. Initialize community plugin manager and load plugins
    await this.communityPluginManager.init();
    await this.communityPluginManager.loadAllInstalledPlugins();
    
    // 8. Load all plugins (built-in + community)
    await this.loadPlugins();
    
    // 9. Initialize tab manager and restore tabs
    await this.tabManager.init();
}

Data Flow

Class Diagram

Technology Stack

ComponentTechnology
Desktop FrameworkTauri v2 (Rust backend)
FrontendReact 19 + TypeScript
EditorCodeMirror 6
StylingCSS Variables (no Tailwind)
Package ManagerBun
Build ToolVite
LintingBiome

Cross-Platform Architecture

Inkdown achieves cross-platform compatibility through the Bridge Pattern and Dependency Injection:
  • Platform-Agnostic Core: All business logic is implemented without platform dependencies
  • Abstract Interfaces: Platform features (file system, editor, storage) are accessed through interfaces
  • Platform Providers: Each platform implements these interfaces (Tauri, Web, React Native)
  • Runtime Registration: Platform providers are registered at app startup