Convert ASCII diagrams to Mermaid.js format

Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-04 12:35:56 +00:00
parent 07fe42d04e
commit 0494032fb5
3 changed files with 99 additions and 104 deletions

125
docs/ARCHITECTURE.md vendored
View File

@@ -53,30 +53,30 @@ Trilium Notes is a hierarchical note-taking application built as a TypeScript mo
Trilium follows a **client-server architecture** even in desktop mode, where Electron runs both the backend server and frontend client within the same process. Trilium follows a **client-server architecture** even in desktop mode, where Electron runs both the backend server and frontend client within the same process.
``` ```mermaid
┌─────────────────────────────────────────────────────────────┐ graph TB
│ Frontend │ subgraph Frontend
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ Widgets[Widgets<br/>System]
Widgets │ │ Froca │ │ UI │ │ Froca[Froca<br/>Cache]
System │ │ Cache │ │ Services │ │ UIServices[UI<br/>Services]
└────────────┘ └────────────┘ └────────────┘ │ end
│ │
│ WebSocket / REST API │ subgraph Backend["Backend Server"]
│ │ Express[Express<br/>Routes]
└─────────────────────────┼────────────────────────────────────┘ Becca[Becca<br/>Cache]
ScriptEngine[Script<br/>Engine]
┌─────────────────────────┼────────────────────────────────────┐ Database[(SQLite<br/>Database)]
│ Backend Server │ end
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
Express │ │ Becca │ │ Script │ │ Widgets -.-> API[WebSocket / REST API]
Routes │ │ Cache │ │ Engine │ │ Froca -.-> API
└────────────┘ └────────────┘ └────────────┘ │ UIServices -.-> API
│ │ │ API -.-> Express
┌────┴─────┐ │ API -.-> Becca
│ │ SQLite │ │ API -.-> ScriptEngine
│ Database │ │ Becca --> Database
│ └──────────┘ │ Express --> Database
└─────────────────────────────────────────────────────────────┘ ScriptEngine --> Database
``` ```
### Deployment Modes ### Deployment Modes
@@ -225,30 +225,24 @@ Located at: `apps/server/src/share/`
Trilium's data model is based on five core entities: Trilium's data model is based on five core entities:
``` ```mermaid
┌──────────────────────────────────────────────────────────┐ graph TD
Note Tree │ Note[Note<br/>BNote]
│ │ Branch[Branch<br/>BBranch]
│ ┌─────────┐ │ Attribute[Attribute<br/>BAttribute]
│ Note │ │ Revision[Revision<br/>BRevision]
│ (BNote) │ │ Attachment[Attachment<br/>BAttachment]
└────┬────┘ │
│ │ │ Note -->|linked by| Branch
│ linked by │ Note -.->|metadata| Attribute
▼ │ Branch -->|creates| Revision
┌──────────┐ ┌─────────────┐ │ Note -->|has| Attachment
│ Branch │◄────────│ Attribute │ │
│ │(BBranch) │ │ (BAttribute)│ │ style Note fill:#e1f5ff
└──────────┘ └─────────────┘ │ style Branch fill:#fff4e1
│ │ style Attribute fill:#ffe1f5
│ │ creates │ style Revision fill:#f5ffe1
│ ▼ │ style Attachment fill:#ffe1e1
│ ┌──────────┐ ┌─────────────┐ │
│ │ Revision │ │ Attachment │ │
│ │(BRevision│ │(BAttachment)│ │
│ └──────────┘ └─────────────┘ │
│ │
└──────────────────────────────────────────────────────────┘
``` ```
#### Entity Definitions #### Entity Definitions
@@ -514,18 +508,29 @@ Key services:
### UI Components ### UI Components
**Main Layout:** **Main Layout:**
```
┌──────────────────────────────────────────────────────┐ ```mermaid
│ Title Bar │ graph TD
├──────────┬────────────────────────┬──────────────────┤ subgraph TriliumUI[" "]
│ │ │ TitleBar[Title Bar]
│ Note │ Note Detail │ Right Panel │
Tree Editor │ (Info, Links) │ subgraph MainArea[" "]
│ │ │ NoteTree[Note Tree]
│ │ │ │ NoteDetail[Note Detail<br/>Editor]
├──────────┴────────────────────────┴──────────────────┤ RightPanel[Right Panel<br/>Info, Links]
Status Bar │ end
└──────────────────────────────────────────────────────┘
StatusBar[Status Bar]
end
TitleBar -.-> MainArea
MainArea -.-> StatusBar
style TitleBar fill:#e1f5ff
style NoteTree fill:#fff4e1
style NoteDetail fill:#f5ffe1
style RightPanel fill:#ffe1f5
style StatusBar fill:#e1f5ff
``` ```
**Component Locations:** **Component Locations:**

42
docs/DATABASE.md vendored
View File

@@ -427,27 +427,27 @@ CREATE TABLE etapi_tokens (
## Data Relationships ## Data Relationships
``` ```mermaid
┌──────────────┐ graph TB
│ Notes │ Notes[Notes]
└───┬──────────┘ Branches[Branches]
Attributes[Attributes]
┌───────────┼───────────┐ Attachments[Attachments]
│ │ │ Blobs[(Blobs)]
▼ ▼ ▼ Revisions[Revisions]
┌────────┐ ┌──────────┐ ┌───────────┐
│Branches│ │Attributes│ │Attachments│ Notes --> Branches
└────────┘ └──────────┘ └─────┬─────┘ Notes --> Attributes
│ │ Notes --> Attachments
│ │ Notes --> Blobs
│ ┌──────────┐ │ Notes --> Revisions
└──────▶│ Blobs │◀────────┘
└──────────┘ Branches --> Blobs
Attachments --> Blobs
Revisions --> Blobs
┌────┴─────┐
│Revisions │ style Notes fill:#e1f5ff
└──────────┘ style Blobs fill:#ffe1e1
``` ```
**Relationships:** **Relationships:**

View File

@@ -14,29 +14,19 @@ Trilium implements a sophisticated **bidirectional synchronization system** that
## Sync Architecture ## Sync Architecture
``` ```mermaid
┌─────────────┐ ┌─────────────┐ graph TB
Desktop 1 │ │ Desktop 2 │ Desktop1[Desktop 1<br/>Client]
│ (Client) │ │ (Client) │ Desktop2[Desktop 2<br/>Client]
└──────┬──────┘ └──────┬──────┘
│ │ subgraph SyncServer["Sync Server"]
│ WebSocket/HTTP │ SyncService[Sync Service<br/>- Entity Change Management<br/>- Conflict Resolution<br/>- Version Tracking]
│ │ SyncDB[(Database<br/>entity_changes)]
▼ ▼ end
┌────────────────────────────────────────────────┐
Sync Server │ Desktop1 <-->|WebSocket/HTTP| SyncService
┌──────────────────────────────────────┐ │ Desktop2 <-->|WebSocket/HTTP| SyncService
│ │ Sync Service │ │ SyncService --> SyncDB
│ │ - Entity Change Management │ │
│ │ - Conflict Resolution │ │
│ │ - Version Tracking │ │
│ └──────────────────────────────────────┘ │
│ │ │
│ ┌──────┴───────┐ │
│ │ Database │ │
│ │ (entity_changes)│ │
│ └──────────────┘ │
└────────────────────────────────────────────────┘
``` ```
## Core Concepts ## Core Concepts