Skip to content

Static frontend: a pre-rendered website

A public website that is pre-rendered at build time and served as plain files: React Router in framework mode with prerender: true, Vite, Tailwind CSS, TypeScript, pnpm. No server renders on request and no client JavaScript runs. The template and the other stacks are in the index; an interactive app is frontend-dynamic.md.

The reference is frontend/site in aise-feecheck-poc; every fact here was read from it, and the sources are linked where they are used. Its own account of how it is built: frontend/site/README.md.

Languages and versions

TypeScript (strict), React, React Router, Vite, Tailwind CSS, on Node.js with pnpm. Versions are fixed only in:

  • package.json: exact versions (saveExact: true in pnpm-workspace.yaml), packageManager for pnpm, engines.node for the lowest Node.js;
  • pnpm-lock.yaml, installed with --frozen-lockfile;
  • the CI workflow's node-version for the Node.js it builds with.

Sources: package.json, README.md#stack.

Build

The gate is the CI job's sequence, run from the site's folder:

pnpm install --frozen-lockfile
pnpm typecheck          # react-router typegen && tsc
pnpm test               # unit
pnpm test:output        # builds twice, tests the output
pnpm build              # pre-render into build/client
pnpm test:published     # scans build/client
pnpm test:e2e           # Playwright against build/client

pnpm build copies the icon sprite, runs react-router build, then deletes the client bundle React Router writes regardless. Only build/client is published; build/server is a by-product.

The site has its own build and workflow and never runs inside the backend's gate, nor the backend's inside it (ADR-0005 of the reference).

Formatting

Not enforced: no Prettier or other formatter in the build or a hook. Line endings follow the repository's .gitattributes (LF).

Linting and static analysis

TypeScript strict with verbatimModuleSyntax, through pnpm typecheck after react-router typegen generates the route types. No ESLint. Source: tsconfig.json.

Architecture rules

Enforced by tests on the build output rather than by a linter:

  • no client JavaScript: app/root.tsx renders no <Scripts />;
  • colours only from the token file, used through Tailwind classes; no style prop, no own CSS files beyond the Tailwind entry sheet and the tokens;
  • icons only from the shared sprite;
  • only PUBLIC_-prefixed variables reach the pages, so a secret never gets that prefix.

Sources: frontend/site/README.md "Conventions", the reference's docs/architecture/arc42.md §2.5.

Tests

Project Tool What it checks Needs
unit Vitest, Node environment the helpers and the scanners nothing
output Vitest two builds (with and without the one build variable): CSP, links out, the visible text against a reviewed snapshot a build, made by its global setup
published Vitest build/client as it will be published pnpm build
e2e Playwright, Chromium, served by sirv on 127.0.0.1 requests stay on the site, no CSP violation, the layout at 1280 and 360 px, light and dark pnpm build

All run offline except the browser download. Naming: each title starts with the criterion IDs (AC-2 · TC-5 · …), and the body is marked given / when / then. Sources: vitest.config.ts, playwright.config.ts.

Coverage and mutation

Not used. The output tests scan every page, which is what matters for a site without logic.

Accessibility and UI checks

@axe-core/playwright checks every page in light and dark against all WCAG 2.0 and 2.1 A and AA rules, contrast included, and fails on a check axe could not decide. Playwright also checks that no page scrolls sideways at 360 px. Source: tests/e2e/site.spec.ts.

Security and supply chain

  • Content Security Policy in a meta tag; the output test compares it with the spec's values written out, plus the additions the README lists, so a weakened policy fails.
  • Links out only to an allowlist in the README; the output scan also rejects credentials and source maps.
  • Dependencies: exact versions, the lockfile, --frozen-lockfile; Dependabot updates the npm dependencies weekly. Sonatype Guide before adding or upgrading one.
  • Headers a static host cannot send (X-Frame-Options, HSTS and others) are an accepted, documented exception for a site without data or session.
  • Code: the browser, headers and dependency classes of the security checklist (plugins/workflow/skills/ready/security-checklist.md) through workflow:ready. A meta-tag CSP cannot carry frame-ancestors: browsers ignore it there.

Code review

Copilot and the claude-review workflow on every pull request; workflow:ready before it (simplify, /code-review, /security-review, Aikido); see sdlc/quality-gate.md.

CI

A separate workflow, triggered only by changes to the site or the files it copies in. On a pull request it runs the build sequence above and uploads the Playwright report; on a push to main a second job publishes build/client to GitHub Pages. Actions pinned by SHA. No Windows job. Source: .github/workflows/site.yml.

Local setup and hooks

  • dev-env:dev-doctor checks Node.js; it does not check pnpm or the Playwright browser yet.
  • No pre-commit or pre-push hook for the site; CI is the gate.
  • pnpm exec playwright install --with-deps chromium once per machine before pnpm test:e2e.

Claude Code support

None specific: workflow:ready, git-flow and dev-env:dev-doctor apply as to any stack. Gaps: a frontend plugin (SPEC.md §4.6) with the conventions, test-title rule and mockup rules; a formatting hook like the backend's.

Gotchas

  • Keep ssr: true. ssr: false makes React Router add a SPA fallback that needs <Scripts />.
  • React Router writes a client bundle anyway; the build deletes it, since no page loads it.
  • The CSP blocks inline styles, so a style prop silently does nothing in the published site.
  • Run pnpm build before test:published and test:e2e; they test the existing output.
  • Playwright on a fixed port, never reused: sirv moves to the next free port when one is taken, and a reused server could be something else.