Note
This is template repository for website projects, and not a library. Check out library template.
git clone <repository-url> template-react
Node.js 26 or higher is required. The templates run TypeScript configuration and hooks directly with Node's built-in type stripping.
Node 26 no longer bundles Corepack, so install the pnpm version pinned in the packageManager field of package.json:
npm install -g pnpm@10.17.1Then install the dependencies:
pnpm installpostinstall registers the git hooks (via simple-git-hooks), so run pnpm install before your first commit. The pre-commit hook runs pnpm check, which formats the project, applies lint fixes, and then runs the tests.
This project follows specific conventions and rules for code style, data validation, testing, and more. Please refer to the following documentation for detailed guidelines.
Deploy the dist/ output over HTTP(S). The included deploy workflow
(.github/workflows/deploy.yml) builds with the GitHub Pages base path and
publishes the result as a GitHub Pages site. A plain pnpm build emits
relative asset URLs, so that output serves correctly from a domain root, a
GitHub Pages project site subpath (https://<user>.github.io/<repo>/), or via
pnpm preview. For History API routing below the domain root, rebuild with the
site's absolute base path, e.g. pnpm build --base "/<repo>/", before
deploying dist/, so the router links and the 404.html fallback shell
resolve against the real mount path.
This template uses clean BrowserRouter URLs. GitHub Pages serves the
SPA-bearing 404.html for a refresh or direct visit to a client route, so React
can render the matching page without changing the URL.
GitHub Pages fallback responses retain an HTTP 404 status even when React
renders a valid client route. This can affect SEO, crawlers, and link previews.
Unknown client routes render the application's Page not found view.
file:// viewing is unsupported.
Vitest has separate Node (tests/unit/) and jsdom (tests/browser/) projects. Browser fixtures use React Testing Library and exercise rendered user behavior, including route navigation.