# Configuration details

Every rule behind the [Configuration](/configuration) guide, and the keys that need more than a line. The [`hamur` reference](/api-reference/hamur) lists all keys with their types.

## Runtime config

- Read `runtimeConfig` on the server with `useRuntimeConfig(event)` from `hamur/server`, or without the event (also at module scope, and as `server.runtimeConfig` in a server plugin). It returns the whole object, private keys and `public`.
- A `load` gets the client part as `ctx.runtimeConfig`.
- In app code (a page, a layout, a component, a plugin) call `useRuntimeConfig()` from the adapter, with no event. It returns `{ public, app }` on the server and in the browser: `public` is the public part, and `app` is `{ baseURL, buildAssetsDir }`.
- The private keys are never in it.
- The server writes the public part into the page once, and the browser starts with the same values the server rendered.
- After `hamur typegen`, the keys of `runtimeConfig.public` are typed on `useRuntimeConfig().public`.
- The object that `useRuntimeConfig(event)` returns is shared by every request: do not change it.

## `process.env` in client code

- `process.env` is not the way to read a value in client code.
- `hamur build` and `hamur generate` fail when a client module reads `process.env.<NAME>` other than `NODE_ENV`, with `app/components/banner.tsx:2:13: process.env.SITE_NAME reaches the client bundle; use useRuntimeConfig().public, import.meta.env or #hamur/env/public`, and `hamur dev` shows the same text as a warning.
- Code under `server/` is not checked, and neither is a read behind `import.meta.server` or a `typeof process` test. Put the value in `runtimeConfig.public` and read it with `useRuntimeConfig()`:

````tsx [react/env-before.tsx]
export default function Banner() {
  return <p>{process.env.SITE_NAME}</p>
}
````

````tsx [react/env-after.tsx]
import { useRuntimeConfig } from "@hamur/adapter-react"

export default function Banner() {
  return <p>{String(useRuntimeConfig().public.siteName)}</p>
}
````

## Environment variables

- A config value reads a variable only through `env("NAME")`, exported by `hamur`, which names an entry of `app/env.ts`.
- The value is read when the server starts, validated by the entry's schema, and replaces the reference. Changing it needs a restart, not a build. On Cloudflare it is read when the worker module loads.
- A name `app/env.ts` does not declare fails when the config loads, with its path: `runtimeConfig.apiSecret reads env "API_SECRT", which app/env.ts does not declare`.
- A key under `public` may read only a public entry that is not static, since its value goes to the browser: `runtimeConfig.public.apiBase reads env "API_KEY", which is private; mark it public: true in app/env.ts or move the key out of public`.
- A variable named after a key changes nothing: `HAMUR_API_SECRET` does not touch `apiSecret`.
- The same `env("NAME")` is how a storage mount, a token or a module option reads a secret.

````env [runtime-config.env]
API_KEY=s3cret
GA_ID=G-123
````

With this file and the config above, `useRuntimeConfig(event).apiSecret` is `s3cret` and `useRuntimeConfig().public.analyticsId` is `G-123`.

## `.env` files

