Skip to Content

Mount path

The product is path-agnostic. By default it’s served at the root of its own domain — deploy it anywhere and every page, asset, route handler, and client fetch resolves correctly with no extra config.

To serve it under a prefix instead (e.g. behind another origin that proxies a subpath), set NEXT_PUBLIC_BASE_PATH (e.g. /app). One variable drives everything: apps/app/next.config.mjs feeds it to Next’s basePath (pages, _next/* assets, route handlers), and apps/app/lib/base-path.ts exposes it as BASE_PATH + a withBasePath() helper used for the URLs Next does not auto-prefix — fetch, WebSocket, and third-party authEndpoints. Set it on both build and runtime (it’s NEXT_PUBLIC_, so it’s inlined at build time).

On Vercel, apps/app/vercel.json serves the prefix at the deployment’s own root and the product’s icon at /favicon.ico, so the bare deployment URL (and the favicon Vercel’s dashboard shows for it) still works. It assumes the prefix is /app; change both rewrites if you pick another. Served at the root, the product’s own pages take precedence and the rewrites do nothing.

This is how the reference deployment serves all three apps under one domain: the marketing web app owns the apex and rewrites /app/* to this project (apps/homepage/vercel.json), and this project sets NEXT_PUBLIC_BASE_PATH=/app.

Last updated on