Skip to content

Production checklist

What to set and check before an app takes real traffic. Each item says what Hamur does without your help and links the page that has the key. The self-hosting guide covers the image, the proxy and the stop.

Secrets and sessions

  • HAMUR_KEY is set in the environment of every instance, 32 bytes, and kept out of the image and the repository. A built server with a malformed key does not start, and one with no key throws HAMUR_KEY is not set. Keep the old key after a rotation: HAMUR_KEY=<new>,<old>. See The app key.
  • Every variable the app reads is declared in app/env.ts, and the config reads a secret only through env("NAME") (a storage url or encrypt, tasks.http.token, a route rule's basicAuth.password, a module's credentials), never as a literal. A HAMUR_<KEY> variable named after a runtimeConfig key changes nothing; the variables Hamur reads itself are listed. A misspelt name or a private entry under runtimeConfig.public fails the build, and a missing private value stops the server at start (Environment).
  • While you rotate a session password, useSession gets the new one first and the old one after it (Rotating the password).
  • Form posts carry a csrf() token bound to the session (CSRF).

Headers, origin and CSP

  • The three default headers are on (nosniff, strict-origin-when-cross-origin, SAMEORIGIN). Add hsts once every subdomain serves https (Security defaults, Header keys).
  • The cross-origin form check is on (server.originCheck, on by default); list an identity provider's origin in originCheck.allow instead of turning it off (Security defaults).
  • server.csp is set. It is off by default; mode: "auto" writes a nonce or hashes for the scripts Hamur and your UI library inline (Content Security Policy). Turn on csp.report to see violations (Violation reports).
  • server.trustProxy is on behind a proxy, with server.requestIP for the client address, or app.origin pins the public origin (Behind a proxy).

Build

  • build.sourcemap is unset or "none" unless you mean to publish the client maps; a production build writes none by default (hamur reference).
  • server.compress is on (the default) for bun and node, or the proxy compresses and you turned it off (Compression).
  • Pages that can be built ahead are prerendered (Prerender).
  • The preset is named in the config or HAMUR_PRESET; the build log says which one it built (Deploy).

Caches

  • A cached answer is the anonymous answer: the handler runs on a cache fork without the cookie or authorization, so a page that depends on the user needs varies or no cache (Route rules, Opting a request out).
  • With more than one instance, cache is a shared driver (Running several instances).
  • A handler's answer with a cookie, private or no-store is not stored; check a page that sets a cookie before you put a cache rule on it (Checking and shaping entries).

Observability

  • server.health is on and the proxy or orchestrator probes it (Health endpoint).
  • Logs go to a collector or to the host's log driver as JSON lines, the build's default; server.logRedact hides fields you must not keep (Logging).
  • server.requestLog, server.tracing and server.metrics are off in a build until you turn them on; a Prometheus scrape needs HAMUR_METRICS_TOKEN or prometheus.token, and token: false makes the endpoint public (Prometheus) (What is on by default, Metrics).
  • Errors are reported with the error hook or server.clientReports (Reporting errors, Client reports).

Errors

Run

  • The image runs as built, with HEALTHCHECK and a stop grace period of 30 seconds (Stopping).
  • hamur preview --check passes on the build before you ship it (hamur preview --check).