- `hamur dev`, `build`, `generate` and `preview` read `.env`, `.env.<mode>` and `.env.local` from the app root, and `--dotenv <file>` adds another file; [Environment](/environment#modes) has the order.
- A variable already set in the shell wins over the files.
- A built server does not read these files.
- Bun loads a `.env` from the working directory when it starts a process, and Node loads none, so in production set real environment variables on the host.

## One public config

- Settings that every page reads and that are not secret, a theme or a site title, go under `runtimeConfig.public` and are read with `useRuntimeConfig().public`. There is no second app config: an `appConfig` key fails when the config loads with `appConfig: the app config was removed; move its keys under runtimeConfig.public in hamur.config.ts`, and an `app/app.config.ts` (or `.js`, `.mjs`) of the app or a layer fails the scan with [HAMUR_E1245](/errors/HAMUR_E1245), `app/app.config.ts: the app config was removed; move its keys under runtimeConfig.public in hamur.config.ts`.
- A module adds its defaults with `updateRuntimeConfig({ public: { … } })` of `hamur/kit`.

## A value of the wrong type

It fails when the config loads, with a message that names the key, for example `app.teleportId must be a non-empty string (got "")`.

This config sets many of the keys below:

````ts [m9-config.ts]
import { defineConfig } from "hamur"

export default defineConfig({
  framework: "react",
  devServer: { allowedHosts: [".ngrok.app", "app.test"] },
  server: { trustProxy: true, allowedHosts: ["example.com", ".example.com"] },
  app: {
    linkProtocols: ["http", "https", "mailto", "tel", "sms", "whatsapp"],
    teleportId: "teleports",
    teleportTag: "div",
    teleportAttrs: { class: "teleports" },
  },
  prerender: { conflict: "error" },
  cloudflare: { env: "staging" },
})
````

## Dev server

### `devServer.allowedHosts`

Default: `[]`.

- Extra hosts that `hamur dev` and `hamur preview` answer.
- An entry is an exact name, or starts with `.` for the name and every subdomain (`.ngrok.app` admits `a.ngrok.app`); `true` allows every host.
- `localhost`, `*.localhost`, IP addresses and the `--host` or `devServer.host` value are always allowed. Any other host gets a 403 that names it.
- A built production server answers any host.

### `devServer.prefetch`

Default: `false`.

- In `hamur dev`, `Link` with `prefetchOn="visibility"` prefetches nothing, and hover and focus prefetch load the page chunks only and run no `load`, since each `load` would run on a server that recompiles.
- `true` keeps the data prefetch of a build on hover and focus.
- A built app is not affected.

### `devServer.hmr`

Default: `true`.

- `false` turns off Bun's hot module replacement in `hamur dev`: every change to a file the browser loads (CSS and `public/` files included) reloads the page, and the adapters emit no hot-update code.
- `true` hot-updates a page, keeping its state.
- Server-only files and server rebuilds are the same either way.
- Must be a boolean: `devServer.hmr must be a boolean (got "off")`.

### `devServer.timing`

Default: `true`.

- In `hamur dev`, the browser writes a `performance.measure` for each app plugin setup, app hook call, route middleware, loader run, navigation and hydration, named `hamur:plugin:<name>`, `hamur:hook:<name>`, `hamur:middleware:<name>`, `hamur:loader:<route>` and `hamur:navigation`, on a `Hamur` track of Chrome's Performance panel; a loader's `ctx.fetch` sends a `traceparent` so the devtools Timeline can nest the server spans.
- `false` writes none.
- A build holds none of it.
- Must be a boolean: `devServer.timing must be a boolean (got "yes")`.

### `devServer.mcp`

Default: `true`.

- Serves the dev MCP endpoint `POST <baseURL>_hamur/dev/mcp` in `hamur dev` for coding agents ([Dev server](/dev-server#the-dev-mcp-endpoint-for-coding-agents)); `false` leaves the path unanswered, and a build never has it.
- Must be a boolean: `devServer.mcp must be a boolean (got "yes")`.

### `agentRules`

Default: `true`.

- `false` makes `hamur agents`, and the step of `hamur upgrade` that runs it, leave `AGENTS.md` as it is ([AI and editors](/ai-and-editors#agent-files)).
- Must be a boolean: `agentRules must be a boolean (got "no")`.

### `devServer.inspect`

Default: `false`.

- Records every step of the transform chain for `GET /_hamur/inspect` in `hamur dev`, and for the devtools Inspect tab: per module and side, the plugin name, the loader it received, the text it returned and its time, with a line diff against the step before.
- `hamur dev --debug` turns it on too; a build answers 404.
- The route lists only what was recorded and never reads a file from disk.
- Must be a boolean: `devServer.inspect must be a boolean (got 1)`.

### `devServer.console`

Default: `true`.

- Which browser `console` calls `hamur dev` prints in the terminal as `[browser] warn x (app/pages/index.tsx:12)`, with the source-mapped first frame outside Hamur and `node_modules`: `true` forwards `log`, `info`, `debug`, `warn` and `error`, `"warn"` warn and error, `"error"` error only, `false` none.
- The records join the log behind `GET /_hamur/logs`, and Bun's own forwarding is off, so a call prints once.
- The browser still prints as before.
- Uncaught errors keep the overlay and are not forwarded.
- Must be `true`, `false`, `"warn"` or `"error"`: `devServer.console must be true, false, "warn" or "error" (got "all")`.

### `devServer.ssrLogs`

Default: `true`.

- The browser console prints the server log records of the document request as one collapsed `[ssr] <n> log lines for <path>` group, after the app hook `app:ssrLogs` got them.
- `GET /_hamur/logs` is a dev data route, so a page on another device without the dev token prints no group.
- Must be a boolean: `devServer.ssrLogs must be a boolean (got "yes")`.

### `devServer.logFetches`

Default: `true`.

- Each server-side `$fetch` and `ctx.fetch` of a request prints one indented line under that request's log line in `hamur dev`: `  ↳ GET /api/me 200 4ms (in-process)`, with `, cache hit`, `, cache miss` or `, cache stale` when a cached handler, a route-rule cache or a `serverCache` answered it.
- A call to another server prints `(network)`.
- An in-process call prints no request line of its own.
- The URL is the path without its query; `{ fullUrl: true }` prints the whole URL, the origin and query included.
- `false` prints none.
- Must be a boolean or `{ fullUrl: boolean }`: `devServer.logFetches must be a boolean or { fullUrl: boolean } (got "yes")`.

### `devServer.slowWarning`

Default: `4000`.

- Milliseconds after which a loader, route middleware, app plugin setup or async-data handler that is still running logs once, on the side where it runs: `[hamur] loader of blog-slug is still running after 4 s (/blog/x)`, and `middleware <name>`, `plugin <name>` or `async data <key>` for the others.
- The server logs it as a record, the browser as a `console.warn` that `devServer.console` forwards to the terminal.
- `false` sets no timer.
- Must be a positive number or `false`: `devServer.slowWarning must be a positive number of milliseconds or false (got -1)`.

### `devServer.updateCheck`

Default: `false`.

- `hamur dev` asks `https://registry.npmjs.org/hamur/latest` for the newest `hamur` at most once per 24 h and prints `[hamur] Hamur 1.2.0 is available (you have 1.1.0)` when it is newer.
- The request has a 2 s timeout, runs after `Local:` so the start never waits for it, and a failure prints nothing.
- The time of the last check is kept in `<cacheDir>/update-check.json`. It never runs when `CI` is set or `HAMUR_NO_UPDATE_CHECK=1`, and a build or preview has none.
- Must be a boolean: `devServer.updateCheck must be a boolean (got "yes")`.

### `devServer.chromeWorkspace`

Default: `true`.

- `hamur dev` lets Chrome DevTools map the project folder as a workspace: a request for `/.well-known/appspecific/com.chrome.devtools.json` from `localhost`, `127.0.0.1` or `::1` answers `{ "workspace": { "root", "uuid" } }` with the folder `hamur dev` runs in (the app root, or the common directory of the app and a layer outside it) and a `uuid` that stays the same across restarts.
- `false` answers 404; a build has no such route.
- Must be a boolean.

### `devServer.indicator`

Default: `{ position: "bottom-left" }`.

- The badge `hamur dev` draws on every page, in a shadow root: the server state while it rebuilds or failed, and `<route name> · <mode>` with the route report's mode (`request`, `prerendered`, `cached swr 60`, `cached isr 60`, `cached cache 60`, `spa`, `script-free`) from the route rules of the route, as a build would treat it (`hamur dev` renders every request).
- With `@hamur/devtools` on the page the text is in its toolbar and the badge is not drawn.
- `false` draws none.
- A build holds none of it.
- `position` must be `"bottom-left"` or `"bottom-right"`: `devServer.indicator.position must be "bottom-left" or "bottom-right" (got "top")`.

### `devServer.hydrationMismatch`

Default: `"overlay"`.

- How `hamur dev` reports a page whose first render in the browser differs from the server's HTML (a `Date.now()`, a `typeof window` branch, a browser extension that edits the page). Each report prints `[hamur] hydration mismatch in <component> at <path>` in the browser console and, with the route, in the terminal, once per component and path, and counts in `window.__hamur_hydration`.
- `"overlay"` also opens a panel at the bottom of the page with the server and client markup of that node side by side, the difference marked and the component file as a link to the editor; `"console"` gives the lines and the counter without the panel; `false` reports nothing, and the library's own warnings print as before.
- React reports from its recoverable hydration error (shown in this panel, not in the error overlay), Vue from its hydration warnings and the element they name, Svelte and Preact from the DOM after hydrating against the server markup, html from its render string against the server markup.
- Solid reports only a node it cannot find while hydrating (its own `Hydration Mismatch` error): Solid keeps the server's text and attributes, so a text or attribute difference in a Solid app gives no report.
- A build holds none of it.
- Must be `"overlay"`, `"console"` or `false`: `devServer.hydrationMismatch must be "overlay", "console" or false (got true)`.

## Address and proxies

### `server.allowedHosts`

Default: `true`.

The hosts whose `x-forwarded-host` header `getRequestURL` trusts when `server.trustProxy` is on. Entries match as in `devServer.allowedHosts`. `true` trusts any host; without `trustProxy` the key does nothing.

### `app.origin`

Default: unset.

- The public origin, where browsers reach the server: a scheme, a host and an optional port, no path (`https://example.com`).
- `HAMUR_ORIGIN` replaces it when the server starts.
- When set it is the origin of `getRequestURL(event)` and `useRequestURL()`, the origin the cross-origin form check expects, the origin `sendRedirect` and `redirect()` compare to tell an external target, and the origin of absolute URLs the prerender writes; neither the `Host` header nor `x-forwarded-host` and `x-forwarded-proto` change it, even with `server.trustProxy`.
- The path and query stay the request's. It is not `site.url`: that is the canonical URL search engines see, this is where the server is reached, so a preview deploy sets its own `app.origin` and keeps the production `site.url`.
- `app.origin must be an origin such as "https://example.com" (got "https://a.test/x")`; a bad `HAMUR_ORIGIN` stops the start with `HAMUR_ORIGIN must be an origin such as "https://example.com" (got "https://a.test/x")`.

### `app.cdnURL`

Default: `""`.

An absolute `http:` or `https:` URL that serves the client files; `HAMUR_APP_CDN_URL` replaces it when the server starts. See [Build output](/build-output#appcdnurl).

### `server.fallbackProxy`

Default: unset.

- An absolute `http:` or `https:` URL; a request that no public file, handler route or concrete page answers is forwarded there, path and query kept, instead of the 404.
- See [Fall back to another server](/server#fall-back-to-another-server).

## Server

### `server.etag`

Default: `false`.

- `true` or `"weak"` sends a weak `etag`, `"strong"` a strong one, on a `GET` or `HEAD` `200` answer whose body is a string, bytes, a blob or a JSON value of at most 1 MiB and that has no `etag`, `set-cookie` or `no-store`. Anything else: `server.etag must be a boolean, "weak" or "strong" (got "x")`.
- See [Your own validators](/api-reference/storage-details#your-own-validators).

### `server.compress`

Default: `true`.

- `true` is `{ threshold: 1024, encodings: ["zstd", "br", "gzip"] }`; compresses dynamic answers on the bun and node presets by the first of `encodings` the request accepts (`"deflate"` is the fourth), for compressible types of `threshold` bytes or more; `false` turns it off.
- Other presets: the host compresses.
- A bad value: `server.compress must be a boolean or { threshold?, encodings? } (got "br")`, `server.compress.encodings entry "lz4" is not a coding; use zstd, br, gzip or deflate`.
- See [Compression](/deploy/presets/node#compression).

### `server.earlyHints`

Default: `false`.

- `true` sends a `103 Early Hints` on the node preset and a `Link` header on every preset for a page's stylesheets (`rel=preload; as=style`) and module chunks (`rel=modulepreload; crossorigin`); see [Early hints](/deploy/presets/node#early-hints).

### `server.pubsub`

Default: `false`.

- `{ driver: "redis", url?, channelPrefix? }` carries `publish`, `peer.publish`, `revalidateTag`, `revalidatePath`, `invalidateRouteCache` and a cache's `expire()` to the other instances of the app through Redis, with `Bun.redis`: the bun preset only, and `hamur dev`.
- `url` defaults to `REDIS_URL` at start, `channelPrefix` to `"hamur:"`. Another preset fails the build with `server.pubsub needs Bun.redis, which the "node" preset cannot run (it runs on: bun)`; a start without `url` or `REDIS_URL` fails with `server.pubsub needs url or REDIS_URL`.
- See [WebSockets](/server#websockets).

### `server.syncedState`

Default: `false`.

- `true` or `{ path?, maxKeys?, maxSubscriptions? }` adds the synced state socket route at `<baseURL>_hamur/synced` (or `path`), keeping one JSON value per room and key, at most `maxKeys` (default 10000) of them, with at most `maxSubscriptions` (default 1000) per socket; bun, node and cloudflare with `cloudflare.websocket: "durable"` only.
- Load errors: `server.syncedState.path must start with "/"`, `server.syncedState.maxKeys must be a positive integer`, `server.syncedState.maxSubscriptions must be a positive integer`.
- See [Synced state](/realtime#synced-state).

## Cache

### `routeRules[...].cache.maxResolveTime`

Default: `30`.

Seconds a cache fill may run before the callers waiting for it get a 504; `0` or `Infinity` waits without a limit. See [Storage and cache](/api-reference/storage-details#fill-deadline).

### `routeRules[...].cache.staleIfError`

Default: none.

- Seconds a page or route entry past its stale window is still served when the fill that replaces it throws or times out, and `stale-if-error=<n>` in the rule's `Cache-Control`.
- See [Serving stale on error](/api-reference/storage-details#serving-stale-on-error).

### `routeRules[...].cache.maxEntrySize`

Default: half a memory mount's `maxBytes`.

Bytes; a page or route answer larger than this goes to the client and is not stored. See [Entry size](/api-reference/storage-details#entry-size).

### `routeRules[...].cache.base`

Default: `cache:pages` for a page, `cache:handlers` for a server route, each `cache` when not mounted.

The storage mount of the rule's entries, or a list of mounts, fastest first, read in order and all written. See [Tiers and versions](/api-reference/storage-details#tiers-and-versions).

### `storage["cache:pages"]`, `storage["cache:handlers"]`, `storage["cache:functions"]`, `storage["cache:tags"]`

Default: unset, so `cache`.

- The mount of one kind of cache entry: pages, server-only components and server islands; server routes a rule caches; cached functions, a `GET` handler's `cache` and `$fetch` `serverCache`; the tag index.
- Any driver; a kind left out uses `cache`.
- See [Where entries live](/api-reference/storage-details#where-entries-live).

### `routeRules[...].cache.streamFill`

Default: `false`.

`true` sends a page or route answer to the request that fills its entry chunk by chunk and stores it when the body ends. See [Streaming fills](/api-reference/storage-details#streaming-fills).

### `routeRules[...].cache.tags`

Default: none.

Cache tags of every page and server route the rule stores, which `revalidateTag` reaches; `path:`, `route:` and `layout:` are refused. See [`revalidateTag`](/api-reference/server#cachetag-revalidatetag).

### `routeRules[...].cache`, `routeRules[...].swr`

Default: none.

- A profile name is a rule's lifetime: `cache: "hours"` is `cache: { profile: "hours" }`, `swr: "hours"` is `cache: { profile: "hours", swr: true }`; an unknown name fails the load: `routeRules["/x"].cache: unknown profile "hourz"`.
- See [`cacheLife`](/api-reference/server#cachelife-cacheprofile).

### `routeRules[...].cache.profile`

Default: none.

A profile name that gives `maxAge`, `staleMaxAge` and `clientMaxAge`; the rule's own fields win over it.

### `server.cache.profiles`

Default: `{}`.

- Named lifetimes `{ maxAge, staleMaxAge?, clientMaxAge? }` added to the built-in `seconds`, `minutes`, `hours`, `days`, `weeks` and `max`; an entry of a built-in's name replaces it.
- A name is `a-z`, `0-9` and `-`, starting with a letter; `maxAge` is a positive number of seconds.
- `clientMaxAge` adds `max-age=<n>` to the `Cache-Control` a rule sends.

### `server.cache.defaults`

Default: `{}`.

- `maxAge`, `swr`, `staleMaxAge`, `profile`, `maxResolveTime`, `staleIfError` and `maxEntrySize`, merged under every cached function, handler and rule; a function field fails the load: `server.cache.defaults.getKey is not an option here; defaults reach the server as JSON`.
- A rule `swr: true` takes `defaults.maxAge` before `1`.

### `server.cache.statusHeader`

Default: `true` in `hamur dev`, `false` in a build.

- `true` sends the cache status (`HIT`, `STALE`, `MISS`, `REVALIDATED`, `BYPASS`) of an answer in `x-hamur-cache`; a string names the header.
- The `statusHeader` option of a cache and the rule key `cache.statusHeader` win; see [Cache status](/api-reference/storage-details#cache-status).

### `server.revalidate`

Default: `false`.

- `{ token?, path? }` turns on the endpoint `POST <baseURL>_hamur/revalidate` (or `path` below the base) that runs `revalidateTag` and `revalidatePath` for a caller with `Authorization: Bearer <token>`.
- `token` is a string or `env("NAME")`; without it the token is `HAMUR_REVALIDATE_TOKEN`.
- At least 32 characters, checked at start.
- See [On-demand revalidation](/api-reference/storage-details#on-demand-revalidation).

### `server.cdnPurge`

Default: `{}`.

- Credentials with which `revalidateTag` and `revalidatePath` purge the CDN by tag: `cloudflare: { zoneId, token }`, `netlify: { siteId?, token? }` (else `SITE_ID` and `NETLIFY_PURGE_API_TOKEN`), `vercel: { projectId, teamId?, token }`.
- A `token` is a string or `env("NAME")`; each host is read by its own preset only.
- See [CDN tags and purge](/api-reference/storage-details#cdn-tags-and-purge).

## Prerender

### `prerender.format`

Default: `"directory"`.

The file a prerendered page is written to: `<path>/index.html`, `<path>.html` (`"file"`) or the page's own file (`"preserve"`). See [Build output](/build-output#prerenderformat).

### `prerender.workers`

Default: `1`.

Bun workers that prerender pages from one queue; `"auto"` is the core count minus one. See [Build output](/build-output#prerenderworkers).

### `prerender.routes`

Default: none.

- Paths to prerender, or `async ({ staticPaths }) => string[]` with `staticPaths` every page path without params; with `ssr: false` a listed path is written as full HTML and every other path keeps the `200.html` shell.

### `prerender.conflict`

Default: `"warn"`.

- What the prerender does when two routes give one path, for example `blog/new.tsx` and `blog/[slug].tsx` with `/blog/new` in `prerender.routes`: `"warn"` logs it and writes the route the router picks, `"error"` fails the build, `"ignore"` says nothing.

### `prerender.staticPages`

Default: `false`.

- `true` makes a server-preset build (bun, node, vercel, netlify, cloudflare) also write every page without params whose layouts, parents and page have no `load` and whose rules do not set `ssr: false`.
- A page that marks itself with `meta.rules: { prerender: true }` is written without it; one that fetches per request sets `prerender: false`.
- The static preset writes every page anyway.

### `prerender.onMissingId`

Default: `"warn"`.

- What the prerender does with a crawled link `/page#x` whose written target has no element with `id="x"` or `<a name="x">`: `"warn"` logs `/ links to /about#nope, but /about has no element with id "nope"`, `"fail"` throws it whatever `prerender.failOnError` says, `"ignore"` says nothing.
- An empty fragment and `#top` always pass.

### `prerender.onUnseenRoutes`

Default: `"warn"`.

- What the prerender does with page routes marked for prerender (on the static preset every page; elsewhere `prerender: true` in a rule or `meta.rules`) that no seed, entry or link reached, for example `/blog/:slug` without `entries`: `"warn"` names them, `"fail"` throws whatever `prerender.failOnError` says, `"ignore"` says nothing.

### `prerender.sharedData`

Default: `true`.

- Within one prerender run, a `GET` handler called with the same input and a `useFetch` `GET` whose key Hamur derived from the URL run once, and every page after the first gets its own copy of the value.
- A `useAsyncData` key and a `useFetch` `key` option you chose are never shared.
- A call is not kept, and so runs for each page, when it fails, calls `taint()`, changes the status, a header or a cookie of the response, or returns a value that would not come back as it was (an `Error` inside it).
- A `GET` handler that reads the request URL to answer shares the first page's answer; set `false` for it.

### `prerender.errorPages`

Default: `[404]`.

- The `<status>.html` files the static preset writes, each the app error page (`app/error.<ext>`, else the adapter's) rendered for `createError({ status })`; `true` is `[404]` and `false` writes none.
- A status outside 400-599 is left out and logs `prerender.errorPages: 302 is not an error status; it is left out`. On a preset that does not prerender every page a set value logs `prerender.errorPages is read by the static preset; on the <preset> preset the server renders error pages`.

### `prerender.cache`

Default: `false`.

- `true` keeps every written page with a `cacheKey` in `.hamur/cache/prerender/` and, on the next build, copies it instead of rendering it while its key and the build's server bundle and client manifest are unchanged.
- `hamur build --force` and `hamur generate --force` render every page.
- See [Incremental prerender](/route-rules#incremental-prerender).

### `prerender.cacheKey`

Default: none.

- `({ path, params }) => string | undefined`: the key of a prerendered path; `undefined` renders it every time.
- An `entries` item `{ params, cacheKey }` sets the key of its own path, before this function.

## Platforms

### `cloudflare.websocket`

Default: `"durable"`.

- Where the `cloudflare` build runs [WebSockets](/deploy/presets/cloudflare#websockets): `"durable"` in the generated `HamurWebSocket` Durable Object, `"worker"` in the Worker's isolate. Any other value fails the load: `cloudflare.websocket must be "durable" or "worker" (got "pool")`.

### `cloudflare.devBindings`

Default: `true`.

- With the `cloudflare` preset and `wrangler` installed in the app, `hamur dev` loads it and gives every event the bindings of your wrangler config as `event.runtime.env`, plus `event.runtime.ctx` and `event.runtime.caches`.
- Local only: `remoteBindings: false`, so dev never reaches your Cloudflare account, and a binding that exists only remotely is absent.
- Without `wrangler`, dev logs once `[hamur] Cloudflare bindings are not available in dev; install wrangler in the app to use them` and goes on.
- `false` skips it. Not a boolean fails the load: `cloudflare.devBindings must be a boolean (got "no")`.

### `cloudflare.runWorkerFirst`

Default: `[]`.

- Extra patterns for `assets.run_worker_first` in `.output/wrangler.json`, in Cloudflare's syntax (`*` matches any characters, `/` included; a `!` prefix excludes).
- The build already lists the paths of `cors`, `proxy`, `basicAuth` and `ipRestriction` rules; yours are added after them.
- `true` runs the Worker for every request.
- See [Cloudflare](/deploy/presets/cloudflare#run-worker-first).

### `cloudflare.observability`

Default: `false`.

- `true` writes `observability: { enabled: true }` into `.output/wrangler.json`, which turns on Workers Logs and traces for the Worker, unless your own wrangler config sets `observability`: then yours is kept.
- With `server.tracing` on, the request span also carries `cloud.provider: "cloudflare"` and `cloudflare.ray` (the `cf-ray` header). Not written for `cloudflare-pages`. Not a boolean fails the load: `cloudflare.observability must be a boolean (got "yes")`.

### `cloudflarePages.routes`

Default: computed.

- `{ include?: string[], exclude?: string[] }`: replaces the `include` or `exclude` list of the `_routes.json` that the `cloudflare-pages` build writes.
- Together at most 100 rules, each at most 100 characters; an `exclude` entry over a path a route rule needs the Worker for fails the build.
- See [Cloudflare Pages](/deploy/presets/cloudflare-pages).

### `bunCompile`

Default: `{ name: "app" }`.

`{ target?: Bun.Build.CompileTarget, name?: string }`: the target and the file name of the executable the `bun-compile` preset writes to `.output/`. See [Bun executable](/deploy/presets/bun-compile).

### `build.bytecode`

Default: `false`.

- `boolean`: with the `bun-compile` preset, the executable carries Bun bytecode of the server, which Bun writes for ESM only into a compiled executable. Any other preset fails: `build.bytecode needs the bun-compile preset: Bun writes ESM bytecode only into a compiled executable`.
- See [Bun executable](/deploy/presets/bun-compile).

### `build.traceInclude`

Default: `[]`.

- `string[]` of globs, relative to the project root, of extra files (a `.wasm`, a data file) that `hamur build` copies into `.output/server` under the same relative path, beside the [traced externals](/deploy/platforms/traced-externals). Each must be a relative glob that stays inside the project: `build.traceInclude "../x" must be relative to the project root and stay inside it`.

### `awsLambda.streaming`

Default: `false`.

`true` exports the `aws-lambda` handler through `awslambda.streamifyResponse` and streams the body. See [AWS Lambda](/deploy/presets/aws-lambda). Not a boolean fails the load: `awsLambda.streaming must be a boolean (got "yes")`.

### `firebase.appHosting`

Default: `{}`.

Merged into `runConfig` of `.apphosting/bundle.yaml` after `runCommand` (`cpu`, `memoryMiB`, `concurrency`, `maxInstances`, `minInstances`, and any other key App Hosting reads). See [Firebase App Hosting](/deploy/presets/firebase-app-hosting).

### `gitlabPages.publicDir`

Default: `false`.

- `true` also copies the `gitlab-pages` output to `public/` at the app root.
- See [GitLab Pages](/deploy/presets/github-pages).
- The app's own `publicDir` must not be that folder, and a `public/` that Hamur did not write is never replaced; both fail the build. Not a boolean fails the load: `gitlabPages.publicDir must be a boolean (got "yes")`.

### `cloudflare.env`

Default: unset.

The [wrangler environment](/deploy/presets/cloudflare) whose `env.<name>` block the `cloudflare` build copies into `.output/wrangler.json`.

## Build

### `cssCompilers`

Default: unset.

- The options of the `@hamur/css` module: `sass`, `less`, `stylus` (each `{ additionalData?, loadPaths? }`) and `postcss` (`boolean`, or `{ config?, plugins? }`).
- Typed once the module is installed.
- See [Styling](/styling#sass-less-and-stylus) and the [reference](/api-reference/css).

### `cacheDir`

Default: `node_modules/.cache/hamur`.

Where Hamur and its modules keep what a later build can reuse, relative to the root.

### `skewProtection.keep`

Default: `0`.

- An integer from 0 to 10: each build saves its files below `.output/public/<buildAssetsDir>` in `<cacheDir>/skew/<build id>/` and copies those of the last `keep` earlier builds into its output, so a tab opened before a deploy still loads its lazy chunks.
- A name the new build already has is kept as it is, and older saved builds are removed.
- The kept files are in no service worker list or import map.
- `<cacheDir>` must survive between builds (cache it on CI as you cache the build cache); with nothing saved the build logs `skewProtection.keep: no earlier build in node_modules/.cache/hamur/skew`.
- `0` saves nothing, and `hamur dev` keeps nothing. Anything else fails the load: `skewProtection.keep must be an integer from 0 to 10 (got 1.5)`, and so does a `keep` above 0 with `app.buildAssetsDir` at the root: `skewProtection.keep needs an app.buildAssetsDir below the root, such as "/_hamur/" (got "/")`.

### `build.cache`

Default: `false`.

Skip an unchanged client and server build by a stored archive in `<cacheDir>/build/`. See [Build output](/build-output#buildcache-and-cachedir).

### `build.minifyHtml`

Default: `false`.

Drops whitespace that cannot show from the document shell and from an html app's body. See [Build output](/build-output#buildminifyhtml).

### `build.compileHints`

Default: `false`.

`//# allFunctionsCalledOnLoad` on the entry, layout and page chunks. See [Build output](/build-output#buildcompilehints).

### `build.sourcemapIgnoreList`

Default: `true`.

Writes `x_google_ignoreList` into every source map. See [Build output](/build-output#buildsourcemapignorelist).

### `build.extractAsyncDataHandlers`

Default: `false`.

Static preset only: moves a handler that provably uses nothing of its component into its own chunk. See [Build output](/build-output#buildextractasyncdatahandlers).

### `publicAssets`

Default: `[]`.

- More public directories, `Array<{ dir, baseURL?, maxAge? }>`. Each entry is an `addPublicAssets` call made for the app: `dir` is from `rootDir`, `baseURL` starts and ends with `/` (default `"/"`), and `maxAge` seconds give its files `cache-control: public, max-age=<n>, immutable`; `publicDir` keeps `max-age=0, must-revalidate`.
- The files are served in dev and copied to `.output/public/`.
- Two sources of one path fail the build naming both. Not an array of that shape fails the load: `publicAssets must be an array of { dir, baseURL?, maxAge? }`.

## Experiments and future defaults

### `experimental.offlineRetry`

Default: `false`.

A navigation, prefetch or `useFetch` that failed on the network waits for `online` and tries again.

### `experimental.islands`

Default: `false`.

- `true`, or `{ libraries? }` in an html app: turns on island pages (`meta.hydrate: "islands"`), server islands (`app/server-islands/`) and `prerender: "shell"`.
- See [Islands and streaming](/islands-and-streaming).
- `libraries` is a list of `"react"`, `"preact"`, `"vue"`, `"svelte"` or `"solid"` and fails at load outside the html adapter: `experimental.islands.libraries is only for html apps`.

### `experimental.svelteAsync`

Default: `false`.

Lets a Svelte component use `await` in its script or markup, on the server and in the browser; needs the svelte adapter. See [Islands and streaming](/islands-and-streaming).

### `experimental.reactCompiler`

Default: `false`.

- Runs Bun's React Compiler over the app's `.jsx` and `.tsx` files in `hamur build` (memoized client code, unmemoized server output); `hamur dev` runs the source as written.
- Needs the react adapter: `experimental.reactCompiler needs the react adapter (framework is "vue")`.

### `future`

Default: `{}`.

- One boolean per future flag: a default the next major changes, opted into before that major. Each flag is documented with the major that makes it the default, and is removed in that major.
- No flag exists yet, so a key under `future` logs `[hamur] Unknown future key "x"; known keys: none`, and `future: {}` is valid.
- `hamur info` lists the flags that are on.
- To add a flag, a change names the major in the `HamurFutureFlags` entry and gives the flag a reader.

### `experimental.mcp`

Default: `false`.

`true` lets the `mcp` key of `defineHandler` serve an MCP endpoint; off, a handler with the key fails the build with `server/mcp.ts#mcp: the mcp key needs experimental.mcp: true`. See [MCP](/mcp).

### `experimental.runtimeBaseURL`

Default: `false`.

`true` lets `HAMUR_APP_BASE_URL` replace `app.baseURL` when the server starts; the `bun` and `node` presets only. See [Build output](/build-output#experimentalruntimebaseurl).

## The page document

### `appId`

Default: `"hamur"`.

- The prefix of every browser-side name Hamur owns, so several Hamur apps run on one page: lower-case letters, digits and `-`, starting with a letter (`appId must be lower-case letters, digits and "-", starting with a letter (got "My App")`).
- With `appId: "shop"` the payload script is `__shop_payload`, the default `app.rootId` is `__shop`, the `window` globals are `__shop_…`, the `sessionStorage` keys `shop:…` (`shop:reload`), the history key fields `shopKey` and `shopIndex`, the import map's chunk specifiers `#shop-chunk/<key>`, the island element `<shop-island>` and the SPA loader `__shop_loader`.
- The default keeps today's names.
- The DOM events `hamur:beforenavigate`, `hamur:navigate` and `hamur:afternavigate` keep their names and carry `detail.appId`.
- With any `appId` but `"hamur"`, the navigator takes link clicks and form submits inside its own root only, leaves `history.scrollRestoration` to the browser and ignores a back or forward to an entry another app wrote. Give each app on the page its own `appId` and `app.baseURL`.

### `react`

Default: `{ strictMode: true }`.

- `{ strictMode?, identifierPrefix? }`, react adapter only.
- `strictMode` wraps the app root in `StrictMode` in `hamur dev`, so an effect runs twice on mount, and does nothing in a build.
- `identifierPrefix` is the `useId()` prefix of the server render and of the app root (islands keep their own).
- `react.strictMode must be a boolean (got "yes")`, `react.identifierPrefix must be a string (got 1)`, `react needs the react adapter (framework is "vue")`. For the errors React reports, hook `app:error`.

### `app.spaLoadingTemplate`

Default: `app/spa-loading-template.html` when it exists.

- The HTML a shell document shows until the client has mounted: a path from the root, or `false` to ignore the file.
- `app.spaLoadingTemplate file not found: app/loader.html` for a missing one.

### `app.spaLoader`

Default: `{ tag: "div", attrs: {}, location: "body" }`.

The element around the template, `id="__hamur_loader"` set by Hamur; `location` is `"body"` or `"within"`. See [Build output](/build-output#the-loading-template-of-a-shell).

### `app.rootTag`

Default: `"div"`.

- Tag of the app root element, a lower-case HTML tag name.
- Void and raw-text elements (`script`, `img`, `textarea`, `body` and the like) fail at load: `app.rootTag "script" cannot hold an app`.

### `app.rootAttrs`

Default: `{}`.

- More attributes of the root element, written after `id` and escaped; `id` is `app.rootId`, so `rootAttrs.id` fails at load.
- The server document, the SPA shell, prerendered pages and `hamur dev` all write them.

### `app.importMap`

Default: `{}`.

- Specifier to URL for modules hosted elsewhere, merged into every document's import map (`hamur dev` writes only these); `import("remote/widget")` stays external in every build and is never hashed, so `build.sri` writes no `integrity` for it.
- A key starting with `#hamur-` or a value that is not an absolute `https:` URL or a path starting with `/` fails at load. There is no shared-library or federation mode.

### `app.teleportId`

Default: `"teleports"`.

`id` of the element that the document writes after the app root for teleports rendered on the server (Vue `<Teleport to="#teleports">`, Solid `Portal`).

### `app.teleportTag`

Default: `"div"`.

Tag of that element.

### `app.teleportAttrs`

Default: `{}`.

More attributes of that element, written after `id` and escaped.

### `app.manifest`

Default: unset.

- The web app manifest: an object of W3C manifest members, served at `<baseURL>manifest.webmanifest` as `application/manifest+json` and linked from every document.
- `name`, `description` and `start_url` default to `site.name`, `site.description` and `app.baseURL`; the static preset writes the file.
- `false` serves none.
- A `public/manifest.webmanifest` with `app.manifest` fails the build.

### `app.speculationRules`

Default: `false`.

- `false`, or `{ prefetch?, prerender? }`, each `"conservative"`, `"moderate"`, `"eager"`, `"immediate"` or `false`: writes one `<script type="speculationrules">` in every page document for the links the browser loads as documents (every same-origin link of a document with no client; `a[data-hamur-reload]` and `a[rel~="external"]` of one with a client).
- A route rule `speculation: false`, or `meta.rules: { speculation: false }` on a page, leaves paths out.
- See [Navigation](/navigation).

### `app.htmlLimitedBots`

Default: `HTML_LIMITED_BOTS`.

- A `RegExp` or `false`: a page request whose `user-agent` matches is rendered whole before it is sent, so head tags set after a `Suspense` boundary land in `<head>`, and `event.context.htmlLimitedBot` is `true`.
- The default, [`HTML_LIMITED_BOTS`](/api-reference/server) from `hamur/server`, lists link-preview and indexing bots that run no script (`facebookexternalhit`, `Twitterbot`, `Slackbot`, `bingbot` and others), not `Googlebot`; `false` streams to every client. Anything else fails at load with `app.htmlLimitedBots must be a RegExp or false (got "bot")`, and a pattern with the `g` or `y` flag with `app.htmlLimitedBots must not use the g or y flag, which makes each test start where the last one ended (got /bot/g)`.
- A route rule `stream` sets streaming per path, see [`RouteRule`](/api-reference/hamur#routerule).

### `app.streamTimeout`

Default: `10000`.

- Milliseconds a deferred value (a promise at the top level of what `load` returns) may stay pending.
- After that it is rejected with a 504 `Deferred value timed out`, and the streamed document ends once nothing else is pending; a page sent whole waits for its deferred values no longer than this.
- Anything but a positive integer fails at load with `app.streamTimeout must be a positive integer of milliseconds (got 0)`.

## Links, navigation and data in the browser

### `app.linkProtocols`

Default: `["http", "https", "mailto", "tel", "sms"]`.

- The schemes that a `Link`, `navigate()`, `navigateTo()`, `redirect()` or `sendRedirect` target may carry, written without `:` and in lower case.
- A path, `?query` or `#hash` target has no scheme and is not checked.
- See [Routing](/routing).

### `app.prefetchPreloadTags`

Default: `false`.

A prefetch that ran the target page's loads also runs their `head` exports and adds each `link rel="preload"` to the document as `rel="prefetch"`; the next navigation removes them.

### `app.cookieStore`

Default: `true`.

The browser jar follows the `cookieStore` `change` event where the browser has it, so a cookie another tab wrote reaches `useCookie` without a call to `refreshCookie`.

### `app.data.staleTime`

Default: `0`.

Milliseconds the browser keeps the data of a `load` fresh; `meta.staleTime` of a page overrides it. See [Data](/data).

### `app.data.gcTime`

Default: `300000`.

Milliseconds after a page stops showing its data before the browser deletes it; `meta.gcTime` overrides it.

### `app.data.staleReload`

Default: `"blocking"`.

`"background"` shows stale data at once and runs the `load` after the navigation.

### `app.data.refreshOnFocus`

Default: `false`.

A number of milliseconds: `refresh()` when the tab becomes visible, at most once in that time.

### `app.data.refreshOnReconnect`

Default: `false`.

`true` calls `refresh()` when the browser goes online.

### `app.asyncData.pendingWhenIdle`

Default: `false`.

`true` makes `pending` of `useAsyncData` and `useFetch` also true for an `idle` entry that has no data yet, for example one started with `immediate: false`.

### `app.pageTransition`

Default: `false`.

- `false`, or `{ name, mode?, appear?, duration? }`: on a client navigation that swaps the page, the entering elements get `<name>-enter-from` and `<name>-enter-active`, then `<name>-enter-to`, and a clone of each leaving element stays in place with the `<name>-leave-*` classes until the leave ends.
- `mode` is `"default"` (enter and leave together), `"out-in"` (the new page is `hidden` until the old one has left) or `"in-out"`; `appear: true` also enters the first client-rendered page, never a hydrated one; `duration` is milliseconds, or `{ enter, leave }`, and defaults to the CSS transition or animation time of the element.
- A page overrides it with `meta.pageTransition`: `false` turns it off, `true` is this value, an object merges over it key by key.
- Skipped under `prefers-reduced-motion: reduce`, for a hash-only or shallow navigation, `refresh()` and the error page.
- See [`PageTransition`](/api-reference/app#pagetransition-transitionmode).

### `app.layoutTransition`

Default: `false`.

As `app.pageTransition`, for a navigation that changes the layout; `meta.layoutTransition` overrides it. A layout swap runs this transition, not the page transition.

### `app.viewTransition`

Default: `false`.

- `true`, `"always"`, or `{ enabled?, types? }`: every client navigation runs inside `document.startViewTransition` with `types` plus `"forward"` or `"back"` as the transition types, and `document.documentElement.dataset.hamurDirection` holding the direction.
- `"always"` also runs under `prefers-reduced-motion: reduce`.
- `meta.viewTransition` of a page and `viewTransition` of `navigate` or a link override it (`false` turns it off). Not run on the first load, for a hash-only or shallow navigation or `refresh()`, or where `startViewTransition` is missing; there `app.pageTransition` and `app.layoutTransition` run, and they never run together with a view transition.
- See [`ViewTransitionOption`](/api-reference/app#viewtransitionoption-viewtransitioncall-viewtransitionhandle).

### `app.keepalive`

Default: `false`.

- `true` or `{ max? }`: a page keeps its component instances when a client navigation leaves it and is shown again with its state, until the entry above it leaves, the layout changes or more than `max` pages (default `10`, counted over the whole app, least recently shown dropped first) are kept.
- React keeps a page in `<Activity mode="hidden">`, Vue in `<KeepAlive>`, Preact, Solid and Svelte in `<div hidden data-hamur-keepalive>`; an html app keeps nothing and warns at load `app.keepalive has no effect in html apps (no component state)`.
- `meta.keepalive` of a page overrides it (`false` leaves a page out).
- A `max` that is not a positive integer fails at load with `app.keepalive.max must be a positive integer (got 0)`.
- See [`onPageActivated`](/api-reference/adapters#onpageactivated-onpagedeactivated).

### `app.navigation.pendingMs`, `app.navigation.pendingMinMs`

Default: `1000`, `500`.

- Milliseconds, `0` or more.
- `useNavigation().pending` turns `true` `pendingMs` after a client navigation started, which is also when its pending component (`*.pending.*`) shows; once `true`, the navigation's commit (the history write and the update of the page) waits until `pendingMinMs` have passed since it turned `true`, so a spinner or pending component never flashes.
- A navigation that ends before `pendingMs` never sets it and is never held.
- `meta.pendingMs` and `meta.pendingMinMs` of the target page override both, read once its chunks loaded; a `meta.pendingMs` that has already passed turns `pending` `true` at once.
- A value that is not a finite number of 0 or more fails at load with `app.navigation.pendingMs must be a finite number of milliseconds, 0 or more (got -1)`.

### `app.navigation.focus`

Default: `"heading"`.

- Where the keyboard goes after a client navigation, without scrolling: `"heading"` focuses the `#hash` target, else the first `[autofocus]`, else the first `h1`, else the app root, among the elements the navigation put on screen; `"root"` focuses the app root; `"none"` moves nothing.
- An element that is not focusable gets `tabindex="-1"` until it blurs.
- Skipped for a navigation that keeps the page with another query or hash only, `shallow`, `refreshAll`, `keepFocus: true`, `scroll: false`, a link under `data-hamur-keepfocus`, and while a text-entry control has the focus. Any other value fails at load with `app.navigation.focus must be "heading", "root" or "none" (got "h1")`.
- See [Focus after a navigation](/routing).

### `app.navigation.scrollKey`

Default: `"entry"`.

- How a saved scroll position is keyed: `"entry"` per history entry, so only back, forward and a reload restore it; `"path"` per pathname, so a push to a page you scrolled before restores that position too, unless the target has a `#hash` or the navigation passes `scroll: false`.
- Anything else fails at load with `app.navigation.scrollKey must be "entry" or "path" (got "url")`.

### `app.navigation.repaint`

Default: `true`.

- Whether a click on a link waits one animation frame and the task after it before the navigation starts (before `page:beforeNavigate` and the middleware), so the click's own styles, such as `:active` and the pending class, paint first.
- `false` starts the navigation at once.
- A hash-only click on the page on screen, `navigate()` and `useRouter()` calls from code never wait.
- A value that is not a boolean fails at load with `app.navigation.repaint must be a boolean (got "yes")`.

### `app.update.pollInterval`, `app.update.reloadOnNavigate`

Default: `3600000`, `true`.

- How a production client finds a newer deployment.
- `pollInterval` is a positive integer of milliseconds, or `false`: the client fetches `<baseURL>_version.json` that often while the tab is visible, and when the tab becomes visible again after 60 s or more; `false` turns both off, but an answer of `_hamur/fn/`, `_hamur/islands/` or `_hamur/components/` that carries another `x-hamur-build` still starts one check.
- `reloadOnNavigate: true` makes the next navigation after an update is known (a `Link`, `navigate()`, back or forward) a full load of its target; `false` leaves it a client navigation.
- `hamur dev` never checks.
- `useAppUpdate` and the `app:update` hook report the update.

### `app.restoreState`

Default: `false`.

- The default of `persistState` in `reloadApp`, so a reload Hamur starts (a chunk error, an app update, `usePwa().update()`) carries the app state over in `sessionStorage`: a `useState` value, a `Date` or a `Map` is back after the page has mounted.
- Values reach plain `sessionStorage`, which is why it is off by default.
- Reading the item back needs no key; see `reloadApp` in the app reference.

### `app.chunkErrors`

Default: `"reload"`.

- What Hamur does when a chunk fails to load after a deploy: `"reload"`, `"reload-immediate"` or `"manual"`.
- A page, layout or app-root chunk is tried twice; with `"reload"` and `"reload-immediate"` the second failure reloads the URL once per 10 s (the reload stamp), with `"manual"` it reloads nothing, calls `app:chunkError` with `reload: false` and shows the 503 error page, or the page as it is.
- An `import()` of your own code (a lazy component) that fails is thrown to its caller in every mode and reported to `app:chunkError` with `stage: "lazy"`; `"reload"` also checks for an app update, so the next navigation is a full load, `"reload-immediate"` also reloads the current URL once per 10 s, `"manual"` does neither.
- Any other value fails at load with `app.chunkErrors must be "reload", "reload-immediate" or "manual" (got "auto")`.

### `app.routeAnnouncer`

Default: `{ politeness: "polite" }`.

- `false`, or `{ politeness? }`: the hidden live region `#__hamur_announcer` that reads the new page (`document.title`, else the first `h1` that entered, else the path) to a screen reader after the scroll and the focus.
- `"polite"` gives `aria-live="polite"` and `role="status"`, `"assertive"` gives `aria-live="assertive"` and `role="alert"`, `"off"` gives `aria-live="off"` and no role; `false` creates no region and announces nothing. Not announced on the first load, for another query or hash only, `shallow`, `refreshAll` and `refresh`. Any other politeness fails at load with `app.routeAnnouncer.politeness must be "polite", "assertive" or "off" (got "loud")`.
- See [Announcing a page](/routing).

### `app.link`

Default: `{ activeClass: "router-link-active", exactActiveClass: "router-link-exact-active", pendingClass: "router-link-pending", externalRelAttribute: "noopener noreferrer", prefetch: true, prefetchOn: "interaction", prefetchDelay: 0 }`.

- The defaults of every `Link` and every [`defineLink`](/api-reference/adapters#definelink-uselink-linkdefaults-uselinkoptions) link, set in one place; a prop on the element still wins.
- `activeClass`, `exactActiveClass`, `pendingClass` and `prefetchedClass` (none by default) are class names; `externalRelAttribute` is the `rel` of a `target="_blank"` or other-origin link, `false` for none; `prefetch` and `prefetchOn` (`"interaction"`, `"visibility"`, `"tap"`, `"render"` or an object of those keys) set the prefetch of a link that gives neither `prefetch` nor `prefetchOn`; `prefetchDelay` is the milliseconds a hover or focus waits before it prefetches, for a link without the prop.
- A key of a wrong type fails the config load, for example `app.link.prefetchOn must be "interaction", "visibility", "tap", "render" or an object of those keys (got "hover")`. It is sent to the browser with the app config.

## A cache deadline for one kind of entry

````ts [cache-timeout-config.ts]
import { defineConfig } from "hamur"

export default defineConfig({
  framework: "react",
  routeRules: {
    "/prices": { cache: { maxAge: 60, maxResolveTime: 10 } },
    "/report": { cache: { maxAge: 3600, maxResolveTime: 0 } },
  },
})
````
