This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.

Routes and web documents

Declare at most one routes <slot> in the app's root file. Each row names an absolute path pattern, optional tab membership, parentage by indentation, and optional rendering/activation policies. notfound is a bare fallback: with none, the compiler writes it and a "Page not found" screen with a way home (the location keeps its URL); write it to draw your own. Do not redeclare the implicit router state with state.
Assign the results of open, push, replace, go, select, or back to that router state. Use path("route", args…) to construct checked locations. A template literal as a location is refused (route-template) and a string literal is checked against the table, but any other computed string is not checked, so always build locations with path(). A route's parameter fields are strings, with empty strings for absent fields. select takes a tab name, not a URL.
open replaces the destination tab's stack with its declared route chain, from root through destination, and leaves the other tabs as they were. For a direct child this is [root, child], so Back returns to the root; deeper destinations retain their declared intermediate ancestors. Use push to retain the visited screens instead. Signing out of an app with tabs, open(nav, "/") alone keeps the last account's screens in the other tabs: open each tab's root, the tab to land on last, nested because an action's writes land when it ends (nav = open(open(nav, "/history"), "/")).
for entry in stack(nav) key=entry.id gives retained screens their identities. Bind the host's navigation root and per-entry navigationKeys as the router fixture demonstrates. Test back, tab switching, the same-URL push, external navigation, and route parameters.
Exact's web servers use declared routes for file-like deep links: /profile/:handle admits a navigation to /profile/photos.zip. Existing public files win; unmatched file paths stay 404, even with notfound.
A route literal may hold Unicode and spaces as they are ("/item/café") or escaped; a pattern may not end in a space, which a browser trims: drop it, or write it %20. A literal spells an escape as a browser sends it: the router matches a path only as written, while a host serves every spelling from one file. An escape of a character a URL carries as itself (%41 for A) or one in lower case (%c3) is refused (route-pattern), naming the spelling to write. A render=build page is written at its path decoded (/item/caf%C3%A9 to item/café/index.html), but for what no file name may hold on every system, which stays escaped: a separator, %, <>:"|?*, a control character, a trailing dot or space, and a Windows device name's first letter (/docs/con to docs/%63on/index.html). serve looks pages up by that name; two pages that would share a file are refused.
A built site, hosted. bun exact.mjs web-build --out dist writes the site to dist/, a release build as deploy makes one (no agent mode): a page for each render=build route (rendered under Bun unless the app has a render entry of its own), 404.html for a notfound route rendered so, shell.html, and routes.json, the route table in the plan's order with each route's pattern, render policy and notfound. A route whose render draws randomness (crypto.getRandomValues or crypto.randomUUID, for example) cannot be render=build, since its page would give every reader the same random values: the build fails, naming the route; declare it render=request or render=client instead. A notfound route declared render=build renders at /404.html, so a route whose pattern matches that location, such as post "/:slug", fails the build, naming the route: give it another pattern or declare the notfound route render=request or render=client. An app with routes also gets robots.txt, which allows every path, and with app.json's app.origin a sitemap.xml of the pages made at build, by the render server's rule: not the notfound page, a page whose status is neither 200 nor 503 (a render at its deadline), or one whose head says robots="noindex" or "none". A page rendered per request is not made at build, so the built sitemap does not list it. A declared route at /robots.txt or /sitemap.xml keeps that path instead of a generated file. Inside the app, --out is dist (or a path under dist/ or target/), which no build reads as source; the build it replaces is kept beside it in dist.gen while a page sent from it may still ask for its files, and --out refuses a directory beside which something else holds one of those names (dist.gen, dist.previous, dist.lock). bun exact.mjs serve dist serves it on 127.0.0.1 (--lan: every interface), and any static host serves it by the same rule: a file at the path; else, for a browser's navigation to a path a route matches, shell.html with 200; else 404.html with 404. A host with a single fallback page serves shell.html for every page it lacks, and the client draws the notfound route. For a route declared render=request or cached, the home route's too, serve renders the page for the request under Bun from the build it serves (a cached page kept 60 s), so it arrives with its data; so is a miss, with 404, when the notfound route is declared so. A static host serves their shell. npm start runs bun exact.mjs serve, which with no directory serves the last web-build without --out.
On Apple, a launch that no link starts opens at the manifest's start_url (for example "/today", / by default), as an installed web app does; Apple builds bake it in. Linux and Windows open at / without a launch location. A launch that a link starts opens where the link goes.
For a custom scheme, declare protocol_handlers in app.json, for example [{"protocol":"web+notes","url":"/open?u=%s"}]. The Apple hosts and Android register that scheme. An incoming web+notes://auth/callback#done reaches /open with the complete original URL percent-encoded in u; read it with searchParam(top(nav), "u"). The handler needs an /open route and a navigation root with navigate=. At cold launch it is the initial location; when already running, each link fires one navigate event in arrival order. A scheme registered with host.ios.urlSchemes or host.macos.urlSchemes alone needs no /open route: the link arrives as its path. A non-empty authority is the first segment and an empty one is none, so notes://post/42?x=1, notes:///post/42?x=1 and notes:/post/42?x=1 are all /post/42?x=1. Expo's Linking.createURL("/post/42") writes the three-slash form. For the app's own web addresses, declare "handle_links": "preferred" beside app.origin (and scope, scope_extensions to narrow or widen the claim): iOS, macOS and Android then open links to them in the app, at the link's path, once the origin serves the association files the web build writes or prints (reference.md, "Verified https links"). A drive on macOS, iOS or the Android reader delivers a link as the system would, without iOS's "Open in …?" alert: type <root> "web+notes://auth/callback#done". For a packaged-only scheme, use [{"protocol":"notes","url":"/open?u=%s","distribution_only":true}]. Apple archives and --distribution builds register it; local builds omit both its scheme and template. --bundle or --release alone does not enable it. On Android a production build (--bundle) registers it and a development build omits it. Web builds copy this key into the web app manifest, without http and https; the browser decides which schemes it supports and whether the installed app is registered. A Mac web browser declares https and http together, each with the same url and the same distribution_only: a web link, and an HTML file Finder opens in the app (as its file: URL), reach that template. The person makes the app the default browser in System Settings. On iOS, host.ios.webBrowser: true registers the pair and signs the managed browser entitlement; Apple approval and a provisioning profile granting it are required. Without this opt-in iOS registers neither, and host.<platform>.urlSchemes refuses both (Exact developer reference, its table).
Every route (a node with a navigationKey under the root) is a direct child of the root or of a role="tabpanel" named by a direct role="tab" child of its first linked role="tablist", through aria-controls. Unlinked tablists do not select a stack. Routes may pass through for and if, never another element: the compiler refuses one behind a wrapper or in an unlinked panel (lower-route-place). Make each route position="absolute" inset=0: the hosts hide a covered route, as visibility: hidden does, so an in-flow route still takes its room. A covered route stays mounted (its nodes are in tree, marked [hidden], or [inactive] beneath a sheet, which still shows it), so a testId two screens share names two nodes: give each screen its own (list-error, detail-error).
Content taller than a native route needs a scroll container. An unpresented iOS route has a page viewport when its navigation root scrolls, preserving the root's scroll axes. Under native chrome, resizes-visual also supplies a page viewport that accommodates the keyboard without layout reflow. Otherwise put scrolling content in a scroll or list with flex=1 min-height=0 right after its header. Use an outer scroll when a document contains smaller scrollers, so content outside them remains reachable.
text
column navigationKey=`${e.id}` position="absolute" inset=0 display="flex" flex-direction="column"
header
text "Inbox"
scroll flex=1 min-height=0
…
That scroller is the route's content scroller with nothing written: the first in the route that scrolls vertically. On iOS it goes under the bar and collapses a large title, which happens when it is the route's child right after its header (in a route with no header, its first child); with content between them (a switcher, a filter, an error line) the title keeps still and that content sits below the bar, large title included; a tap on the status bar, or on the selected tab at its root, scrolls it to the top. A route with several scrollers names a different one with navigationScroll, by its id. The compiler refuses a literal name that no element of the route carries, or one whose element is a box that never scrolls on y (lower-route-scroll).
For a route's bottom actions, put the scroller and then one toolbar row directly in the route's column. Give the scroller the remaining space.
text
column navigationKey=`${e.id}` position="absolute" inset=0
scroll flex=1 min-height=0
…
row role="toolbar" toolbarPlacement="bottom"
button press=reshape
text "Reshape"
spacer
button press=openWidget
text "Widget"
On iOS and iPadOS the source row leaves the page. Its buttons become the route's native toolbar items and each spacer becomes a flexible space. The toolbar follows the route through navigation. UIKit includes it in the safe area, so the scroller's last row can scroll clear. Every other host lays out each live row where the author put it.
On an iPhone, UIKit draws a navigation toolbar's buttons under the app's bottom tab bar, which can cover them. Hide the tablist on the pushed route that owns the toolbar. For a route named detail, give the existing tablist this display.
text
row role="tablist"
display=(top(nav).name == "detail" ? "none" : "flex")
For several toolbar routes, join their name checks with or in the same display. UIKit keeps the tabs hidden if you push another screen from Detail. Pop back past Detail to the tab root and the tabs return. At a tab root, put the actions in the header or push the screen. This display applies on every host. Only iPhone needs the adjustment for its bottom tab bar.
A bottom toolbar must be a direct child of the route's column. An app that ships iOS can put only buttons and spacers in it. The compiler refuses two unconditional bottom toolbar rows and warns when an unconditional sibling follows a toolbar. If conditions or a loop emit several, UIKit uses the first in document order, leaves all source rows out of the page and writes one journal entry naming the route.
Is this helpful
Last updated November 30, 2026
Exact Docs