Deploy Trilium Notes self-hosted knowledge base with hierarchical note trees, relation maps, code notes, E2E encryption, and scripting support.
Why Trilium Notes?
Note apps store notes. Trilium builds a knowledge base:
- Hierarchical trees — Notes have children, forming deep structures.
- Cloning — A note can exist in multiple tree locations.
- Relation maps — Visual connections between concepts.
- Code notes — Syntax highlighting for 30+ languages.
- Scripting — Automate with server-side JavaScript.
- End-to-end encryption — Protect sensitive notes.
- Full-text search — Find anything instantly.
Prerequisites
- Docker on any machine.
- At least 256 MB RAM.
Step 1: Deploy with Docker
docker run -d \
--name trilium \
--restart=always \
-p 8080:8080 \
-v trilium-data:/home/node/trilium-data \
zadam/trilium:latest
Access at http://your-server:8080.
Step 2: Note Types
| Type |
Use Case |
Features |
| Text note |
General writing, documentation |
Rich text, markdown shortcuts |
| Code note |
Scripts, configs, snippets |
Syntax highlighting, execution |
| Relation map |
Concept visualization |
Visual node-and-edge diagrams |
| Book note |
Long-form content |
Ordered child notes as chapters |
| Canvas |
Diagrams, mind maps |
Freeform drawing |
| File note |
Attachments |
Store any file type |
Step 3: Knowledge Base Patterns
| Pattern |
Structure |
Use Case |
| Zettelkasten |
Atomic notes + relations |
Research, learning |
| Documentation wiki |
Hierarchical sections |
Team docs, SOPs |
| Personal journal |
Date-based tree |
Daily notes, reflection |
| Project tracker |
Project → tasks → notes |
Project management |
| Code library |
Language → category → snippets |
Developer reference |
Trilium vs Alternatives
| Feature |
Trilium |
Obsidian |
Notion |
Joplin |
| Self-hosted |
Yes (server) |
No (local files) |
No (cloud) |
Yes (sync only) |
| Hierarchical tree |
Deep trees |
Flat folders |
Pages + DBs |
Notebooks |
| Relation maps |
Built-in |
Plugin |
No |
No |
| Encryption |
E2E per note |
Vault-level |
No |
E2E |
| Scripting |
Server-side JS |
Plugins (JS) |
Formulas |
No |
| Code notes |
Yes |
Yes (markdown) |
Code blocks |
Yes |
| Cost |
Free |
Free / $8/mo sync |
Free / $10/mo |
Free |
Troubleshooting
| Problem |
Solution |
| Sync not working |
Check the sync server URL in desktop app settings; verify network connectivity |
| Note tree is slow |
Large databases (>50k notes) may need PostgreSQL backend instead of SQLite |
| Can’t find a note |
Use full-text search (Ctrl+S); check if note is in a protected subtree |
| Desktop app crashes |
Update to latest version; check Electron compatibility with your OS |
Summary
- Hierarchical knowledge base — not just notes, but structured knowledge.
- Relation maps visualize connections between concepts.
- Cloning lets a note exist in multiple tree locations.
- Self-hosted with E2E encryption for sensitive data.
Related Articles