Monorepo Structure
Inkdown is organized as a Bun monorepo with clear separation between application layers, core business logic, and platform-specific implementations.Architecture Layers
The architecture consists of three primary layers:1. Application Layer
Platform-specific entry points that bootstrap the application:- Desktop App (
apps/desktop): Built with Tauri + React - Mobile App (
apps/mobile): React Native with Expo (in development) - Web App (future): Browser-based version
2. Core Layer
Platform-agnostic packages that contain business logic:@inkdown/core
Central business logic, managers, and Plugin API. The foundation of Inkdown.
@inkdown/ui
Shared React component library for design consistency across platforms.
@inkdown/plugins
Built-in plugins providing core functionality like live preview and word count.
@inkdown/plugin-api
Public API for community plugin developers.
3. Platform Adapter Layer
Platform-specific implementations that bridge core functionality to native capabilities:Editor Adapters
Editor Adapters
- @inkdown/editor-webview: CodeMirror 6 implementation (Desktop, Web)
- Future: React Native editor adapters
Native Adapters
Native Adapters
- @inkdown/native-tauri: File system, dialogs, clipboard via Tauri IPC
- @inkdown/native-expo: React Native native modules
- Future: Web browser APIs adapter
Storage Adapters
Storage Adapters
- @inkdown/storage-tauri: File system-based storage for desktop
- @inkdown/storage-mobile: AsyncStorage for mobile
Core System (@inkdown/core)
The Core package is the foundation of Inkdown, exposing the main App class and various specialized managers.
The App Class
App.ts
Key Managers
TheApp class coordinates multiple specialized managers:
Manages file operations (CRUD) and file events. Acts as the central file management system.
Manages UI state including tabs, views, and active file display.
Handles built-in plugin loading, enabling, and disabling.
Manages community plugin discovery, installation, and updates from GitHub.
Persistent configuration storage (JSON files in app config directory).
Theme loading, switching, and CSS injection for built-in themes.
Handles tab management, restoration, and persistence.
Central registry for all commands (plugin and built-in).
Manages CodeMirror editor instances and provides access to active editor.
Manages content of open files, dirty states, and auto-saving.
Caches file metadata and frontmatter for quick access.
Manages bookmarked files and bookmark groups.
System font discovery and management.
Handles workspace synchronization.
Initialization Flow
The application follows a specific initialization sequence to ensure all dependencies are loaded in the correct order:App.ts (simplified)
The initialization order is critical. For example,
configManager must be initialized before other managers that depend on configuration, and plugins must be loaded before tabs are restored.Technology Stack
Desktop Framework
Tauri v2 - Rust backend with web frontend
Frontend
React 19 + TypeScript
Editor
CodeMirror 6 - Extensible code editor
Styling
CSS Variables - No Tailwind, theme-first approach
Package Manager
Bun - Fast JavaScript runtime and package manager
Build Tool
Vite - Next-generation frontend tooling
Linting
Biome - Fast formatter and linter
Mobile
React Native + Expo - Cross-platform mobile
Data Flow
Here’s how a typical file operation flows through the architecture:The NativeBridge pattern allows the same core code to work across different platforms by swapping out the native implementation at runtime.
Benefits of This Architecture
Platform Agnostic
Write business logic once, run on Desktop, Web, and Mobile
Type Safe
Full TypeScript coverage ensures compile-time checking
Testable
Easy to mock platform implementations for unit testing
Extensible
Plugin system allows community extensions
Maintainable
Clear separation of concerns and single responsibility
Performance
No runtime overhead - abstractions are compile-time only
Related Documentation
Plugin System
Learn about Inkdown’s plugin architecture and API
Workspace
Understand workspace management and file operations
Cross-Platform
Deep dive into the bridge pattern and platform adapters
Build a Plugin
Start building your first Inkdown plugin
