Skip to content

Commit 0494032

Browse files
Copiloteliandoran
andcommitted
Convert ASCII diagrams to Mermaid.js format
Co-authored-by: eliandoran <[email protected]>
1 parent 07fe42d commit 0494032

File tree

3 files changed

+99
-104
lines changed

3 files changed

+99
-104
lines changed

docs/ARCHITECTURE.md

Lines changed: 65 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,30 @@ Trilium Notes is a hierarchical note-taking application built as a TypeScript mo
5353

5454
Trilium follows a **client-server architecture** even in desktop mode, where Electron runs both the backend server and frontend client within the same process.
5555

56-
```
57-
┌─────────────────────────────────────────────────────────────┐
58-
Frontend
59-
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
60-
│ │ Widgets │ │ Froca │ │ UI │ │
61-
│ │ System │ │ Cache │ │ Services │ │
62-
│ └────────────┘ └────────────┘ └────────────┘ │
63-
│ │
64-
WebSocket / REST API │
65-
│ │
66-
└─────────────────────────┼────────────────────────────────────┘
67-
68-
┌─────────────────────────┼────────────────────────────────────┐
69-
Backend Server │
70-
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
71-
│ │ Express │ │ Becca │ │ Script │ │
72-
│ │ Routes │ │ Cache │ │ Engine │ │
73-
│ └────────────┘ └────────────┘ └────────────┘ │
74-
│ │
75-
┌────┴─────┐ │
76-
│ SQLite │ │
77-
Database │ │
78-
└──────────┘ │
79-
└─────────────────────────────────────────────────────────────┘
56+
```mermaid
57+
graph TB
58+
subgraph Frontend
59+
Widgets[Widgets<br/>System]
60+
Froca[Froca<br/>Cache]
61+
UIServices[UI<br/>Services]
62+
end
63+
64+
subgraph Backend["Backend Server"]
65+
Express[Express<br/>Routes]
66+
Becca[Becca<br/>Cache]
67+
ScriptEngine[Script<br/>Engine]
68+
Database[(SQLite<br/>Database)]
69+
end
70+
71+
Widgets -.-> API[WebSocket / REST API]
72+
Froca -.-> API
73+
UIServices -.-> API
74+
API -.-> Express
75+
API -.-> Becca
76+
API -.-> ScriptEngine
77+
Becca --> Database
78+
Express --> Database
79+
ScriptEngine --> Database
8080
```
8181

8282
### Deployment Modes
@@ -225,30 +225,24 @@ Located at: `apps/server/src/share/`
225225

226226
Trilium's data model is based on five core entities:
227227

228-
```
229-
┌──────────────────────────────────────────────────────────┐
230-
│ Note Tree │
231-
│ │
232-
│ ┌─────────┐ │
233-
│ │ Note │ │
234-
│ │ (BNote) │ │
235-
│ └────┬────┘ │
236-
│ │ │
237-
│ │ linked by │
238-
│ ▼ │
239-
│ ┌──────────┐ ┌─────────────┐ │
240-
│ │ Branch │◄────────│ Attribute │ │
241-
│ │(BBranch) │ │ (BAttribute)│ │
242-
│ └──────────┘ └─────────────┘ │
243-
│ │ │
244-
│ │ creates │
245-
│ ▼ │
246-
│ ┌──────────┐ ┌─────────────┐ │
247-
│ │ Revision │ │ Attachment │ │
248-
│ │(BRevision│ │(BAttachment)│ │
249-
│ └──────────┘ └─────────────┘ │
250-
│ │
251-
└──────────────────────────────────────────────────────────┘
228+
```mermaid
229+
graph TD
230+
Note[Note<br/>BNote]
231+
Branch[Branch<br/>BBranch]
232+
Attribute[Attribute<br/>BAttribute]
233+
Revision[Revision<br/>BRevision]
234+
Attachment[Attachment<br/>BAttachment]
235+
236+
Note -->|linked by| Branch
237+
Note -.->|metadata| Attribute
238+
Branch -->|creates| Revision
239+
Note -->|has| Attachment
240+
241+
style Note fill:#e1f5ff
242+
style Branch fill:#fff4e1
243+
style Attribute fill:#ffe1f5
244+
style Revision fill:#f5ffe1
245+
style Attachment fill:#ffe1e1
252246
```
253247

254248
#### Entity Definitions
@@ -514,18 +508,29 @@ Key services:
514508
### UI Components
515509

516510
**Main Layout:**
517-
```
518-
┌──────────────────────────────────────────────────────┐
519-
│ Title Bar │
520-
├──────────┬────────────────────────┬──────────────────┤
521-
│ │ │ │
522-
│ Note │ Note Detail │ Right Panel │
523-
│ Tree │ Editor │ (Info, Links) │
524-
│ │ │ │
525-
│ │ │ │
526-
├──────────┴────────────────────────┴──────────────────┤
527-
│ Status Bar │
528-
└──────────────────────────────────────────────────────┘
511+
512+
```mermaid
513+
graph TD
514+
subgraph TriliumUI[" "]
515+
TitleBar[Title Bar]
516+
517+
subgraph MainArea[" "]
518+
NoteTree[Note Tree]
519+
NoteDetail[Note Detail<br/>Editor]
520+
RightPanel[Right Panel<br/>Info, Links]
521+
end
522+
523+
StatusBar[Status Bar]
524+
end
525+
526+
TitleBar -.-> MainArea
527+
MainArea -.-> StatusBar
528+
529+
style TitleBar fill:#e1f5ff
530+
style NoteTree fill:#fff4e1
531+
style NoteDetail fill:#f5ffe1
532+
style RightPanel fill:#ffe1f5
533+
style StatusBar fill:#e1f5ff
529534
```
530535

531536
**Component Locations:**

docs/DATABASE.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -427,27 +427,27 @@ CREATE TABLE etapi_tokens (
427427

428428
## Data Relationships
429429

430-
```
431-
┌──────────────┐
432-
Notes
433-
└───┬──────────┘
434-
435-
┌───────────┼───────────┐
436-
│ │ │
437-
▼ ▼ ▼
438-
┌────────┐ ┌──────────┐ ┌───────────┐
439-
│Branches│ │Attributes│ │Attachments│
440-
└────────┘ └──────────┘ └─────┬─────┘
441-
│ │
442-
│ │
443-
│ ┌──────────┐ │
444-
└──────▶│ Blobs │◀────────┘
445-
└──────────┘
446-
447-
448-
┌────┴─────┐
449-
│Revisions │
450-
└──────────┘
430+
```mermaid
431+
graph TB
432+
Notes[Notes]
433+
Branches[Branches]
434+
Attributes[Attributes]
435+
Attachments[Attachments]
436+
Blobs[(Blobs)]
437+
Revisions[Revisions]
438+
439+
Notes --> Branches
440+
Notes --> Attributes
441+
Notes --> Attachments
442+
Notes --> Blobs
443+
Notes --> Revisions
444+
445+
Branches --> Blobs
446+
Attachments --> Blobs
447+
Revisions --> Blobs
448+
449+
style Notes fill:#e1f5ff
450+
style Blobs fill:#ffe1e1
451451
```
452452

453453
**Relationships:**

docs/SYNCHRONIZATION.md

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,19 @@ Trilium implements a sophisticated **bidirectional synchronization system** that
1414

1515
## Sync Architecture
1616

17-
```
18-
┌─────────────┐ ┌─────────────┐
19-
│ Desktop 1 │ │ Desktop 2 │
20-
│ (Client) │ │ (Client) │
21-
└──────┬──────┘ └──────┬──────┘
22-
│ │
23-
│ WebSocket/HTTP │
24-
│ │
25-
▼ ▼
26-
┌────────────────────────────────────────────────┐
27-
│ Sync Server │
28-
│ ┌──────────────────────────────────────┐ │
29-
│ │ Sync Service │ │
30-
│ │ - Entity Change Management │ │
31-
│ │ - Conflict Resolution │ │
32-
│ │ - Version Tracking │ │
33-
│ └──────────────────────────────────────┘ │
34-
│ │ │
35-
│ ┌──────┴───────┐ │
36-
│ │ Database │ │
37-
│ │ (entity_changes)│ │
38-
│ └──────────────┘ │
39-
└────────────────────────────────────────────────┘
17+
```mermaid
18+
graph TB
19+
Desktop1[Desktop 1<br/>Client]
20+
Desktop2[Desktop 2<br/>Client]
21+
22+
subgraph SyncServer["Sync Server"]
23+
SyncService[Sync Service<br/>- Entity Change Management<br/>- Conflict Resolution<br/>- Version Tracking]
24+
SyncDB[(Database<br/>entity_changes)]
25+
end
26+
27+
Desktop1 <-->|WebSocket/HTTP| SyncService
28+
Desktop2 <-->|WebSocket/HTTP| SyncService
29+
SyncService --> SyncDB
4030
```
4131

4232
## Core Concepts

0 commit comments

Comments
 (0)