Repository navigation
Description
The vortex.dev app serves two sites from one Next.js tree, each with its own root layout: the marketing site in src/app/(site)/layout.tsx and bench in src/app/(bench)/bench/layout.tsx. Since #194 they share the header, the footer, the theme bootstrap, the fonts, and the Status card. They are still two <html> shells with two stylesheets, two page frames, and two sets of metadata. This issue scopes folding bench into the site's root layout and moving it to vortex.dev/bench. A bench page then is a site page that shows benchmark data.
What the split is today
Two root layouts. The site's renders Header, <main class="site-main">, and Footer around every page. bench's renders only a bench-frame div and the site's Footer. Each bench page renders its own header, <main>, and build-SHA line. The header is BenchHeader, the site's Header with bench's Toolbar in its tools. An sr-only h1 follows it. The page renders it, not the layout, because the Toolbar's filter dropdown takes the page's data.
bench's 404 is not-found.tsx, behind the [...notFound] catch-all. It exists only because global-not-found.tsx renders in the site's layout, which bench's paths cannot reach.
Two stylesheets. Each site loads the design system in its own order:
- the site: the tokens,
vortex-base.css(the system's reset, in@layer vx-base),vortex.css, and 152 lines of its own - bench: the tokens,
vortex.css, andsrc/bench/styles/globals.css, 1,834 lines with no layers
bench's file carries its own reset: * { box-sizing } and the html, body margins, background, faces, and size. It sets every heading in Geist Mono. It also holds the chart, group, and toolbar styles. bench does not load vortex-base.css, so the two sites do not start from the same base. src/bench/styles/tokens.test.ts checks only that bench's variables sit on the tokens. bench also has its own PostCSS config (src/bench/styles/postcss.config.mjs). Its Biome style differs too (single quotes, 100 columns).
Two hosts. next.config.mjs rewrites bench.vortex.dev's paths onto /bench, and /bench 404s on vortex.dev. So bench's HTML depends on the request's host. requestBenchBase() reads headers() in the layout, in BenchHeader, in the chart page, and in both read API routes. BenchBaseProvider hands the base to client components, and 15 call sites build links and fetches with benchPath() or useBenchPath().
The site side has the mirror image. Its links to bench go through benchHref(), which switches on VERCEL_ENV embedded in the client bundle. navLinks() takes a bench option so the header's links point back to https://vortex.dev from bench's host. The vx-theme cookie is one choice for all of vortex.dev's subdomains.
The CDN (Vercel's edge cache) keys a page by its URL, and bench's HTML differs between its two URL forms. So the rules in vercel.json cover only bench.vortex.dev's form of the landing, methodology, and chart pages. benchPrefixCdnRules adds the /bench form only outside production, because a cached /bench page must never answer for bench.vortex.dev.
Two sets of metadata and crawler files. bench sets no metadataBase, because it would resolve the favicon against bench.vortex.dev. It writes its canonical and Open Graph URLs in full from BENCH_URL, uses the siteName "Vortex Benchmarks", and serves its favicon from public/bench/. It has its own robots.txt, sitemap.xml, and llms.txt routes. bench loads no Plausible and no Vercel Analytics. The site's layout wraps its pages in both.
What one layout would take
One host. bench's public address becomes https://vortex.dev/bench, on every deployment, and bench.vortex.dev stops serving its own form of the pages.
With that, the host plumbing goes: the rewrite and the /bench 404 on the site's hosts, requestBenchBase(), BenchBaseProvider, benchPath(), and useBenchPath(). So do benchHref(), the VERCEL_ENV embed, and the bench option on navLinks(). The CDN keys on the path alone, so vercel.json covers /bench, /bench/methodology, and /bench/chart/:slug in production too, and benchPrefixCdnRules goes. metadataBase and relative canonicals serve both sites. The favicon is the site's one file, and one robots.txt and one sitemap cover both. The site's static pages stay static, because nothing in the shared layout reads the host.
bench.vortex.dev keeps working in one of two ways. A redirect sends every path to its new URL (/chart/x to https://vortex.dev/bench/chart/x), keeping the chart slug, the window query, and the filter. An alias keeps the host on the deployment, so bench.vortex.dev serves the same app as vortex.dev. The alias still needs the redirect for bench's old root-form URLs, since /chart/x is no longer a page on either host. It also serves every page twice, with a canonical on each. The redirect alone is the smaller change.
Either way, the ?n= 308s already send a window to its canonical URL. The redirect should resolve a window in one hop and not chain.
The published links that name the host move with it:
- the monorepo's PR benchmark comment and
BENCH_SITE_BASE_URLin the ingest contract (docs/bench/CONTRACT.md) - the README and docs.vortex.dev
bench-keep-warm.yml,bench-verify-deploy.yml, and the health cron invercel.json
One root layout, with (site) and (bench) as route groups under it. It renders the shell, the theme bootstrap, the fonts, the analytics providers, Header, <main>, and Footer once. bench's pages then render only their content. The Toolbar needs a way into the shared header that does not make each page render the header. That could be a slot the page fills, a parallel route, or a client store. The sr-only h1, the build-SHA line, and its lead placement on the landing page need homes in the shared frame.
bench's not-found.tsx, the [...notFound] catch-all, and NOT_FOUND_METADATA go away. global-not-found.tsx then covers bench's paths.
One stylesheet base. bench's globals.css drops its reset and its html, body rules for vortex-base.css. The PR then compares every element's computed style on the landing, chart, methodology, and 404 pages. It does so with and without JavaScript, in both themes, as the noDescendingSpecificity fix did. The parity check (scripts/parity/) compares screenshots at zero tolerance and exists for this. The PR runs it and explains each pixel that moves. The separate PostCSS config and the Biome style override can go in the same change or after it.
What has to stay true
bench must load fast, work without WebGL, and restore scroll on back. The ASCII mark mounts only on the homepage and the 404 today, and that must not change for bench's pages. The CDN must keep serving the landing, chart, and methodology pages from cache. /bench/api/health must keep answering on every host for the cron. No visual change lands without before and after screenshots and a preview to look at.
Tests and docs that pin the split and move with it:
src/app/(bench)/bench/layout.test.ts,page.test.ts,src/bench/lib/base-path.test.ts, and the two API route teststests/unit/styles.test.ts(both root layouts' faces),nav.test.ts,theme.test.ts, andbench-link.test.tstests/smoke.spec.ts,tests/a11y.spec.ts,scripts/parity/, andscripts/verify-web-deploy.mjslighthouserc.cjs(the three bench pages under/bench)- the "Repository layout" section of CLAUDE.md, and
docs/bench/web.md
Done means one root layout and one <html> shell. bench is at vortex.dev/bench, and bench.vortex.dev redirects to it. bench's pages render content only, bench loads vortex-base.css, and no code reads the request's host. The parity check and the Lighthouse floors pass.
🤖 Generated with Claude Code
Activity