The mental model
Trilium's organizing concept is the note. Every note has:
- A type — text (rich HTML), code (with syntax highlighting), book (parent of children), mind-map, canvas (sketch), spreadsheet, geomap, web view, file, image
- Children — sub-notes form a tree under it
- Attributes — labels (key=value, e.g.
#tag=urgent) and relations (key=→note, e.g.~author=Note(Author Name)) - Backlinks — auto-tracked references
The labels + relations form a graph layered on top of the tree. Queries can find "all notes tagged urgent" or "all notes related to this author."
Install via Docker
docker run -d \
--name trilium \
--restart unless-stopped \
-p 127.0.0.1:8080:8080 \
-v ./data:/home/node/trilium-data \
triliumnext/notes:latest
First time setup at http://<host>:8080: create the admin password + initial root note.
Reverse proxy
# Caddy
notes.example.com {
reverse_proxy 127.0.0.1:8080
}
Desktop client (recommended)
While the server has a web UI, the Electron desktop client is the canonical way to interact — better keybindings, offline-first, syncs to the server. Download from the TriliumNext releases.
On first start: choose "connect to existing sync server" or "create new database." For a fleet, set up the server first, then point all desktop clients at it; the desktop is the editor + the server is the sync source-of-truth.
Attribute-driven queries
# Search syntax
#urgent # notes with the #urgent label
#priority >= 3 # notes with #priority label having a value >= 3
~author=Note(Bob) # notes related to the note named "Bob"
"deep learning" # full-text search
note.title %= "report" # regex on title
note.dateCreated >= 2025-01-01
# Combine
#book #read note.dateCreated >= 2025-01-01 # books I read this year
Save common searches as saved-search notes; they re-execute every time you open them, showing live results.
Code notes + scripting
Trilium has a built-in scripting engine. Create a code note in JavaScript; flag it with the #run label or as a "script note"; it can read / modify other notes via the API:
// A script note that creates today's daily journal entry
const api = require('api');
const today = api.getDayNote(new Date());
if (!today) {
const journal = api.getRootCalendarNote();
const newDaily = api.createNote(journal.noteId,
new Date().toISOString().slice(0, 10),
'## Today\n\n- ');
api.activateNote(newDaily.noteId);
}
Bind to a keyboard shortcut; "open today's daily" becomes one keystroke. Or schedule a script to run on a timer.
Templates
Mark a note with #template; child-creation flows can use it as a starting point. Combined with attributes + scripting, build per-domain note schemas: "Book" template with title / author / status / rating fields baked in.
Per-note encryption
Right-click a note → Protect. The note's content is now encrypted with your protected-session password; when the session times out, the note becomes unreadable until you re-enter the password. Per-note granularity; sensitive notes stay encrypted at rest in SQLite.
Sync
Run the server (Docker above); install desktop clients on N machines; they all sync to the server. Bidirectional, conflict-aware. Mobile support is read-mostly via the web UI (TriliumNext is improving mobile-native; check current release).
Import / export
# From the web UI: export entire subtree as HTML / Markdown / OPML / ZIP
# Standard backup: the SQLite document.db file in the data dir
docker compose exec trilium sqlite3 /home/node/trilium-data/document.db ".backup /tmp/backup.db"
The killer use case
Trilium's sweet spot: long-term personal knowledge bases that benefit from hierarchy + cross-references. Examples:
- Per-project notes — tree of "Project / Tasks / Decisions / Meeting Notes" with relations to "People" notes
- Reading list — "Books" tree, each note with author/year/status/rating labels, queryable as a database
- Recipe collection — "Recipes" tree, each labeled with cuisine / time / difficulty
- Research vault — papers + their citations as related notes; explore the citation graph
TriliumNext vs alternatives
- Obsidian — local-first markdown files; massive plugin ecosystem; commercial sync. Use for "I want plain-file-vault sovereignty"; Trilium is for "I want hierarchy + scripting."
- Logseq — outliner-style; bidirectional links; markdown-based. Different mental model.
- SilverBullet (see that tutorial) — wiki + markdown queries. Less hierarchy; more pure-markdown.
- Memos (see that tutorial) — timeline / Twitter-shaped; no hierarchy.
- Joplin — notebook + note + tag model; cross-platform; client-side encryption. Simpler than Trilium.
When TriliumNext is the right pick
- You want hierarchy as the primary organizer (not flat or tag-only).
- You're willing to learn the attributes + relations + query model to get power.
- You want scriptable notes (cron-style "auto-create today's journal entry") and templates for structured data.
When it isn't
- For plain markdown vaults, Obsidian / SilverBullet are simpler.
- For team collaboration, Outline (see that tutorial) is better.
- For low-friction quick-capture, Memos.