MCPSERV.CLUB
Trilium Notes

Trilium Notes

Self-Hosted

Hierarchical note‑taking for personal knowledge bases

Active(100)
32.3kstars
0views
Updated 1 day ago

Overview

Discover what makes Trilium Notes powerful

Trilium Next is a self‑hosted, open‑source note‑taking engine designed to scale from single users to large knowledge bases. At its core, the application exposes a **hierarchical data model** where notes can be nested arbitrarily deep and even referenced in multiple locations through cloning. The front‑end is a rich WYSIWYG editor that supports Markdown, tables, images and LaTeX math while keeping a lightweight DOM footprint. On the back‑end, Trilium stores notes in an **embedded SQLite** database, wrapped by a Node.js/Express API layer that implements fine‑grained access control, full‑text search (via SQLite FTS5), and real‑time collaboration over WebSocket. This architecture allows developers to run a single binary or Docker image on any modern OS, while still exposing a RESTful API for automation and integration.

Language & Runtime

Database

API Layer

Front‑end

Overview

Trilium Next is a self‑hosted, open‑source note‑taking engine designed to scale from single users to large knowledge bases. At its core, the application exposes a hierarchical data model where notes can be nested arbitrarily deep and even referenced in multiple locations through cloning. The front‑end is a rich WYSIWYG editor that supports Markdown, tables, images and LaTeX math while keeping a lightweight DOM footprint. On the back‑end, Trilium stores notes in an embedded SQLite database, wrapped by a Node.js/Express API layer that implements fine‑grained access control, full‑text search (via SQLite FTS5), and real‑time collaboration over WebSocket. This architecture allows developers to run a single binary or Docker image on any modern OS, while still exposing a RESTful API for automation and integration.

Architecture

  • Language & Runtime: Node.js (v18+), with most server logic written in TypeScript. The UI is built with React and Electron for desktop, but a pure web client exists as well.
  • Database: SQLite (v3.35+), leveraging FTS5 for full‑text search and R-tree for spatial queries (e.g., note relationships). The database is stored in a single file (trilium.db) making migrations trivial.
  • API Layer: Express.js exposes CRUD endpoints (/api/v1/notes, /api/v1/search) and WebSocket rooms for live editing. Authentication is token‑based (JWT) with optional OAuth2 integration.
  • Front‑end: React + Slate for the editor, powered by Electron on desktop and vanilla JavaScript on web. The client communicates over HTTPS/WebSocket to the same Express server.
  • Containerization: Official Docker images are available on Docker Hub (triliumnext/trilium). The image uses a multi‑stage build to keep runtime lightweight and exposes ports 8080 (HTTP) and 8443 (HTTPS).

Core Capabilities

  • Hierarchical Cloning: Notes can be duplicated across branches; changes propagate automatically, enabling “link‑by‑reference” workflows.
  • Rich Media & Math: The editor supports embedded images, SVGs, and LaTeX rendering via KaTeX.
  • Search & Tagging: Full‑text search powered by SQLite FTS5, with support for boolean queries and tag filters.
  • Scripting & Automation: A built‑in JavaScript console lets developers write custom plugins that hook into note events (onNoteCreate, onNoteUpdate). Plugins can expose new REST endpoints or WebSocket services.
  • Export & Import: Notes can be exported to Markdown, HTML, or a custom JSON format. Importers support various formats (Markdown, Evernote, OneNote).

Deployment & Infrastructure

Trilium is designed for easy self‑hosting. A single binary (or Docker container) runs on macOS, Linux, or Windows without external dependencies. For production, the recommended setup is:

  • Docker Compose: Spin up a single container with persistent volumes for the database and uploads.
  • Reverse Proxy: Nginx or Traefik can provide HTTPS termination, basic auth, and path‑based routing.
  • Scaling: While the current architecture is single‑instance, the SQLite file can be shared over a network filesystem for read‑only replicas. For write scaling, developers are encouraged to fork the project and replace SQLite with PostgreSQL.

Integration & Extensibility

  • REST API: All CRUD operations are exposed over /api/v1/*. Endpoints return JSON and support pagination, filtering, and bulk actions.
  • Webhooks: Developers can register webhook URLs that receive JSON payloads on note events, enabling integration with CI/CD pipelines or external services.
  • Plugin System: The plugins/ directory contains sample JavaScript modules that can be loaded at runtime. Plugins have full access to the Express app, allowing developers to add new UI components or background jobs.
  • SDKs: Although no official SDK exists, the API is straightforward enough that community wrappers in Python, Go, and Rust are available on GitHub.

Developer Experience

The project’s documentation is comprehensive, with an online portal (docs.triliumnotes.org), in‑app help (F1), and a detailed GitHub user guide. The codebase follows conventional TypeScript conventions, making it approachable for developers familiar with Node.js ecosystems. Community support is active on GitHub Discussions and a Discord server, where contributors discuss feature requests, bug reports, and architectural improvements. Licensing is MIT, giving developers full freedom to modify or embed Trilium in commercial products.

Use Cases

  • Personal Knowledge Management: A solo developer can host Trilium locally to maintain a searchable, hierarchical notebook of code snippets, research notes, and project documentation.
  • Team Collaboration: By exposing the REST API and WebSocket endpoints, teams can build custom dashboards or integrate Trilium into existing CI/CD pipelines to publish release notes automatically.
  • Educational Platforms: Educators can host Trilium on a campus server, using its tagging and search features to curate lecture notes and student submissions.
  • API‑First Applications: Developers building a knowledge graph service can use Trilium’s scripting hooks to push note updates into external databases or search indices.

Advantages

Trilium stands out for its **single

Open SourceReady to get started?

Join the community and start self-hosting Trilium Notes today