Documentation / Data & Persistence
Data & Persistence
Where Metrix.Bar stores user data on each platform, dashboard persistence guidelines, backups, and uninstall cleanup behavior.
Metrix.Bar stores dashboards and user data locally on your device in each operating system's standard locations—never in hidden dotfiles under your home directory. Every release also ships an appfiles manifest declaring the app's external files and system registrations so you can inspect or clean them cleanly.
Storage layers & platform directories
Metrix.Bar separates files by durability and sensitivity:
| Layer | What lives here | Rebuildable? |
|---|---|---|
| Persistent data | Managed .bar files, instance configuration & inputs, dashboard localStorage / SQLite / IndexedDB, file read grants, custom icons, local inbox data, and local-edit update backups (Backups/). | No |
| OS credential store | Declared type="secret" inputs (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux), isolated from plain-text files. | No |
| Cache | Worker caches, remote module & icon caches, rendered image cache, temporary screenshots, and read-only system widget snapshots. | Yes |
| Logs | Rotating app diagnostic logs (never include dashboard metric values, settings, or secrets). | Yes |
| State & components | Window geometry, single-instance lock, standalone dashboard launchers, and system widget/extension adapters. | Yes |
Standard paths per platform:
| Platform | Persistent data | Cache | Logs | Standalone apps |
|---|---|---|---|---|
| macOS | ~/Library/Application Support/Metrix.Bar | ~/Library/Caches/bar.metrix | ~/Library/Logs/Metrix.Bar | ~/Applications/Metrix.Bar Apps |
| Windows | %LOCALAPPDATA%\Metrix.Bar | %LOCALAPPDATA%\Metrix.Bar\Cache | %LOCALAPPDATA%\Metrix.Bar\logs | %APPDATA%\Microsoft\Windows\Start Menu\Programs\Metrix.Bar |
| Linux | $XDG_DATA_HOME/metrix-bar | $XDG_CACHE_HOME/metrix-bar | $XDG_STATE_HOME/metrix-bar/logs | $XDG_DATA_HOME/applications/bar.metrix.dashboard.*.desktop |
On Linux, runtime state (such as the single-instance lock metadata and standalone app bookkeeping) lives under $XDG_STATE_HOME/metrix-bar following the XDG Base Directory specification.
Guidelines for dashboard authors
When building a .bar dashboard—manually or with an AI coding agent—choose the storage API that matches the data's sensitivity, size, and lifetime:
| Storage mechanism | Intended use | Avoid using for |
|---|---|---|
<input type="secret"> + $metrix.secret() | API tokens, passwords, OAuth refresh tokens, webhook secrets, private keys. | Ordinary non-sensitive settings. |
Ordinary <input> declarations | User-editable settings (repository, host URL, thresholds, preferences) shown in Settings. | High-frequency runtime state or credentials. |
localStorage (apis="localStorage") | Small, synchronous UI state and lightweight key-value metadata (selected tab, cursor). | Secrets, large blobs, or unbounded history arrays. |
SQLite (apis="sqlite") | Structured records, time-series history, and data needing SQL filtering or aggregation. | Secrets or unpruned logs that grow indefinitely toward the 128 MiB limit. |
IndexedDB (apis="indexedDB") | Indexed JS objects, multi-index collections, or Web/idb-compatible storage layers. | Secrets or throwaway HTTP response caches. |
caches (apis="caches") | Re-fetchable HTTP responses, remote media, and derived artifacts that can be rebuilt. | Unique user-created data that cannot be recovered if cleared. |
Retained file grants (files.retain) | Persisting user-picked read/open paths across restarts for the same instance. | Structured app storage or unconfirmed file writes. |
Follow these persistence rules in every dashboard:
- Never store secrets in plain storage: Always keep credentials in
type="secret"inputs (via<inputs>and$metrix.secret/$metrix.setSecret), never in.barsource, ordinary inputs,localStorage,SQLite,IndexedDB,caches, or logs. - Design for per-instance isolation and idempotent startup: Every installed instance has its own isolated storage directories. Because installs, source updates, and reloads start a fresh Worker, always make schema setup and migrations idempotent (for example,
CREATE TABLE IF NOT EXISTSor versioned IndexedDBonupgradeneeded). - Handle empty or reset storage gracefully: Users can clear local data when uninstalling or move a
.barfile to a new device without copying databases. A dashboard must start cleanly from empty storage and never assume prior keys or tables already exist. - Minimize and prune persisted data: Persist only data that brings lasting value to the user. Bound history tables, queues, and logs by item count or retention window, and put re-fetchable responses or large binary payloads in
cachesinstead oflocalStorage,SQLite, orIndexedDB. - Separate user settings from internal state: Put configuration options users should inspect or edit into
<inputs>rather than hiding them insidelocalStorage. - Keep validation and tests isolated:
POST /v0/checkand the Playground use disposable storage that never mutates live instances; never embed real credentials or personal data in test fixtures.
See Runtime APIs for exact quotas and method signatures for SQLite, IndexedDB, caches, and localStorage.
Update backups, uninstalling & migration
Local edit backups during registry updates
If you manually edit an installed registry dashboard's .bar file and later confirm an update that overwrites your changes, Metrix.Bar saves a copy of your modified .bar file under <persistent-data>/Backups/<instance-id>-local-*.bar before applying the update.
Removing a dashboard instance
When you uninstall a dashboard from the app or via Local API:
- Always removed: The managed
.barfile, saved instance record and inputs, OS credential-store secrets for that instance, rebuildable HTTP/module caches, retained file grants, standalone app entry, and global shortcut. Any original external.barfile you imported from disk is never touched. - Preserved by default (
localStorage,SQLite,IndexedDB): Persistent Worker data is kept unless you explicitly opt in to delete it, so reinstalling or restoring the same dashboard ID can continue with existing local data. - Delete local data on removal: Check Delete local data in the bottom-left corner of the removal dialog (unchecked by default), or call
DELETE /v0/dashboards/:id?purge_data=trueover the Local API, to permanently remove that instance'slocalStorage,SQLite, andIndexedDBdata alongside the dashboard.
Backup & cross-device migration boundaries
- Portable across devices: Managed
.barfiles (Dashboards/), instance settings & ordinary inputs (instances.json), dashboardlocalStorage/SQLite/IndexedDB, custom icons (Assets/), and local update backups (Backups/). - Device-bound (reconfigure on the new device): OS credential-store secrets, retained file grants (tied to local paths), standalone app launchers, and system extension registrations.
- No need to back up: Cache directories, log directories, window state, and lock files—Metrix.Bar recreates them automatically.