How triliumnext/trilium works
Trilium Notes is a cross-platform personal knowledge-base application. Users create and organize hierarchical notes, navigate and edit them in a client, and persist or synchronize them through a server-backed core; the desktop and standalone apps provide alternate runtime hosts. The graph also preserves documented capabilities such as search, imports, sharing, scripting, collections, and AI chat. Some feature links are documented rather than source-verified; these use the README as evidence, and unsampled internal wiring is intentionally omitted.
Main entry points: app_context.ts App context · tab_manager.ts Tab navigation · froca.ts Note data cache · routes.ts HTTP routes
Components 25
Note client
- App context
apps/client/src/components/app_context.ts - Tab navigation
apps/client/src/components/tab_manager.ts - Note context
apps/client/src/components/note_context.ts - Note widgets
apps/client/src/widgets/basic_widget.ts - HTTP client
apps/client/src/services/server.ts
Knowledge features
- Note model
apps/client/src/entities/fnote.ts - Note data cache
apps/client/src/services/froca.ts - Note tree
apps/client/src/services/tree.ts - Links and navigation
apps/client/src/services/link.ts - Full-text search
apps/client/src/services/search.ts - Collections
apps/client/src/widgets/collections - Import and export
apps/client/src/widgets/dialogs/import - Synchronization
apps/client/src/services/sync.ts
Server and core
- Server application
apps/server/src/app.ts - HTTP routes
apps/server/src/routes/routes.ts - Domain handlers
packages/trilium-core/src/services/handlers.ts - Public sharing
packages/trilium-core/src/share/handlers.ts - Knowledge database
packages/trilium-core/src
Runtime hosts
- Desktop host
apps/desktop/src/main.ts - Standalone host
apps/standalone/src/main.ts
Extensions
- Web clipper
apps/web-clipper/entrypoints/popup/main.tsx - AI chat
apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts - AI chat types
apps/client/src/widgets/type_widgets/llm_chat/llm_chat_types.ts
Other components
- Note taker
- LLM providers
Connections 28
- Note taker → App context: uses
- App context → Note data cache: initializes
apps/client/src/components/app_context.ts - App context → Tab navigation: loads tabs
apps/client/src/components/app_context.ts - App context → Note widgets: renders widgets
apps/client/src/components/app_context.ts - Tab navigation → Note context: creates contexts
apps/client/src/components/tab_manager.ts - Tab navigation → Note tree: resolves paths
apps/client/src/components/tab_manager.ts - Tab navigation → Note data cache: loads notes
apps/client/src/components/tab_manager.ts - Note context → Note widgets: executes widgets
apps/client/src/components/note_context.ts - Note model → Note data cache: loads note data
apps/client/src/entities/fnote.ts - Note model → HTTP client: requests updates
apps/client/src/entities/fnote.ts - Note data cache → HTTP client: fetches notes
apps/client/src/services/froca.ts - Links and navigation → Note context: opens notes
apps/client/src/services/link.ts - App context → HTTP client: uses options
apps/client/src/components/app_context.ts - Server application → HTTP routes: registers routes
apps/server/src/app.ts - HTTP routes → Domain handlers: mounts core routes
apps/server/src/routes/routes.ts - HTTP routes → Public sharing: mounts share routes
apps/server/src/routes/routes.ts - Domain handlers → Knowledge database: accesses data
packages/trilium-core/src/services/handlers.ts - Public sharing → Knowledge database: reads shared notes
packages/trilium-core/src/share/handlers.ts - Desktop host → Knowledge database: initializes core
apps/desktop/src/main.ts - Standalone host → App context: starts client
apps/standalone/src/main.ts - Web clipper → Server application: saves web content
- AI chat → LLM providers: streams completions
apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts - AI chat → AI chat types: uses chat types
apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts - Note taker → Full-text search: searches notes
- Note taker → Collections: organizes notes
- Note taker → Import and export: imports content
- Note taker → Synchronization: synchronizes notes
- Note taker → AI chat: asks questions