Configuration System
Inkdown uses a centralized configuration system managed by theConfigManager class. This document describes how configuration is stored, loaded, and managed across the application.
Overview
TheConfigManager provides a simple key-value store for persisting application and plugin settings as JSON files with an optional in-memory cache layer.
Location: packages/core/src/ConfigManager.ts
Storage Location
Configuration files are stored in the app’s config directory:| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/com.furqas.inkdown/ |
| Windows | %APPDATA%\com.furqas.inkdown\ |
| Linux | ~/.config/com.furqas.inkdown/ |
Directory Structure
ConfigManager API
Initialization
- Gets the config directory from the native platform
- Initializes the storage implementation (if provided)
Loading Configuration
- Try KV storage cache (fastest)
- Fall back to file system (persistent)
- Create default config if not found
Saving Configuration
- Save to KV storage cache
- Save to file system (atomic write)
Cache Management
Config File Mapping
| Config Key | File | Description |
|---|---|---|
app | app.json | Main app settings (theme, font, plugins state, tabs) |
editor | editor.json | Editor preferences |
shortcuts | shortcuts.json | Keyboard shortcuts |
installed-themes | installed-themes.json | Community theme installation records |
installed-plugins | installed-plugins.json | Community plugin installation records |
Configuration Types
App Configuration
The main application configuration stored inapp.json:
Editor Configuration
Example app.json
Plugin Data Storage
Plugins store their settings within the app config through the Plugin API:plugins array:
Storage Implementation
The ConfigManager uses a platform-specific storage implementation:Desktop (Tauri)
- KV Storage: Not typically used (direct file access is fast)
- File Storage: JSON files via Tauri commands
Web (Future)
- KV Storage: IndexedDB for fast caching
- File Storage: IndexedDB for persistence
Mobile (Future)
- KV Storage: AsyncStorage
- File Storage: React Native File System
Best Practices
1. Type Safety
Always define TypeScript interfaces for configuration:2. Default Values
Handle missing configuration gracefully:3. Validation
Validate loaded configuration before using:4. Save Frequency
Avoid excessive saves:Default Configurations
The ConfigManager provides sensible defaults for all configs:Atomic Writes
The ConfigManager ensures atomic writes to prevent corruption during crashes. The native platform handles writing to a temporary file and then renaming it.Related Documentation
- App and Managers - Manager APIs
- Plugin Development - Using config in plugins
- Theme System - Theme configuration
