Deployment targets and operations
Trilium can run as a network server, a browser-only local application, or a native desktop application. The deployment system turns shared product features into these targets and provides backup, optional resource, and diagnostic tools for operating them when the normal application path is not enough. This page extends Build, release, and deployment with target-specific packaging and operations; see Build and release automation, Standalone browser runtime, and Platform clients for related views.
Deployment target model
The targets share product behavior but differ in where the database runs and how the user starts the application. The server uses Node and SQLite on the host or in a container. Standalone runs SQLite in the browser. Desktop packages the server and client inside Electron. Mobile packages the standalone client inside Capacitor, while the web clipper and website remain separate browser-facing outputs.
This diagram shows how the shared product becomes the main deployment outputs.
flowchart LR
Shared[Shared client and core features] --> Server[Node server]
Shared --> Standalone[Standalone browser app]
Shared --> Desktop[Electron desktop app]
Standalone --> Mobile[Capacitor mobile app]
Shared --> Web[Website and web clipper]
Server --> Containers[Debian and Alpine containers]
Server --> Archive[Standalone server archive]
Standalone --> Static[Static web deployment]
Desktop --> Installers[Native installers and archives]
Server containers
The server container targets provide a web-accessible Trilium instance with persistent data and a health check. Debian and Alpine images use compatible prebuilt SQLite binaries for their C libraries. The legacy image compiles SQLite for platforms that lack a compatible native build. All images can also run under a non-root identity supplied by the container runtime.
The server package exposes explicit build and start commands for the Debian and Alpine targets. It also separates production builds, server archives, local production starts, tests, and local proxy runs. The container package keeps the native SQLite dependency in the container-specific packaging boundary, while the server package declares the shared @triliumnext/backup-container package used by server-side work.
| Variant | Deployment goal |
|---|---|
| Debian | General Linux container support with glibc and bundled SQLite builds. |
| Alpine | A smaller Linux container based on the supported musl release. |
| Non-root runtime | Run an image without a root process and align access with mounted data. |
| Legacy | Support older hosts and 32-bit ARM by compiling the SQLite add-on during the image build. |
The Debian image uses Node 24 on Debian trixie because the supported SQLite binaries need newer glibc. The standard Alpine image is pinned to Alpine 3.23 because later musl behavior can fail on hosts with older seccomp support. The legacy image stays on Node 22 and Debian bookworm so it can serve older hosts and compile the native add-on when no prebuild exists. All variants expose port 8080.
Container startup uses /home/node/trilium-data as its default data location. When the process starts as root, the startup script can align the application user with USER_UID and USER_GID. When the runtime already supplies a non-root user, the process keeps that identity. The non-root check script tests both the image user and an arbitrary user with a read-only root file system, no capabilities, and a mounted data volume.
The server resolves data locations in this order: TRILIUM_DATA_DIR, an existing trilium-data directory in the home directory, the platform application-data directory, and then a new home-directory directory. It derives the database, backup, log, temporary, configuration, OCR, anonymized-database, and downloaded-resource locations from that base unless a specific setting overrides them. Before startup, it checks that existing entries are readable and writable as needed. A permission error stops startup with the process identity, affected paths, ownership details, and a repair hint.
References: apps/…/Dockerfile• L1-35 apps/…/Dockerfile.alpine• L1-33 apps/…/Dockerfile.legacy• L1-57 apps/…/start-docker.sh• L1-16 apps/…/check-docker-non-root.sh• L1-85 apps/…/data_dir.ts• L1-7 apps/…/data_dir.ts• L16-59 apps/…/data_dir.ts• L61-179 apps/…/package.json• L13-28 apps/…/package.json• L47-52 apps/…/package.json• L1-5
Server health contract
The server publishes the address that it actually binds after it begins listening. The container probe reads this target from the data directory and checks /api/health-check, so the probe does not need to repeat the server's network configuration.
For a TCP listener, the server records the correct HTTP or HTTPS URL and maps wildcard binds to loopback for an in-container probe. For a Unix socket, it records a local URL and the socket path separately. It replaces old target files before writing new ones, which lets a later run recover from files owned by a different user. A missing listener, a failed request, or any response other than 200 makes the container unhealthy.
References: apps/…/healthcheck.ts• L5-60 apps/…/healthcheck.spec.ts• L17-105 apps/…/healthcheck.spec.ts• L109-215 apps/…/Dockerfile• L29-35 apps/…/Dockerfile.alpine• L27-33 apps/…/Dockerfile.legacy• L51-57
Server archives and startup assets
The server build creates a self-contained dist directory before packaging. It combines bundled server entry points with the web client, PDF viewer, server resources, database schema, skill files, theme files, and the native SQLite dependency so a release can start without the workspace layout.
The archive builder adds a matching Node runtime and a small launcher. It names the archive by version and Linux architecture. Container images consume the same server build but supply their own Node base image and startup script. This keeps archive and container releases aligned while allowing different host constraints. Documentation build and editing tools provide the source and editing workflows for guide content that can become part of these packaged assets.
References: apps/…/build.ts• L3-31 apps/…/build-server.sh• L8-59 scripts/build-utils.ts• L6-19 scripts/build-utils.ts• L120-143 apps/…/package.json• L13-19 apps/…/package.json• L1-25 apps/…/package.json• L1-25
Managed resource assets
The server can manage optional feature resources that are too large or too platform-specific to ship in the main package. A resource definition describes its files, source URLs, checksums, size, license, and attribution. The resource manager downloads files into the data directory and exposes their status and progress through the server API.
The download boundary protects interrupted or altered files. A file becomes active only after its size and SHA-256 match the definition. Resource directories include a content-derived name and a license notice. The manager can resume partial downloads, report free space, cancel work, and identify outdated or unknown entries.
Desktop uses the same manager for local resources such as transcription models. Electron routes these downloads through its network client so system proxy settings apply. The resource API lets clients inspect, download, cancel, and remove registered or foreign resource entries.
References: apps/…/resources.ts• L16-37 apps/…/resources.ts• L120-185 apps/…/resources.ts• L234-340 apps/…/resources.ts• L413-494 apps/…/resources.ts• L7-41 apps/…/routes.ts• L201-205 apps/…/resources.spec.ts• L80-167 apps/…/request.ts• L1-43
Application packaging
Standalone and desktop packaging solve different distribution needs. Standalone is a static browser deployment that keeps its data in browser storage. Desktop is an installed native shell that embeds the same application services and adds operating-system launch and installer behavior. Mobile reuses the standalone output instead of creating a separate application runtime.
Standalone browser package
The standalone package delivers Trilium as static files that a browser can serve over HTTPS or localhost. A local worker runs the database and application routes. The package uses SQLite WebAssembly and the shared @triliumnext/backup-container package so browser storage and backup exchange follow the same product boundary as the other targets.
Persistent browser data uses the Origin Private File System through the SQLite storage pool when the browser supports it. The provider also supports an in-memory database and serialized database data for temporary or import and restore flows. It does not depend on direct filesystem paths, so the browser target keeps file delivery and database persistence as separate concerns.
The browser crypto provider keeps hashes, HMAC, key derivation, and AES operations byte-compatible with the Node provider. This lets protected notes and encrypted backup data move between server, desktop, and browser targets without changing their integrity rules. It also uses a native base64 path when the WebView supports one and a bounded JavaScript path for older WebViews.
Only one tab owns the local database. Other tabs use the service-worker bridge on web deployments, which prevents two workers from opening the same browser database. A Capacitor shell can instead use a native request bridge for local GET and HEAD resources when the shell provides one. Requests with bodies continue through the page-to-worker path. The worker can also send outbound HTTP through a native handler when the shell needs to bypass browser CORS and cookie limits. In a normal browser, the Fetch API remains subject to same-origin and CORS rules. The bridge keeps the application request contract the same across browser and mobile shells. The package also supports browser backup download and restore flows, including streamed data movement rather than staging the whole database in page memory.
The browser route surface adapts shared server routes to the local database. It preserves common request and response behavior for JSON, uploads, media ranges, share pages, and custom handlers while omitting network-only authentication. Synchronous handlers use the browser database transaction boundary, while asynchronous handlers keep an exclusive database lock until their work completes. Raw response bodies, headers, status codes, streams, and HEAD behavior remain available to shared handlers. Browser imports can read uploaded ZIP files from a Blob in place, and browser ZIP output is built in memory. The provider reads archive entries by byte range, handles ZIP64 metadata and common legacy filename encodings, limits inflated entry size, and accepts only supported unencrypted entries. It does not provide a filesystem path stream.
The standalone route set also includes browser-only operations that do not fit the shared server route table. These include local LLM stream control, database integrity and consistency checks, published share pages, and custom request handlers. A custom handler must finish before the browser response is sent; a handler that does not answer receives a server error, while resource providers remain available when backend script execution is disabled. Local LLM skill sheets are bundled with the browser worker because this target has no server resource directory.
The build copies the SQLite WebAssembly runtime, client resources, server resources, in-app help content and attachments, share-page assets, PDF viewer assets, and the web manifest into the static output. Help navigation metadata is bundled from the server asset set, while rendered help content and non-markdown guide assets are served under server-assets/help. The markdown source itself is not needed at runtime. Content hashes keep build assets from being mixed across deployments, while the service worker keeps its own URL stable so existing browser registrations continue to work.
The entry page keeps the startup splash screen inline so it appears before scripts and style sheets load. It reports startup state and hides itself when startup ends. The local production preview can use the normal preview host or bind to loopback for a local-only launch. The package defines this lifecycle through Vite build, development, test, coverage, end-to-end, and two production-preview commands. The preview commands differ in whether the host is exposed or restricted to 127.0.0.1.
References: apps/…/main.ts• L38-75 apps/…/main.ts• L94-142 apps/…/sw.ts• L110-303 apps/…/sw.ts• L390-449 apps/…/local-bridge.ts• L47-101 apps/…/local-bridge.ts• L193-252 apps/…/local-bridge.ts• L265-363 apps/…/browser_router.ts• L155-200 apps/…/browser_router.ts• L255-368 apps/…/browser_routes.ts• L77-171 apps/…/browser_routes.ts• L329-398 apps/…/browser_routes.ts• L485-523 apps/…/crypto_provider.ts• L19-74 apps/…/crypto_provider.ts• L88-125 apps/…/zip_provider.ts• L57-127 apps/…/zip_provider.ts• L167-303 apps/…/zip_provider.ts• L315-395 apps/…/sql_provider.ts• L298-400 apps/…/sql_provider.ts• L442-523 apps/…/llm_skills.ts• L9-34 apps/…/request_provider.ts• L109-157 apps/…/index.html• L1-159 apps/…/vite.config.mts• L105-121 apps/…/vite.config.mts• L123-191 apps/…/vite.config.mts• L212-240 apps/…/vite.config.mts• L437-475 apps/…/package.json• L7-14 apps/…/package.json• L16-30 apps/…/package.json• L8-23
Native mobile request bridge
The native request bridge lets Android and iOS shells serve local Trilium requests when a service worker cannot control the WebView. The shell forwards eligible resource requests to the page, the page answers them from the local worker, and the result returns as a header followed by bounded binary or base64 chunks.
The bridge handles local API and shared-note paths only. It leaves normal static resources to the shell and converts redirects into a small navigation response because the native response channels do not carry redirects. The startup path uses this bridge when available, removes stale service workers from older mobile builds, and falls back to the service-worker bridge when the shell has no native channel. Body-bearing requests stay in the page-to-worker path because the native interceptor cannot read their bodies. The Capacitor package builds and synchronizes this standalone output for Android and iOS.
References: apps/…/native-request-bridge.ts• L1-39 apps/…/native-request-bridge.ts• L63-123 apps/…/native-request-bridge.ts• L127-151 apps/…/main.ts• L98-140 apps/…/sw.ts• L13-21 apps/…/sw.ts• L396-433 apps/…/native-request-bridge.spec.ts• L78-121 apps/…/native-request-bridge.spec.ts• L130-184 apps/…/package.json• L8-23
Browser transcription prototype
The standalone transcription prototype tests whether local meeting transcription can run in a browser. It is outside the standalone build and uses its own local server, so it is a feasibility tool rather than a shipped standalone feature.
The prototype downloads pinned speech models into Origin Private File System storage. A web worker loads them into WebAssembly and processes clips or microphone and tab audio without blocking the page. Its results show the main browser limits that still need review before product integration: model size, memory use, browser audio support, and storage persistence.
References: apps/…/README.md• L1-15 apps/…/fetch-assets.mjs• L1-30 apps/…/main.js• L1-18 apps/…/main.js• L72-91 apps/…/worker.js• L1-18 apps/…/worker.js• L40-126 apps/…/serve.mjs• L1-39
Desktop package
The desktop package wraps the application in Electron and produces native installers or distributable archives. It assembles Electron startup code with the browser client, embedded server services, native SQLite support, shared resources, and platform assets. On Linux, the desktop entry template connects package metadata to the launcher name, icon, categories, and file-type associations.
The desktop build keeps the shell's startup bundles separate from code that loads on demand. It also includes the server-side image worker, transcription worker, shared schema, skill, theme, and client assets so the installed app does not depend on the source tree. Electron's Linux runtime uses the glibc SQLite target rather than the musl target. Platform-specific speech packages are included when the target provides them; a target without one does not claim local transcription support.
Electron Forge produces Linux Debian, RPM, Flatpak, and ZIP outputs plus Windows Squirrel, macOS DMG, and general ZIP outputs. A separate AppImage step converts an already packaged Linux app into a portable AppImage. The packaging rules keep release and nightly branding separate and gather maker artifacts into one upload directory. Nightly versioning adds a time-based test suffix so aggressive caches do not mix nightly assets with an earlier build.
Packaging trims Electron's locale files to the locales exposed by Trilium. The locale catalog is pinned to the Electron major version and records the platform-specific Linux, Windows, and macOS file names. The trim check supports the different file forms used by macOS and other platforms, and it fails the package when a required locale is missing. This reduces release size without letting a package silently lose a supported UI language.
The Flatpak target runs in the Freedesktop 25.08 sandbox and uses an Electron base app. Its manifest builds from pinned source and offline package inputs, then installs the desktop entry, app metadata, icons, launcher, and packaged application. The local Flatpak workflow uses a separate .Test application ID, so it can run beside the release and keep its own data and autostart state. The packaging scripts regenerate pinned package sources when the lockfile changes.
The package also ships launch helpers for portable data beside the executable, GPU-safe startup, and a deliberate TLS certificate bypass for controlled troubleshooting. The certificate bypass weakens certificate checks and must not be treated as a normal deployment mode. Its package commands keep development starts, production starts, end-to-end runs, installer or archive creation, Flatpak creation, and packaged smoke checks as separate workflows.
The packaged check moves the application outside the repository, checks that external dependencies are inside the archive, starts it with clean environment values and temporary data, and waits for its HTTP server. This catches missing startup assets that a workspace run can hide through parent-directory module resolution.
Desktop messaging follows the security setting for LAN access. With LAN access off, the trusted Electron renderer uses IPC and the desktop does not bind a WebSocket endpoint. With LAN access on, the desktop adds an authenticated WebSocket transport for browser clients while keeping IPC for its own renderer. This lets the embedded server support network clients without exposing that path by default.
References: apps/…/build.ts• L7-45 apps/…/build.ts• L47-71 apps/…/trim-locales.ts• L1-79 apps/…/trim-locales.spec.ts• L33-80 apps/…/electron-locales.json• L1-398 apps/…/forge.config.ts• L12-77 apps/…/forge.config.ts• L78-181 apps/…/forge.config.ts• L197-255 apps/…/tsconfig.forge.json• L14-20 apps/…/package.json• L13-32 apps/…/test-packaged.ts• L1-16 apps/…/test-packaged.ts• L54-71 apps/…/test-packaged.ts• L116-180 apps/…/test-packaged.ts• L201-247 apps/…/org.triliumnotes.Trilium.yml• L1-87 apps/…/trilium.sh• L1-16 scripts/…/build-local.mts• L1-17 scripts/…/build-local.mts• L42-62 scripts/…/generate-sources.mts• L1-15 scripts/…/update-repo.mts• L1-18 scripts/update-nightly-version.ts• L4-12 apps/…/composite_messaging_provider.ts• L16-69 apps/…/ws_messaging_provider.ts• L12-39
Desktop startup behavior
Desktop startup restores the local database and embedded server before serving the application through the Electron protocol. It also handles setup mode, a single running instance, window focus, tray behavior, platform settings, and startup metrics so packaged and development launches follow the same product lifecycle.
The application can start with the operating system. Windows and macOS use native login-item settings. Linux uses a per-user desktop entry, while Flatpak asks the Background portal because the sandbox cannot write the host autostart directory. The stored launch and hide-on-start settings are reconciled on each ready boot, and a second launch focuses the existing instance or opens a requested new window.
The desktop also keeps the main window's size, position, maximized state, and full-screen state across launches. It drops a saved position when no connected display shows enough of the window, then uses the normal default placement. A hidden login start delays state management until the window is revealed so the saved state does not show a startup flash.
References: apps/…/main.ts• L53-87 apps/…/main.ts• L117-165 apps/…/main.ts• L203-225 apps/…/main.ts• L351-427 apps/…/auto_launch.ts• L8-67 apps/…/auto_launch.ts• L69-121 apps/…/window.ts• L112-198 apps/…/window_state.ts• L21-70 apps/…/window_state.ts• L72-131 apps/…/auto_launch.spec.ts• L102-237 apps/…/main.spec.ts• L345-384 apps/…/window_state.spec.ts• L72-168
Desktop renderer bridge
The desktop renderer bridge exposes a limited electronApi surface instead of giving page code direct Electron access. It carries window, shell, printing, import, restore, security, backup-passphrase, transcription, navigation, and messaging requests across IPC while keeping sensitive values in the main process.
The bridge treats dropped files as capabilities: it forwards only paths that Electron resolves from real user-supplied files. The shell handlers validate paths against approved application roots, restrict external URLs to allowed schemes, reject UNC file URLs, and allow downloads only from the renderer's own origin. These checks keep renderer compromise from becoming arbitrary file access or OS command execution. The tests cover both the exposed bridge contract and the platform-specific application chooser behavior.
References: apps/…/preload.ts• L14-117 apps/…/preload.ts• L132-150 apps/…/preload.ts• L220-287 apps/…/preload.ts• L290-359 apps/…/shell.ts• L40-105 apps/…/shell.ts• L109-231 apps/…/shell.ts• L235-327 apps/…/shell.ts• L330-455 apps/…/preload.spec.ts• L66-150 apps/…/preload.spec.ts• L602-652 apps/…/preload.spec.ts• L674-744 apps/…/shell_handlers.spec.ts• L99-191 apps/…/shell_handlers.spec.ts• L193-324
Desktop local transcription
Desktop can provide local meeting transcription when the target has its native speech engine and the user has downloaded the required models. The feature captures audio in a separate page and sends it to a per-recording utility process. That process performs speech detection, optional speaker separation, and transcription while the main process writes utterances into a note.
The same resource boundary controls model availability and reports download state to the client. The feature can keep audio and transcript files beside a recording when retention is enabled. Stop and quit paths wait for queued speech for a bounded time, while failed saves remain available for a later retry when a protected note becomes writable.
References: apps/…/index.ts• L15-64 apps/…/index.ts• L66-119 apps/…/index.ts• L122-164 apps/…/worker_client.ts• L24-73 apps/…/transcription_worker.ts• L1-5 apps/…/transcription_worker.ts• L50-90 apps/…/protocol.ts• L3-57 apps/…/audio_recorder.ts• L8-20
Backup container support
The backup container is a shared file format for moving a SQLite database between server, desktop, standalone, and browser environments. It wraps one database with optional gzip compression and optional AES-256-GCM encryption. It supports streaming in both Node and browser runtimes.
Backup creation and restore
The server first takes a database snapshot. It writes the container to a temporary file and renames it only after success. This keeps an incomplete file out of the backup list and avoids placing an unwrapped database in the backup directory during creation.
Standalone uses the browser form of the same format. Its browser crypto provider preserves the byte-level rules used by the Node provider for encrypted and integrity-checked content. Restore sends the selected file to the database-owning worker, while web download streams the live database through the service worker to the browser's download manager. A Capacitor shell consumes the same stream in the page and writes a complete file to the app's documents area before opening the system share sheet. This path also works on iOS, where a service worker cannot be registered. A passphrase stays in the local worker message path and is not placed in a download URL.
This sequence shows how an application creates a safe backup and later restores it.
sequenceDiagram
participant User
participant App as Server or standalone app
participant Container as Backup container
participant Store as Backup storage
User->>App: Request backup
App->>Container: Stream database snapshot
Container->>Store: Write temporary container
Store-->>App: Rename after success
User->>App: Select backup for restore
App->>Container: Validate and unwrap stream
Container-->>App: Restore SQLite database
The Node and web entry points share the format and validation rules. The container can describe its version, compression state, encryption state, size, and creation time from its header without opening the payload. Readers reject bad authentication, damaged data, truncated files, unsupported versions, and output that exceeds the configured limit.
References: packages/…/README.md• L1-10 packages/…/index.ts• L1-12 packages/…/web.ts• L1-12 packages/…/write.ts• L73-86 packages/…/read.ts• L38-60 apps/…/backup_provider.ts• L380-405 apps/…/backup_provider.ts• L408-440 apps/…/package.json• L47-52 apps/…/local-bridge.ts• L63-100 apps/…/local-bridge.ts• L193-252 apps/…/local-bridge.ts• L265-363 apps/…/sw.ts• L305-387 apps/…/crypto_provider.ts• L19-74 apps/…/capacitor_download.ts• L85-107 apps/…/capacitor_download.ts• L149-198 apps/…/package.json• L16-30
Backup operating boundaries
The format is an interchange layer, not a backup schedule or a cloud store. The server owns backup file placement and naming. Standalone owns browser storage and download delivery. Both callers must decide when to make a backup, where to keep it, and how to protect the passphrase.
Encrypted browser backups require a secure context such as HTTPS or localhost. A wrong passphrase and a damaged encrypted header have the same format-level result, while a damaged payload fails during frame or digest checks. Callers should map these stable error reasons to user messages rather than display internal error text.
References: packages/…/README.md• L98-104 packages/…/README.md• L130-169 apps/…/main.ts• L6-42 apps/…/database_restore.ts• L184-190 apps/…/database_restore.ts• L557-565
Operational utilities
The repository includes small tools for cases where normal application access is not enough. They compare database state, recover note content from a database, deploy scripts into a development instance, and keep platform icon assets in sync.
Database comparison
The database comparison tool compares two SQLite files in read-only mode and reports missing rows, row-count differences, and changed values across selected Trilium tables. It is intended for sync debugging rather than migration or repair.
The current comparison queries target the legacy v214 database structure. When a table is absent because the two files use different schema versions, the tool skips that table and continues with the remaining comparisons. Treat its output as evidence for investigation, not as a complete comparison of current database schemas.
References: apps/…/README.md• L1-17 apps/…/compare.ts• L21-44 apps/…/compare.ts• L50-90 apps/…/comparator.ts• L29-79 apps/…/comparator.ts• L97-143
Database dump recovery
The dump tool is a last-resort path for extracting note content when the main Trilium application cannot provide access. It opens document.db read-only and writes a file tree that follows the note hierarchy.
The tool can decrypt protected notes when given the correct password and can include deleted notes when explicitly requested. It sanitizes and shortens names, handles repeated note placements, preserves note-type file extensions, and prints counts for successful, failed, protected, and deleted notes. It does not repair the database or recreate a working Trilium instance.
References: apps/…/README.md• L1-34 apps/…/main.ts• L5-35 apps/…/dump.ts• L8-27 apps/…/dump.ts• L29-118 apps/…/dump.ts• L122-163 apps/…/data_key.ts• L5-20 apps/…/sql.ts• L5-19
Script deployment harness
The script-deployer app is a development harness that starts a separate local Trilium instance and turns source files into script notes. It creates a clean database on first use, creates an ETAPI token for the session, ensures a Scripts folder exists, and then deploys recognized files.
Each script needs @trilium-script metadata with an id, type, and title. TypeScript files are converted to runnable JavaScript before deployment. Existing script notes are updated by stable id, while render scripts create a render note linked to a code note. A file watcher then updates code and refreshes open render contexts during development.
References: apps/…/dev.ts• L1-7 apps/…/dev.ts• L14-29 apps/…/dev.ts• L36-70 apps/…/dev.ts• L72-117 apps/…/dev.ts• L119-187 apps/…/deploy.ts• L11-20 apps/…/deploy.ts• L31-72 apps/…/deploy.ts• L75-95 apps/…/deploy.ts• L166-231
Icon packaging
The icon tools turn shared SVG brand assets into the raster and platform formats needed by desktop installers, tray menus, server assets, mobile packages, and the web app Home Screen icon. The icon-pack-builder app supplies a separate icon source and font preparation workflow for shared icon assets. These tools also create development and installer variants so packaged builds can show the correct identity.
The generation path needs ImageMagick, Inkscape, and icnsutil. It creates desktop, server, web, iOS, and Android assets in one pass, including adaptive and monochrome Android layers. The web app icon uses an opaque background so iOS does not render transparency as a black Home Screen tile. A separate manifest comparison tool checks icon-key changes between the Boxicons v2 and v3 manifests. These tools prepare package assets; they do not change application icon behavior at runtime.
References: scripts/…/create-icons.sh• L1-24 scripts/…/create-icons.sh• L26-89 scripts/…/create-icons.sh• L91-160 scripts/…/build-icons.sh• L1-38 scripts/…/compare_icons.ts• L1-24 apps/…/package.json• L1-24 apps/…/forge.config.ts• L15-23 apps/…/package.json• L16-23
Change checklist
When these files or sections are changed, remember to consider these:
- A server resource or schema path added to the source tree must also reach the bundled server and desktop
distdirectories. Container builds and Electron builds consume those packaged outputs rather than workspace paths. - A change to server startup, data-directory checks, or health-target files must preserve the mounted data path, the recorded URL and socket names, and the user identity that must read and replace them.
- A change to the SQLite native target must preserve the libc and architecture contract for Debian, Alpine, legacy ARM, standalone WebAssembly, and Electron artifacts. The server and desktop trim different native variants.
- A backup-container format change must remain readable through both the Node and web entry points. Update server backup handling and standalone restore and download behavior together.
- A new backup error reason must remain stable across the container package, server restore mapping, and standalone restore mapping. User-facing text belongs in the caller.
- A change to standalone startup assets or cache rules must preserve the inline startup path, the stable service-worker URL, and the content-hash boundary that prevents mixed builds.
- A change to standalone help metadata, rendered content, or guide attachments must keep the bundled navigation data, fetched content bundle, and
server-assets/helppaths in agreement. - A change to the standalone local route surface must preserve the shared request and response contract for uploads, raw media responses, share pages, custom handlers, and database locking.
- A change to standalone route registration must keep synchronous and asynchronous transaction boundaries distinct. Custom handlers must remain awaitable, must support the methods exposed by the server, and must produce a complete response before the worker returns it.
- The local API path list must stay aligned across the service worker, page bridge, and native mobile request bridge. A path added to one path leaves another target on the wrong network or static path.
- Changes to native mobile request framing, redirect handling, or request-body support must stay aligned with the Android and iOS shell channels. GET and HEAD interception must not be treated as body-capable requests.
- A browser ZIP capability change must preserve Blob range reads, ZIP64 handling, filename decoding, supported compression forms, entry-size limits, and the explicit lack of filesystem path streams.
- Browser crypto changes must preserve byte-level parity with the Node provider for binary hashes, HMAC, scrypt, AES operations, and base64 data. A text conversion can silently break protected notes or encrypted backups.
- A mobile download or backup change must preserve the distinction between scratch downloads and durable backups. Write the complete file before replacement and before opening the share sheet.
- A script metadata or note-id change must preserve compatibility between initial deployment, file-watch updates, render-note relations, and the ETAPI-backed development instance.
- A source icon change must be followed through desktop installer icons, tray images, server icon assets, mobile launcher assets, and the web app Home Screen icon. Generated output is part of the packaging contract.
- A resource definition change must keep its file sizes, hashes, source URLs, license notice, and content-derived directory name in agreement. Desktop model registration and the resource API use the same identity.
- A desktop bundle change must pass outside-repository dependency checks. Native packages, worker entry points, preload paths, and copied assets must work without workspace module resolution.
- A desktop locale catalog or keep-list change must stay aligned with the pinned Electron major, the UI locale catalog, and the file names used by each Electron platform. Packaging must still fail when a supported locale is absent.
- A desktop window startup change must keep saved bounds safe across display changes and must not apply hidden-window state before the window is intentionally revealed.
- A desktop shell or preload change must keep the exposed IPC methods, main-process handlers, input validators, and security-sensitive data flow aligned. Do not return backup passphrases to the renderer or allow renderer-supplied paths to bypass approved roots.
- A desktop transcription protocol change must keep the preload API, main-process handlers, capture page, utility process, and packaged worker in agreement. Target platforms without a native speech package must remain explicitly unsupported.
- The standalone transcription prototype must stay separate from the production Vite build and its own service-worker origin. Its pinned model and WebAssembly assets are an experiment, not a release asset.
- A Flatpak manifest or lockfile change must keep the pinned source revision, offline package sources, architecture-specific pnpm inputs, installed desktop metadata, launcher, and icon IDs aligned. The local test build must keep its separate application ID.
- A desktop LAN-access change must keep the IPC-only default, the authenticated WebSocket transport, and the session-revocation disconnect path consistent.
- A desktop autostart change must keep native login items, Linux desktop entries, Flatpak Background portal requests, and the
--start-hiddenbehavior aligned. - A standalone persistent-storage change must preserve the database-worker ownership rule and wait for old OPFS access handles to release before replacing a browser database.
- A change to the standalone package scripts must keep the production preview modes distinct: the normal preview must remain usable for hosted testing, while the loopback mode must remain local-only.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A container starts with a user that cannot enter or write the mounted data directory | Startup stops with a permission explanation, or SQLite later cannot write | Match the runtime identity and mounted-directory ownership. Use the non-root check under the same restrictions as the target platform. |
| A deployment uses a server image with an incompatible SQLite native build | The process can fail while loading SQLite before the server is usable | Use the matching Debian, Alpine, legacy, or architecture target and let packaging validate the native artifact. |
The server cannot replace its health target files or does not return 200 from the probe | Docker marks a running container unhealthy | Keep the data directory writable and make the recorded endpoint answer successfully through its socket or URL. |
| A resource file is changed after verification or its source sends the wrong size or hash | The feature remains unavailable or the download fails | Keep the definition checksum and size current. Let the manager install only verified files and retain partial work for retry. |
| Standalone runs on the web without service-worker support or from an insecure non-local origin, and no native shell bridge is available | The local database bridge cannot start and the app shows an initialization error | Serve the web app over HTTPS or localhost in a browser with service workers enabled. Use the native bridge only in a shell that provides it. |
| A browser reload starts a new worker while the old worker still holds OPFS access handles | Database startup can fail or a recovery path can remove the wrong storage pool | Wait for the old pool handles to release before installing or opening the persistent browser database. |
| A native shell intercepts a local path that is absent from the shared local-path lists | The request reaches static hosting or the wrong native path instead of the local database | Keep the local path lists aligned and test both API and shared-note paths. |
| An asynchronous standalone route uses the synchronous transaction boundary | The transaction can finish before the handler's awaited work and leave the request outside the intended database lock | Register awaited work through the asynchronous route boundary and keep the exclusive lock until it completes. |
| A custom request handler returns without sending a response, or sends it after the worker has already returned | The browser receives a server error or an incomplete response | Await the handler and require it to produce a response before the custom route completes. |
| A mobile request bridge receives a body-bearing request through native interception | The request body is not available to the native interceptor and the operation fails or loses its payload | Route body-bearing requests through the page-to-worker request path. Keep native interception for the supported GET and HEAD cases. |
| A stale service worker still controls a Capacitor page | Requests bypass the native bridge and can fail because the old worker has no matching answer | Remove stale registrations before loading the application and reload only when an old controller was removed. |
| Standalone serves an old unhashed asset with a new hashed chunk | The browser can load a mixed build and fail at runtime | Keep content hashes on build assets and keep only the service-worker entry at its stable URL. |
| A standalone build has help metadata but not its content bundle or attachment files | Help navigation can appear while page bodies or images fail to load | Ship the server help assets and copied non-markdown guide files under the paths used by the standalone provider. |
| A browser import provides a path-based ZIP source, an oversized entry, or an unsupported or encrypted entry | The import cannot read the archive in the browser | Pass the upload as bytes or a Blob and use supported, bounded ZIP entries. Keep filesystem-only paths on server-capable targets. |
| Browser crypto converts binary content through text before hashing or encryption | Protected note integrity checks or encrypted backup restore can fail only for some binary data | Keep binary inputs as bytes and verify browser results against the Node provider. |
| A backup is interrupted before its temporary file is renamed | A partial file may be treated as a usable backup if the caller does not filter it | Keep temporary and final names distinct and clean up failed snapshots and partial containers. |
| An encrypted backup has a wrong passphrase or damaged header | Restore cannot distinguish the two cases and cannot proceed | Ask for the passphrase again or report the backup as unreadable. |
| A mobile backup is written directly to its final name or storage is treated as scratch | A failed stream can replace a valid backup, or storage cleanup can remove a user backup | Write a part file, replace only after completion, and keep backups in durable documents storage. |
| The database comparison receives current-schema files | Legacy v214 queries can skip tables or fail to describe current state | Confirm the database version before using the output for sync diagnosis. |
| A dump is run without the password for protected notes | Protected titles or content are not recovered | Supply the correct password and review the reported protected-note count. |
| A script lacks required front matter or uses an id that no longer matches its note | The file is skipped or watch mode cannot find the note to update | Keep id, type, and title metadata present and stable. |
| A packaged desktop app depends on a module left in the workspace | The app fails outside the repository even though packaging succeeded | Run the packaged check outside the repository and inspect missing external dependencies before release. |
| A required Electron locale is absent, the catalog major is stale, or its platform-specific name is not mapped correctly | Packaging fails, or a supported UI language is missing from the installed app | Keep electron-locales.json, the Electron version, and the UI keep list aligned. Run the locale trim check for each package form. |
| Saved desktop bounds point to a disconnected display or a hidden window is managed before reveal | The app opens off-screen or flashes during login startup | Require a visible display overlap and defer state management until a hidden window is shown. |
| A renderer sends an external scheme, UNC file URL, cross-origin download, or path outside an approved root | The request is blocked or, if validation is weakened, the renderer can trigger an unsafe OS action | Keep preload methods narrow and validate schemes, origins, file URLs, and application-owned roots in the main process. |
| A Flatpak build cannot find a pinned offline source or installs release metadata under the test ID | The sandbox build fails offline, or a local test can replace the release's launcher and data | Regenerate sources from the same lockfile and use the .Test ID and matching renamed desktop, metainfo, and icon assets. |
| Desktop LAN access is enabled without a valid session or a password change leaves WebSocket clients connected | Browser clients are rejected, or a revoked session can keep receiving live updates | Keep WebSocket admission behind the session parser and disconnect attached clients when sessions are revoked. |
| A desktop autostart entry points to a sandbox-only executable or omits the hidden-start flag | Login launch fails or opens an unexpected visible window | Use the Flatpak Background portal in the sandbox and keep platform-specific command and hidden-start handling in sync. |
| A target lacks its speech native package or the model is not installed | Desktop transcription cannot start | Check the target support result and download the registered model resources before recording. |
| A capture page, utility worker, or renderer stops during transcription | The recording ends with a partial transcript or an error | Keep the worker stop timeout and retry path active. Review retained recording files when enabled. |
Key files
| File | Why to read it |
|---|---|
| apps/…/package.json | Defines server build, archive, container, proxy, test, and local start workflows plus the server's native SQLite and backup package boundary. |
| apps/…/package.json | Owns the container-specific native SQLite dependency boundary. |
| apps/…/build.ts | Shows the assets and runtime pieces that make the server build self-contained. |
apps/server/Dockerfile | Defines the standard Debian container target, its libc and SQLite assumptions, and its health contract. |
apps/server/Dockerfile.alpine | Defines the pinned Alpine target and its musl and SQLite support boundary. |
apps/server/Dockerfile.legacy | Explains the compatibility path for older hosts and unsupported native prebuild targets. |
| apps/…/start-docker.sh | Shows how startup handles root and runtime-supplied non-root identities. |
| apps/…/check-docker-non-root.sh | Defines the hardened non-root container checks for image and mounted-data users. |
| apps/…/data_dir.ts | Defines data-directory discovery, derived paths, permission checks, and startup error guidance. |
| apps/…/resources.ts | Defines verified optional resource downloads, local resource state, and license notices. |
| apps/…/resources.ts | Defines the client-facing resource status and download operations. |
| apps/…/healthcheck.ts | Defines the files that connect the server's bound address to the container probe. |
| apps/…/package.json | Defines the documentation build tool that supplies packaged guide content. |
| apps/…/package.json | Defines the desktop documentation and demo editing workflows. |
| apps/…/main.ts | Chooses the browser or native request path, claims database leadership, and starts the standalone lifecycle. |
| apps/…/local-bridge.ts | Connects tabs, the service worker, the local database worker, and streamed backup operations. |
| apps/…/native-request-bridge.ts | Defines the Android and iOS request channel for local API and shared-note responses. |
| apps/…/capacitor_download.ts | Defines native-shell download and durable backup storage, replacement, and sharing. |
| apps/…/browser_router.ts | Defines the browser request and response boundary used to reuse shared routes locally. |
| apps/…/browser_routes.ts | Maps shared server routes to the standalone database and its browser-only constraints. |
| apps/…/crypto_provider.ts | Defines the browser cryptographic boundary and its Node-compatible byte and base64 behavior. |
| apps/…/zip_provider.ts | Defines browser ZIP input, output, range reads, filename decoding, and size limits. |
| apps/…/sql_provider.ts | Defines browser SQLite storage modes and persistent OPFS database ownership. |
| apps/…/request_provider.ts | Defines browser request limits and the boundary between same-origin fetch and native transport. |
| apps/…/llm_skills.ts | Defines the skill content bundled into the standalone worker. |
| apps/…/sw.ts | Routes web requests to the database-owning tab and streams browser backups. |
| apps/…/index.html | Defines the early startup page and splash behavior before the application loads. |
apps/standalone/vite.config.mts | Defines standalone asset copying, help asset paths, runtime entry points, and cache-safe output names. |
| apps/…/package.json | Defines the standalone build, development, test, end-to-end, coverage, and two local preview modes, plus its browser database and backup package boundary. |
| apps/…/package.json | Defines the Capacitor build and sync path that packages the standalone client for Android and iOS. |
| apps/…/README.md | States the scope and limits of the separate browser transcription experiment. |
| apps/…/build.ts | Shows how the desktop package assembles the embedded application, workers, optional native packages, and startup assets. |
| apps/…/trim-locales.ts | Defines the locale reduction and packaging-time completeness check. |
| apps/…/electron-locales.json | Pins the Electron-version locale files used for Linux, Windows, and macOS packaging. |
| apps/…/test-packaged.ts | Verifies that a packaged app works outside the repository with its declared dependencies and clean data. |
| apps/…/forge.config.ts | Defines native installer targets, release assets, platform checks, and artifact collection. |
| apps/…/org.triliumnotes.Trilium.yml | Defines the sandboxed Flatpak target, offline build inputs, installed metadata, and platform permissions. |
| apps/…/trilium.sh | Selects Flatpak data storage and starts the packaged Electron application. |
scripts/flatpak/build-local.mts | Builds a working-tree Flatpak beside the release without sharing its app identity or data. |
scripts/flatpak/generate-sources.mts | Converts the lockfile into pinned offline sources for the Flatpak sandbox. |
scripts/flatpak/update-repo.mts | Pins the Flathub manifest and keeps the packaging repository aligned with the source revision. |
| apps/…/build-appimage.sh | Converts an existing Linux package into an architecture-specific AppImage. |
| apps/…/main.ts | Shows how the desktop shell opens the database, initializes shared services, controls LAN access, and starts the embedded server. |
| apps/…/preload.ts | Defines the renderer-facing Electron API and the IPC boundary for native operations. |
| apps/…/shell.ts | Defines main-process validation for paths, URLs, downloads, and platform application choosers. |
| apps/…/window.ts | Defines desktop window creation, focus and tray behavior, startup assets, and renderer-facing window controls. |
| apps/…/window_state.ts | Defines safe persistence and restoration of desktop window bounds and display state. |
| apps/…/composite_messaging_provider.ts | Combines trusted renderer IPC with the optional authenticated WebSocket transport. |
| apps/…/auto_launch.ts | Defines cross-platform autostart, Flatpak portal use, and hidden login startup. |
| apps/…/package.json | Defines desktop development, production, end-to-end, installer, archive, Flatpak, packaged-check, and startup-asset workflows. |
| apps/…/index.ts | Defines the desktop transcription lifecycle, model resources, recording retention, and shutdown behavior. |
| packages/…/index.ts | Defines the shared Node backup-container boundary. |
| packages/…/web.ts | Defines the browser backup-container boundary. |
| apps/…/compare.ts | Defines the command-line database comparison flow and its limits. |
| apps/…/dump.ts | Defines emergency read-only extraction from a Trilium database. |
| apps/…/dev.ts | Defines the local script development lifecycle and watcher. |
| apps/…/deploy.ts | Defines script metadata, deployment identity, and render-note relationships. |
| apps/…/package.json | Defines the shared icon preparation tool and its source asset dependencies. |
| scripts/…/create-icons.sh | Defines the source-to-platform icon generation path for desktop, server, web, and mobile assets. |