How jkaplon/trilium works
Main Components
A. Frontend Layer:
• Desktop Application (Electron-based)
• Web Application
• Mobile Frontend
Components should be organized under src/public/app:
• Widgets system (src/public/app/widgets)
• Services (src/public/app/services)
• Type-specific components (src/public/app/widgets/type_widgets)
B. Backend Layer:
• Core Services (src/services)
• API Routes (src/routes/api)
• Database Layer (SQLite, indicated by better-sqlite3 binaries)
• Authentication & Encryption Services
• Sync Service
• Search Engine
C. Data Storage:
• Storage
• Attachment Storage
• Revision History
• Blob Storage
Key Relationships to Highlight
A. Data Flow:
• Client-Server Communication (WebSocket + REST API)
• Sync Flow between instances
• Tree Structure
• Encryption/Decryption flow
B. Component Integration:
• Frontend-Backend Communication
• Authentication Flow
• Search & Indexing Pipeline
• Versioning System
Architectural Patterns to Emphasize
A. Core Architecture:
[Desktop/Web/Mobile Client]
• ↕ HTTP/WS
[API Layer (ETAPI)]
• ↕
[Service Layer]
• ↕
[Data Access Layer]
• ↕
[SQLite Database]
B. Note Organization:
[Note Entity]
• ↙ ↓ ↘
[Attributes] [Content] [Attachments]
• ↓ ↓ ↓
[Metadata] [Revisions] [Blobs]
Special Features
• Protected Notes System
• Synchronization Mechanism
• Search & Indexing Pipeline
• Sharing/Publishing System
• Scripting Engine Integration
Implementation Details to Note
• Database schema relationships
• Security boundaries
• Scalability points
• Sync points between instances
• Plugin/extension points
• Client Layer |
• [Desktop] [Web] [Mobile]|
• ↕
• API Layer |
• [REST] [WebSocket] [ETAPI]|
• ↕
• Service Layer |
• [Notes] [Sync] [Search]|
• ↕
• Data Layer |
• [SQLite] [Blobs] [Cache]|
Remember to maintain a balance between detail and clarity, focusing on the hierarchical nature of the note-taking system while showing how the various components interact to provide features like synchronization, encryption, and search functionality.