hatchmark build turns a project into static HTML: one page per dashboard and per
report, ready for any static host. It never asks questions and prints one line of
JSON when an agent runs it.
hatchmark dev serves the same pages locally and updates them on every save; see
CLI.
What it does
- Loads the project and checks it, like
hatchmark check. Any error stops the build before a query runs (exit 1, the same diagnostics as check). - Plans every dashboard, runs its queries in DuckDB over the project’s sources (data files, and
local copies of cloud storage and database sources; see Data sources), and resolves
asOf: "latest_data"or"latest_common_data"once per dashboard from the source horizons. The build machine’s clock is read only to warn about future-dated rows (HM4012). - Renders each dashboard with the theme, the project’s
palette,brand.logoand icon files, and writes the output directory.
Output
- Every URL in the output is relative, so
dist/works on any static host, under any sub-path (https://example.com/reports/), and opened straight from disk. - With more than one page, every page links to the others in a sidebar, or a Pages menu on narrow
screens.
navin hatchmark.yaml sets their order, groups and names (Project file). - Asset names carry a content hash, so they can be cached forever.
- Icon files next to hatchmark.yaml are copied into
_hatchmark/and linked from every page as its browser icon (Theme). - With more than one dashboard, a link from one page to another (the navigation, or a relative
link in a
textblock such as[Markets](../../markets/)) keeps the reader’s choice for each filter the target page also has, with the sametypeandid(and, forselect, the samecolumn). A period and region picked on one page open the next page on the same view; filters the target lacks are left behind, and a value written into the link itself (../markets/?region=EMEA) wins. Pointing at or focusing a link prefetches the page, and Chromium browsers render it ahead. Once a page is idle, Chromium browsers also fetch up to ten navigation links in view (on a phone, once the Pages menu opens), unless the reader saves data or is on a 2G connection. A tab left open across a rebuild or redeploy can show a page it fetched ahead from the previous build until the reader reloads, or, on pages thathatchmark serverebuilds, until the page’s next build check (every five minutes) drops what it fetched ahead. In browsers with cross-document View Transitions the change fades instead of flashing, unless the reader’s system asks for reduced motion. Both need the pages to be served over HTTP(S); opened from disk, the links still work as plain links. - The output is byte-identical for identical input: the page shows what the data runs through
(“Data through Oct 31, 2026”, with the time when the data ends partway through that day, such as
“6:54 PM EDT”), never the build time. Pin
period.asOfto a date if the data itself keeps growing and you want reproducible builds. - Build never deletes a file it did not write. Each build lists its files in
_hatchmark/manifest.json. The next build first writes all of its files under temporary names next to their targets; if one can’t be written, it removes them, changes nothing and exits 3 (HM0004). Then it moves each file into place and removes the ones the previous build wrote that it no longer needs, so a web server serving the directory meanwhile never shows a page with missing files. Moving the files into place is not atomic: if a move fails partway (exit 3,HM0004), the directory mixes the new build and the previous one until a build succeeds, so run it again once the cause is fixed; that build takes over every file either one wrote.hatchmark serveonly ever serves complete builds. Anything else in the directory stays. Build refuses (HM0004, exit 2) a directory that is not empty and has no manifest, a file it would write that the manifest does not list, and an output directory that contains the project. Build never follows a symbolic link: it also refuses an output directory that is a link (or sits under one inside the project), and any link where it would read, remove or write under the output directory. Each file is written fresh and renamed into place.
Who can see the pages
The pages hold the data they show. Besides the numbers on screen, a page embeds what its controls need: day-level totals for aperiod filter’s custom ranges, the numbers for every combination of
a segment filter’s segments, and each table’s full-precision rows for its CSV download (see
Dashboards). Anyone who can open a page, or a copy of dist/, can read
all of it, and nothing in the page asks who they are.
So publish dist/ where your existing access control already decides who sees the data: an
internal web server or intranet behind your company’s sign-in, a private bucket served through
your cloud’s signed or authenticated access, or a static host with its own access policy. A public
static host suits only data you would publish anyway. hatchmark dev is a preview for the author,
not a way to share pages (CLI).
Network access
Sources other than local CSV, Parquet, JSON and DuckDB files need DuckDB extensions, which DuckDB downloads the first time a command reads such a source and keeps in~/.duckdb/extensions/<DuckDB version>/<platform>/ (under the home directory of the user that runs
Hatchmark):
When the download fails, the command stops with
HM2044. Behind a corporate proxy, set
http_proxy and Hatchmark downloads them through it
(Proxy and certificates). A host without internet access needs the files in place before the first build: run the
same Hatchmark version once on a connected machine with the same operating system and processor,
read every such source there (hatchmark build does), and copy its ~/.duckdb/extensions
directory to the same place on the offline host. A new Hatchmark version can bring a new DuckDB
version, which needs its own copy. The Docker image has these extensions installed already
(Production). The Docker image does not include the BigQuery extension; it
downloads it on first use.
Apart from reading its sources, hatchmark build downloads nothing else: fonts, the browser runtime
and the map boundaries ship in the package. hatchmark render also needs a Chromium-based browser
and uses an installed Chrome or Edge when there is one; it downloads the Chromium headless shell only with --install-browser. On
an offline host, install Chrome or Chromium from your own package source and set
HATCHMARK_BROWSER, or copy Playwright’s browser cache (Render to PNG or PDF).
The page
- Header with the project name, dashboard title, the period (“Nov 2025 – Oct 2026 compared with
Nov 2024 – Oct 2025 · USD”), the description, and the data date. Footer with the source files.
The period caption lists each currency once, in the order its amounts first appear. No currency
amounts means no currency list. A
.change_pctreference alone doesn’t add a currency. - Consecutive
kpiblocks form one KPI strip. Other blocks are cards in a 12-column grid, as wide as theirspan. Line, area and bar charts are at least 3 columns wide (HM2024 warns whenspanis smaller); a card that no longer fits beside the cards before it starts the next row. - Light and dark follow the reader’s system setting.
?theme=darkor?theme=lightin the URL, ordata-theme="dark"on the<html>element, overrides it. - Layout: charts are drawn at the exact width of each layout (1392, 1232, 976, 720, 552, 358 and 328 px of content) and the page shows the one that fits, so chart text is never scaled. Below 1024 px every block takes the full width; on phones KPIs sit two per row.
- Charts carry a text description and a hidden data table for screen readers, and can be stepped through with the arrow keys after focusing them (Tab).
JSON result
index is the page at the site root, which opens the first page of the navigation. Each page
lists its blocks in page order with a digest of the block’s card as hatchmark render --block
draws it in the page’s default state: its markup laid out with its row, and the theme. The page
title, filter labels and navigation don’t enter it. Two builds draw a card the same when its
digest matches; a KPI’s digest also covers the strip it sits in, which is how the
GitHub Action finds the charts a pull request changed. cache counts the queries reused from the build
cache (hits), the ones that ran (misses) and the entries written; it is absent with
--no-cache. On errors the result is the diagnostic report
described in Diagnostics and nothing is written.
Build cache
Build keeps every query result, and the latest date of every time column it measured, in.hatchmark/cache/ as Parquet files, so the next build runs only the queries whose inputs
changed. hatchmark init adds .hatchmark/ to .gitignore.
When HATCHMARK_STATE_DIR is set, every command keeps what it would write under .hatchmark/
there instead: the build cache, tmp/, database copies and copy-key. Set it to build a
read-only checkout, such as in CI or a container; the project itself is then never written.
- A result is reused only when everything that decides it is unchanged: the query (its metric,
filters, grouping, window and the source’s reader options in
hatchmark.yaml), the as-of date, time zone, week and year anchors and filter defaults, the contents of the data files it reads, and the engine (the Hatchmark version, its query and executor code, and the DuckDB version). - Data files are compared by the SHA-256 of their contents, never by size or modification time,
so any changed byte runs the query again. Build first copies each data file it reads into
.hatchmark/tmp/(a copy-on-write clone where the file system supports it), hashes the copy and runs the queries on the copy, so a file edited while a build runs can never be stored under the wrong fingerprint. The copy is removed when the build ends. - Queries of raw SQL metrics (
type: sql) always run and are never cached: their SQL can read the clock or other files, which no cache key can see. - A cached build writes the same bytes as
hatchmark build --no-cache. A damaged or unreadable entry is ignored and rewritten. - Each build removes the entries it did not use, so the cache holds the last build’s results.
Deleting
.hatchmark/cache/is always safe. - The cache is best effort: it never fails a build or changes its output. When
.hatchmarkor a directory under it that the cache uses is a symbolic link, unreadable or unwritable, or when copying a data file, writing an entry or removing an unused one fails, the cache turns off for the rest of the command. The build continues as with--no-cache, prints one warning, and reportsenabled: falsewith the reason incache.reason;explainshows such queries asoff.
hatchmark explain --dashboard <name> --block <id> lists each query’s cache status after its SQL:
hit with the time the entry was stored, stale with what changed since (data with the file,
context such as the as-of date, or engine), miss, or off for raw SQL metrics. Editing a
query itself (a metric’s filters, a block’s grain) gives it a new id, so it shows as a miss.