Showcase asset pipeline
The showcase asset pipeline turns one seeded Trilium demo document into browser scenes and presentation assets for the Play Store, Flathub, the website, and the User Guide. It keeps the visible data, note views, device layouts, captions, and output checks in one repeatable build flow.
Related pages: Platform clients, Build, release, and deployment
Asset targets
The pipeline exposes separate targets for each presentation surface. Each target uses the same browser session and demo content, but produces assets suited to its destination.
| Target | Main result |
|---|---|
| Play Store | Phone and tablet screenshots, the app icon, a feature graphic, and a preview page |
| Flathub | Desktop screenshots captured in a GNOME session and a preview page with app metadata |
| Website hero | Self-contained desktop and mobile HTML snapshots of the app |
| Website screenshots | WebP images for note types, collections, and the note tree in light and dark layouts |
| User Guide | Light-theme heroes for note types, collections, and the note tree |
The command-line entry point maps named targets to builders. If no target is named, it builds the Play Store group; selected targets can be narrowed by scene or device. The build writes intermediate and final results below apps/showcase/out, while some website results are also published under apps/website/public.
References: apps/…/main.ts• L1-28 apps/…/main.ts• L41-71 apps/…/build.ts• L4-20
Demo document
The demo document is the shared source for every app screenshot. A build can use a running server that already contains the expected document, or it can start a fresh local server with login disabled, create a new document, and add the showcase-only content.
The seed adds a fixed example of an AI chat about a Rome trip. It supplies the chat messages, tool results, generated packing note, icon choice, and the note content that the scenes need. The seed does not replace an existing Packing for Rome note, so a previously prepared server can be reused.
Demo data stability
The pipeline fixes the creation and update dates of all demo notes after seeding. This keeps dates in screenshots stable across build days. The same step updates both stored note data and the server's in-memory note data so the browser sees the fixed values.
References: apps/…/demo_server.ts• L22-45 apps/…/demo_server.ts• L47-109 apps/…/demo_server.ts• L145-179 apps/…/seed.ts• L14-21 apps/…/seed.ts• L28-118
Browser scene capture
Scenes describe the product moments that the assets show. Each scene identifies a note by search query, can prepare its view for capture, and carries the caption and alternative text used by store or presentation outputs. The same scene can define different note choices or preparation for tablet and desktop layouts, and it can request the dark color scheme.
The scene set covers the note tree, formatted text, task board, geo map, mind map, canvas, Mermaid diagram, and a dark-theme code note. This makes the asset set show both core note work and specialized views without changing the underlying demo document.
The capture flow opens the app, selects the scene's note, applies any view setup, waits for network activity and late layout to settle, and then takes the image or passes the rendered page to a target-specific template. The browser helper removes caret visibility and can clear focus so editor controls do not appear by accident.
flowchart LR
A[Seeded demo document] --> B[Open app page]
B --> C[Find scene note]
C --> D[Prepare view and color scheme]
D --> E[Wait for assets and layout]
E --> F[Capture screenshot or snapshot]
F --> G[Store-specific asset]
References: apps/…/scenes.ts• L3-18 apps/…/scenes.ts• L28-36 apps/…/scenes.ts• L36-136 apps/…/browser.ts• L61-109
Presentation layouts
The pipeline separates product state from presentation framing. Phone scenes use a 360 by 640 viewport at 3x scale and may receive a caption. Tablet scenes use a landscape layout at 1.5x scale and do not add text outside the app. Desktop Flathub scenes use their own note query and preparation where a desktop view needs a different composition.
The website hero uses two variants: a hoisted desktop view of the demo tree and a mobile view of the Rome itinerary. Mobile capture includes safe-area values for the status bar and home indicator that the website draws over the phone frame.
References: apps/…/scenes.ts• L9-18 apps/…/scenes.ts• L169-205 apps/…/scenes.ts• L207-227
Template generation
Template generation turns captured or supplied data into finished presentation images. A template is opened at a defined size, receives its data through window.render, waits for fonts and images to finish loading, and is then saved as a screenshot. This lets store previews and other framed assets use the same visual input as the app captures.
The build also records store rules as checks. Failed rules are printed and set a failing process status, so an asset can look correct locally but still block the build when it violates a destination contract.
References: apps/…/browser.ts• L72-89 apps/…/build.ts• L22-49
Build environment
The build uses Playwright with a system Chromium or Chrome when available, then falls back to the configured Playwright browser. A started demo server runs in a temporary data directory and writes its log to apps/…/server.log; the directory is removed when the build stops it, unless another desktop process must open it first.
The normal targets run with the showcase package commands. Flathub additionally needs a headless GNOME session and D-Bus tools. The website hero needs FontTools with Brotli support. CHROME_BIN selects a browser executable when the normal browser cannot run, and FONTTOOLS selects a compatible FontTools command.
References: apps/…/main.ts• L17-36 apps/…/browser.ts• L30-49 apps/…/demo_server.ts• L55-109
Change checklist
When these files or sections are changed, remember to consider these:
- Keep scene note queries aligned with the seeded note titles and note types. A valid scene can still fail if its search no longer finds the intended demo note.
- Keep the seed's generated chat and note content aligned with the captions and alternative text that describe the captured view.
- Keep viewport, device scale, and safe-area values aligned with the consuming store or website layout contract.
- Keep fixed demo dates applied after the final seed so newly created notes do not reintroduce date changes into assets.
- Keep template output paths aligned with the website publish paths when a website asset changes destination.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A scene query does not match the seeded document | Capture stops because there is no note to open | Seed the required note or update the scene query and its related content |
| The demo server cannot start or finish setup | No target can capture the shared demo | Inspect apps/…/server.log and verify the local server setup path |
| Fonts or images are not ready when a template is captured | Store or website assets contain missing or shifted visual elements | Wait for font readiness and image decoding before the screenshot |
| A store size or text rule fails | The build reports failure and sets a failing exit status | Read the failed asset rule and correct the target dimensions or copy |
| The browser cannot launch in the build environment | All browser-based targets fail before capture | Provide a usable Chromium or Chrome path through the supported browser selection |
Key files
| File | Why to read it |
|---|---|
| apps/…/main.ts | Shows the target model, command-line options, and overall build lifecycle |
| apps/…/demo_server.ts | Explains how the temporary demo server is created, seeded, stabilized, and stopped |
| apps/…/seed.ts | Defines the showcase-only Rome trip and AI chat data |
| apps/…/scenes.ts | Defines the product views, captions, device variants, and website hero variants |
| apps/…/browser.ts | Shows the common browser launch, app opening, settling, note selection, and template capture flow |
| apps/…/build.ts | Defines shared paths, target options, scene file names, and validation reporting |