基于 Next.js App Router 与 React 19,使用严格模式 TypeScript
scottish-government-website-template — Next.js 启动器模板
作者 FraserWillox
基于 Next.js App Router 与苏格兰政府设计系统的开源启动模板,用于搭建苏格兰政府网站与数字服务,提供首页、技术信息页、关于页及 Docker/CI 工程脚手架。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
集成 @scottish-government/designsystem-react 设计系统组件
内置 Vitest 单元测试、Playwright 端到端测试与 axe-core 无障碍扫描
提供多阶段 Docker 构建(非 root 运行)与 GitHub Actions CI 工作流
包含首页、技术信息页、关于页及错误/加载状态,页脚策略链接指向 gov.scot 政策页
站点配置集中在 src/config/site.ts 与 src/config/navigation.ts
模板详细介绍
这是一个面向苏格兰政府网站与数字服务的 Next.js 启动模板,由 Fraser Willox(Dream Tech Ltd 总监)创建并维护,采用 Apache-2.0 许可。模板整合了 Next.js App Router、React 19、严格模式 TypeScript 以及苏格兰政府设计系统的 React 组件包,并附带 Vitest 单元测试、Playwright 端到端与 axe-core 无障碍扫描、多阶段 Docker 构建和 GitHub Actions CI 工作流。
模板刻意保持精简:只包含首页、技术信息页、关于页,以及 not-found、error、global-error、loading 状态和每页显示的 Beta 阶段横幅,另有 /api/health 健康检查路由和 robots.txt。页脚的无障碍声明、隐私声明、Cookie 三个链接指向 gov.scot 对应政策页面,而非本地页面。布局与组件来自设计系统,仅 globals.css 中有少量自定义 CSS,不使用 Tailwind 或 CSS-in-JS。
需要特别注意:该仓库并非官方苏格兰政府服务,页面内容描述的是模板本身,上线前必须替换;模板不附带自己的无障碍声明、隐私声明或 Cookie 页面;页头、页脚和 favicon 使用官方苏格兰政府品牌资源(Crown copyright),不在模板自身 Apache-2.0 源码许可覆盖范围内,用于非真实、未授权的苏格兰政府场景前需查阅 NOTICE.md 与 public/branding/README.md。
适合你的项目吗?
适用场景
- 为授权苏格兰政府项目搭建新网站或数字服务的起始代码库
- 需要预先解决设计系统接入、无障碍导航与 Docker/CI 工程配置的团队
- 希望以 GitHub 模板方式快速创建仓库并替换示例内容的开发团队
- 需要单元测试、端到端测试与自动化无障碍检查作为起点的项目
适合人群
- 获得授权的苏格兰政府网站或数字服务交付团队
- 熟悉 Next.js、React 与 TypeScript 的前端工程师
- 需要以设计系统为基础、避免重复解决集成问题的项目
- 希望使用 Docker 与 CI 工作流部署的团队
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Node.js 20.9 或更高版本,推荐 Node 22 LTS;Docker 为可选项
- 2
克隆仓库后运行 npm install,开发时执行 npm run dev 并访问 http://localhost:3000
- 3
修改 src/config/site.ts 与 src/config/navigation.ts 配置站点信息与导航,并替换 src/app/ 下的示例内容
- 4
提交前运行 npm run check(依次执行 lint、typecheck、单元测试与构建)
- 5
不要将密钥或凭据写入受版本控制的文件,应使用 .env.local
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 Apache-2.0 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发;分发时需随附 Apache-2.0 许可证。
- 修改过的文件需显著标明改动,并保留相关版权、专利、商标及归属声明。
- 若原项目附有 NOTICE 文件,分发衍生作品时需保留其中适用的归属声明。
- 许可包含适用的贡献者专利授权;发起许可所述专利诉讼会终止该专利授权,且不授予商标使用权。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 Apache-2.0 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 该模板并非官方苏格兰政府服务,仅为团队搭建服务时的可复用起点,不代表真实政府政策、指南或内容。
- 页头/页脚品牌为官方苏格兰政府品牌,仅面向获得授权的苏格兰政府项目使用。
- 使用本仓库(含捆绑的苏格兰政府品牌)不表示获得苏格兰政府认可或与其存在关联。
- 捆绑的苏格兰政府品牌属 Crown copyright,不在模板自身 Apache-2.0 源码许可覆盖范围内。
- 模板不附带自己的无障碍声明、隐私声明或 Cookie 页面,采用方需自行决定是否创建本地版本。
- 首页、技术信息页与关于页内容描述的是模板本身而非真实服务,上线前必须替换。
- cPanel 静态导出为可选次要部署路径,不推荐用于真实服务,且不能替代 npm run build。
- 模板不包含身份验证、数据库或会话处理,需按服务实际需求自行添加。
- 模板刻意未提供完整 CSP,如需完整 CSP 需自行按 Next.js 官方指南配置中间件与 nonce。
- 自动化无障碍检查不能替代手动测试,需额外进行键盘、屏幕阅读器及真实用户测试。
查看原文依据
no-charge, royalty-free, irrevocable copyright license
许可证原文
> **This is not an official Scottish Government service.** It is a > reusable, deliberately minimal starting point for teams building one.
README 原文
The header/footer branding **is** the official Scottish > Government branding (bundled locally; see > [`public/branding/README.md`](public/branding/README.md)), included > because this starter is intended for authorised Scottish Government > projects.
README 原文
Use of this repository, including the bundled Scottish Government > branding, does not imply endorsement by, or affiliation with, the > Scottish Government.
README 原文
That branding is Crown copyright and is **not** covered by this template's own Apache-2.0 source licence.
README 原文
This template does **not** ship its own accessibility statement, privacy notice or cookies page.
README 原文
The Home, Technical information and About page content describes this template, not a real service. Replace it before launch.
README 原文
This is an **optional, secondary deployment path**, not a recommendation for how to deploy a real service. It does not replace `npm run build`:
README 原文
This template does not include authentication, a database, or session handling.
README 原文
**This is deliberately not a full Content-Security-Policy.**
README 原文
https://github.com/FraserWillox/scottish-government-website-template/blob/main/LICENSEhttps://github.com/FraserWillox/scottish-government-website-template/blob/main/README.md**Automated accessibility checks do not replace manual testing.**
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 80 / 100
- 技术栈
- Next.js · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-09-21
- 截图检查日期
- 2026-10-04
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: a8e0d36e992d09f7204808a85fe82a78a06dae642152fc20fad6e98009e5d21b
2026-10-04T08:39:13.317Z
来源文件 / 仓库# Scottish Government website template
A starter template for building Scottish Government websites and digital
services with Next.js, React, TypeScript and the
[Scottish Government Design System](https://designsystem.gov.scot/).
**Created and maintained by:** Fraser Willox, Director, Dream Tech Ltd
**Live demo:** <https://sg-template.fraserwillox.com>
> **This is not an official Scottish Government service.** It is a
> reusable, deliberately minimal starting point for teams building one.
> Nothing in this repository represents real government policy, guidance,
> or content. The header/footer branding **is** the official Scottish
> Government branding (bundled locally; see
> [`public/branding/README.md`](public/branding/README.md)), included
> because this starter is intended for authorised Scottish Government
> projects. See [NOTICE.md](NOTICE.md) before adapting this template for
> anything other than a genuine, authorised Scottish Government service.
> See also the About page in the running app.
>
> Use of this repository, including the bundled Scottish Government
> branding, does not imply endorsement by, or affiliation with, the
> Scottish Government.
This template is **open source**, licensed under the
[Apache License, Version 2.0](LICENSE). See
[Licence and branding notice](#licence-and-branding-notice) below for how
that licence relates to the Scottish Government Design System's own MIT
licence and to the bundled Crown copyright branding, which are not the
same thing.
## Quick start
```bash
git clone https://github.com/FraserWillox/scottish-government-website-template.git
cd scottish-government-website-template
npm install
npm run dev
```
Then open <http://localhost:3000>. From there:
1. Update [`src/config/site.ts`](src/config/site.ts) with your service's
name, description and links.
2. Update [`src/config/navigation.ts`](src/config/navigation.ts) with your
primary navigation.
3. Replace the example content in [`src/app/`](src/app/) with your own
pages.
4. Run `npm run check` (lint, typecheck, unit tests, build) before you
commit.
You can also use this repository as a
[GitHub template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template)
("Use this template" on GitHub) instead of cloning it directly.
## Where engineers customise this starter
| Location | Purpose |
| --- | --- |
| `src/config/site.ts` | Public, non-secret site configuration: name, description, phase banner wording, feedback destination, external links, branding asset paths, indexing. **Never commit secrets, API keys or credentials here**, or to any other source-controlled file: use `.env.local` instead. |
| `src/config/navigation.ts` | Primary header navigation and footer policy links |
| `src/app/` | Routes and page content (Home, Technical information, About, error/loading states) |
| `public/branding/` | Branding assets. See the licensing caution in [`public/branding/README.md`](public/branding/README.md) before reusing or replacing them |
| `.env.example` | Documents available environment variables; copy to `.env.local` for local overrides (git-ignored) |
| `next.config.ts` | Deployment output mode, response headers, and other Next.js configuration |
## 1. Overview
This template combines:
- **Next.js** (App Router) and **React 19**
- **TypeScript** in strict mode
- The **Scottish Government Design System React** components
(`@scottish-government/designsystem-react`)
- Automated unit and end-to-end/accessibility testing
- A production-oriented Next.js configuration and multi-stage Docker build
- A GitHub Actions CI workflow
It is deliberately small: a Home page, a Technical information page, an
About page, and the production engineering scaffolding (design system
wiring, accessible navigation, Docker/CI) already solved, rather than a
component showcase or a set of policy page templates. It exists so a
delivery team starting a new Scottish Government website doesn't have to
re-solve the same integration problems from scratch.
## 2. Disclaimer
This repository is **not itself a published Scottish Government service**.
It is maintained as a starting point for teams building one. In particular:
- The Home, Technical information and About page content describes this
template, not a real service. Replace it before launch.
- This template does **not** ship its own accessibility statement, privacy
notice or cookies page. The footer links to the corresponding gov.scot
policies instead. Adopting teams must decide whether their own service
needs local versions of these pages: see the About page and
[Pages included](#3-pages-included) below.
- The header, footer and favicon use the **official Scottish Government
branding**, bundled locally under `public/branding/`. That branding is
Crown copyright and is **not** covered by this template's own Apache-2.0
source licence. See [`NOTICE.md`](NOTICE.md) and
[`public/branding/README.md`](public/branding/README.md) before reusing
it outside a genuine Scottish Government context.
## 3. Pages included
| Route | Purpose |
| --- | --- |
| `/` | Home: a short introduction, getting started steps, and links to the other pages |
| `/technical-information` | Technology stack, what the template includes, testing and production notes, and how to adapt the starter |
| `/about` | Purpose, what to replace, contact and support |
| `/api/health` | JSON health check for container orchestrators |
Plus `not-found`, `error`, `global-error` and `loading` states, a Beta
`PhaseBanner` shown on every page, and a `robots.txt` route.
The footer's three policy links (Accessibility statement, Privacy notice,
Cookies) are ordinary external links to the corresponding gov.scot
policies (`https://www.gov.scot/accessibility/`, `/privacy/`, `/cookies/`),
not local pages. See `src/config/navigation.ts`.
## 4. Tech stack
- [Next.js](https://nextjs.org/) (App Router, standalone output)
- [React](https://react.dev/) 19
- [TypeScript](https://www.typescriptlang.org/) (strict)
- [`@scottish-government/designsystem-react`](https://www.npmjs.com/package/@scottish-government/designsystem-react) 1.2.1
- [`@scottish-government/design-system`](https://www.npmjs.com/package/@scottish-government/design-system) 4.2.0
- [Vitest](https://vitest.dev/) + [React Testing Library](https://testing-library.com/react)
- [Playwright](https://playwright.dev/) + [`@axe-core/playwright`](https://www.npmjs.com/package/@axe-core/playwright)
- [ESLint](https://eslint.org/) (`eslint-config-next`)
- Docker (multi-stage, non-root runtime)
No Tailwind, no CSS-in-JS, no general-purpose component framework: layout
and components come from the design system, plus a small amount of custom
CSS in `src/app/globals.css`.
## 5. Prerequisites
- Node.js 20.9 or later (Node 22 LTS recommended, matching CI and the
Dockerfile)
- npm (ships with Node)
- Docker, if you want to build/run the production container locally
(optional)
## 6. Installation
```bash
git clone https://github.com/FraserWillox/scottish-government-website-template.git
cd scottish-government-website-template
npm install
```
Use `npm ci` instead of `npm install` in CI or any environment where you
want an exact, reproducible install from `package-lock.json`.
PowerShell (Windows) is equivalent throughout: the commands above and
below work unchanged in `pwsh`/`powershell.exe`.
## 7. Local development
```bash
npm run dev
```
Then open <http://localhost:3000>.
## 8. Available npm scripts
| Script | Description |
| --- | --- |
| `npm run dev` | Start the development server |
| `npm run build` | Production build (standalone output) |
| `npm run build:cpanel` | Optional static export used for Fraser Willox's own cPanel demo deployment (see [§21](#21-optional-cpanel-static-demo-deployment)); not the recommended way to deploy a real service, and does not replace `npm run build` |
| `npm run start` | Start the production server from a build (see note below) |
| `npm run lint` | ESLint |
| `npm run typecheck` | `tsc --noEmit` |
| `npm run test` | Unit tests (Vitest, single run) |
| `npm run test:watch` | Unit tests in watch mode |
| `npm run test:coverage` | Unit tests with coverage report |
| `npm run test:e2e` | Playwright end-to-end and accessibility tests |
| `npm run check` | lint + typecheck + test + build, in sequence |
> **Note on `npm run start`:** because `next.config.ts` sets
> `output: "standalone"`, Next.js prints a warning that `next start`
> "does not work" with standalone output. In practice `next start` still
> works locally (it serves from the regular `.next` build output, which is
> produced alongside the standalone one). The warning is about
> *deployment*, where you should run `node .next/standalone/server.js`
> instead, exactly as the Dockerfile does. Playwright's local
> `webServer` config uses `next start` for convenience; the Docker image
> uses the standalone server.
## 9. Testing
- **Unit tests** (`npm run test`) use Vitest and React Testing Library.
They cover: home page rendering, technical information page rendering
(including the "What the template includes" table's accessible
semantics), about page rendering, primary navigation's current-page
state, the header logo, the footer's OGL and gov.scot logos (including
the exact Open Government Licence link text), the phase banner, and the
not-found page.
- **End-to-end tests** (`npm run test:e2e`) use Playwright against a
production build, at both a desktop and a mobile viewport
(`chromium-desktop` / `chromium-mobile` projects). They cover
navigation (including the mobile menu), the skip link, the phase
banner's feedback link, the footer's Open Government Licence link
(text, `target` and `rel`), and the 404 page.
- **Accessibility tests** (`e2e/accessibility.spec.ts`) run an automated
[axe-core](https://github.com/dequelabs/axe-core) scan (WCAG 2.0/2.2 A
and AA rules) against every public route (`/`, `/technical-information`,
`/about`), on both viewport sizes.
Deterministic and offline: no test depends on network access or real
timing beyond what Playwright/Vitest manage themselves.
**Automated accessibility checks do not replace manual testing.** Before
treating a real service as accessible, also test with a keyboard only,
with a screen reader, and, ideally, with people who have access needs.
## 10. Accessibility approach
This template targets WCAG 2.2 AA practices:
- Semantic landmarks (`<header>`, `<nav>`, `<main>`, `<footer>`), one `<h1>`
per page, and a logical heading hierarchy
- A skip link (design system `SkipLinks`) to a focusable `#main-content`
landmark
- Design system focus styles, left untouched (not overridden anywhere in
this template)
- `aria-current="page"` on the active navigation item: see
"Design system integration decisions" below for a fix this required
- `prefers-reduced-motion` respected for the one custom CSS transition
rule in `globals.css`
- No ARIA where native HTML already provides the semantics
## 11. Production build
```bash
npm run build
npm run start
```
`next.config.ts` sets `output: "standalone"`, `poweredByHeader: false`,
`reactStrictMode: true`, and a set of security response headers (see
[Security headers](#18-security-headerscsp-guidance) below). This is the
recommended, fully supported deployment model for a real Scottish
Government service built from this template. The optional cPanel/static
export described in [§21](#21-optional-cpanel-static-demo-deployment) is a
separate, secondary deployment path used only for Fraser Willox's own
demonstration site.
## 12. Docker usage
```bash
docker build -t scottish-government-website-template .
docker run --rm -p 3000:3000 scottish-government-website-template
```
The `Dockerfile` is a three-stage build (`deps` → `builder` → `runner`):
the final image runs as a non-root `nextjs` user, contains only the
standalone server output, `.next/static`, and `public/` (no source, no
dev dependencies), and defines a `HEALTHCHECK` against `/api/health`.
`.dockerignore` excludes `node_modules`, test artefacts, git metadata and
`.env*` files (except `.env.example`) from the build context.
## 13. Environment variables
See [`.env.example`](.env.example). Copy it to `.env.local` for local
overrides (git-ignored). Currently the available variables are:
| Variable | Purpose | Default |
| --- | --- | --- |
| `NEXT_PUBLIC_SITE_URL` | Absolute site URL, used to build absolute metadata URLs and `robots.txt` | `http://localhost:3000` |
| `NEXT_PUBLIC_ALLOW_INDEXING` | Set to `false` to disable search engine indexing (`robots.txt` disallow plus a page-level `noindex`). Defaults to allowing indexing | `true` |
The app runs correctly with no environment variables set at all: there
are no required secrets. **Never commit secrets, API keys or tokens** into
`.env.local`-tracked files, `src/config/site.ts`, or any other
source-controlled file.
## 14. Project structure
```
src/
app/ Routes (App Router): /, /technical-information,
/about, /api/health, robots.ts, error/loading states
components/
layout/ Site chrome: header, footer, phase banner, skip link, page wrapper
navigation/ next/link adapter for design-system linkComponent props
branding/ Header logo (BrandMark.tsx)
examples/ Technical information page's technology stack summary list
design-system-client/ "use client" wrappers for hook-using design system components
(currently Table.tsx, used by the "What the
template includes" table)
config/ site.ts (public site config), navigation.ts
(nav items, including the external gov.scot
footer links)
lib/ Small framework-agnostic helpers
e2e/ Playwright specs
public/branding/ Locally stored Scottish Government branding assets
deploy/cpanel/ Optional static demo deployment (see §21)
scripts/ Build scripts (currently just the cPanel export)
```
## 15. How to customise branding, content, metadata and navigation
- **Public, non-secret site values:** `src/config/site.ts` (site name,
description, phase banner wording, feedback destination, external
links, indexing, local branding asset paths). This file is for public
values only: never add credentials, API keys, tokens or other secrets
to it, or to any other source-controlled file
- **Primary and footer navigation:** `src/config/navigation.ts`
- **Page content:** edit the Home, Technical information and About pages
under `src/app/`
- **Environment-specific settings:** `.env.example` documents the
available variables; copy it to `.env.local` for local overrides
(git-ignored). See [Environment variables](#13-environment-variables)
- **Branding:** replace the files in `public/branding/` and
`src/components/branding/BrandMark.tsx` with your own organisation's
approved logo, and update the footer logos in
`src/components/layout/PrimaryFooter.tsx`. See
[`public/branding/README.md`](public/branding/README.md) for what is
bundled, its source, and the licensing caution that applies before you
reuse or replace it
- **Feedback destination:** `siteConfig.phase.feedbackUrl` in
`src/config/site.ts` defaults to this template's own GitHub Issues page.
Replace it with your own project's issue tracker, support mailbox or
feedback service
- **Deployment and response headers:** `next.config.ts` (see
[Security headers](#18-security-headerscsp-guidance) below)
- **Metadata:** each page exports its own `metadata` object (Next.js
Metadata API); the root layout in `src/app/layout.tsx` sets the title
template and default description from `siteConfig`
## 16. How to upgrade the design system
1. Read the [design system React changelog](https://github.com/scottish-government-design-system/designsystem-react)
for breaking changes, in particular to component props and the public
`components` import path.
2. Update `@scottish-government/designsystem-react` and
`@scottish-government/design-system` together (the former declares the
latter as a peer dependency).
3. Run:
```bash
npm ls @scottish-government/designsystem-react
npm ls @scottish-government/design-system
```
to confirm the resolved versions.
4. Re-check the deep `dist/components/...` imports documented below. A
new version may add a previously-missing component to the public
`components` barrel (or remove one from it).
5. Run `npm run check` and `npm run test:e2e`.
## 17. Deployment considerations
- Build with `output: "standalone"` and run `node .next/standalone/server.js`
(see the Dockerfile) rather than `next start` in production.
- Set `NEXT_PUBLIC_SITE_URL` to your real deployed origin so metadata URLs
and `robots.txt` resolve correctly.
- `NEXT_PUBLIC_ALLOW_INDEXING` defaults to allowing indexing; set it to
`false` for a staging/review deployment that shouldn't be crawled.
- The `/api/health` route is suitable for a load balancer or container
orchestrator health/readiness probe.
- This template does not include authentication, a database, or session
handling. Add whatever your service actually needs. If that changes
what people should be told about data collection or cookies, add your
own accessibility statement, privacy notice and/or cookies page (see
[Pages included](#3-pages-included)) rather than relying on the generic
gov.scot policies linked from the footer.
## 18. Security headers/CSP guidance
`next.config.ts` sets, on every route:
- `X-Content-Type-Options: nosniff`
- `Referrer-Policy: strict-origin-when-cross-origin`
- `Permissions-Policy`: camera, microphone, geolocation and FLoC/interest
cohort denied by default
- `Content-Security-Policy: frame-ancestors 'self'` for clickjacking
protection
**This is deliberately not a full Content-Security-Policy.** A robust CSP
that also restricts `script-src`/`style-src` needs either
`'unsafe-inline'` (which defeats much of the point) or per-request nonces
threaded through Next's rendering, which in turn needs middleware and
knowledge of your actual deployment (CDN, analytics, embedded widgets,
etc.) that this template can't assume. Adding a naive CSP here would
either break Next's own inline hydration data or give a false sense of
security. If you need a full CSP, follow the
[official Next.js CSP guide](https://nextjs.org/docs/app/guides/content-security-policy)
using middleware and nonces, once you know what your deployed service
actually needs to allow.
## 19. Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) and the
[Code of Conduct](CODE_OF_CONDUCT.md). Report security issues privately;
see [SECURITY.md](SECURITY.md).
## 20. Licence and branding notice
This template's own source code is open source, licensed under the
[Apache License, Version 2.0](LICENSE). It depends on the Scottish
Government Design System packages, which are separately MIT licensed under
Crown Copyright. **Neither that dependency's licence, nor this template's
own licence, grants rights to Scottish Government branding or the Scottish
Government logo.** See [NOTICE.md](NOTICE.md) for the full breakdown and
[`public/branding/README.md`](public/branding/README.md) for what to do
before using this template for a real, publicly branded service.
## 21. Optional cPanel static demo deployment
Alongside the standalone/Docker deployment above, which is the
recommended way to deploy a real Scottish Government service built from
this template, a separate static export is used for Fraser Willox's own
demonstration deployment at
[sg-template.fraserwillox.com](https://sg-template.fraserwillox.com), for
shared/static hosting with no Node.js runtime:
```bash
npm run build:cpanel
```
This is an **optional, secondary deployment path**, not a recommendation
for how to deploy a real service. It does not replace `npm run build`:
it's a separate script that builds a static `out/` directory, uploaded to
cPanel by hand, and it explicitly disables search engine indexing (see
[Environment variables](#13-environment-variables)). See
[`deploy/cpanel/README.md`](deploy/cpanel/README.md) for the full upload
and redeployment steps, and [`deploy/cpanel/.htaccess`](deploy/cpanel/.htaccess)
for the Apache configuration that ships with it.
---
## Design system integration decisions
A few things about `@scottish-government/designsystem-react` that aren't
obvious from its type declarations alone, discovered while building this
template, and worth knowing before you extend it:
- **`SiteNavigation` is not exported from the package's public
`components` barrel**, even though `SiteHeader`'s own types reference
it. It's imported here from `@scottish-government/designsystem-react/dist/components/SiteNavigation`,
the narrowest stable path that works. Re-check this on upgrade.
- **The package ships no `"use client"` directives at all**, despite many
components using hooks internally: `Accordion`,
`Checkbox`/`CheckboxGroup`, `RadioButton`/`RadioGroup`, `ErrorSummary`,
`NotificationBanner`, `SiteHeader`, `SkipLinks`, `SideNavigation`,
`SummaryList`, `Table`, `TextInput`, `Textarea` and
`ConfirmationNotification` will all crash if rendered directly inside a
server component. The Technical information page needs `Table` for its
"What the template includes" table, wrapped in
`src/components/design-system-client/Table.tsx`; the other pages don't
need any of the rest, but that folder and its own README document the
one-line `"use client"` re-export pattern (including the related
"compound sub-component" gotcha) to follow the moment you add a page
that does.
- **`SiteNavigation.Item`, `ContentsNav.Item` and `SideNavigation.Item`
accept an `isCurrent` prop, but don't forward the resulting
`aria-current="page"` to a custom `linkComponent`**, only to their own
internal fallback `<a>`. `Pagination.Page` does forward it; these three
don't. Since none of them spread extra props either, there's no other
way to pass it through. `src/components/navigation/NextLinkAdapter.tsx`
exports `createCurrentPageLinkAdapter(isCurrent)` to work around this,
used in `PrimaryHeader.tsx`.
- **Both `@scottish-government/designsystem-react` and
`@scottish-government/design-system` ship `.jsx`/`.ts` files whose own
internal `require()` calls omit the file extension** (their own build
step appears to emit `.jsx` rather than `.js` for anything containing
JSX, and some components `require()` small progressive-enhancement
behaviour modules straight from the base package's TypeScript source
rather than a compiled file). Both packages are listed in
`next.config.ts`'s `transpilePackages` so Next compiles them properly.
`clsx`, a runtime dependency the package uses but only declares as a
*dev*Dependency, is installed here directly for the same reason.
Vitest needs its own equivalent fix; see `vitest.setup.ts` and
`vitest.config.ts` for the details.
- **The mobile navigation toggle is progressively enhanced**: the
server-rendered markup is a `<label>`/hidden checkbox pair, but on
mount the design system's own script replaces it with an imperatively
created `<button>` and hides the original label. Playwright tests that
need to open the mobile menu wait for and click that button (see
`e2e/navigation.spec.ts`), not the original label.
No documented prop was invented to work around any of the above. Every
prop used in this template is present in the installed package's `.d.ts`
files.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

ai-website-cloner-template
Clone any website with one command using AI coding agents
Next.js · 启动器

Next.js SaaS Starter
Next.js SaaS Starter 是 Next.js 官方维护的 SaaS 起点模板,定位介于学习资源和可直接部署的脚手架之间。
Next.js · SaaS

Next.js Commerce
Next.js Commerce 是 Vercel 团队维护的电商启动模板,基于 Next.js App Router 构建,采用服务端渲染、React Server Components、Server Actions …
Next.js · 电商

Next-js-Boilerplate
Next-js-Boilerplate 是一个面向 Next.js 16、Tailwind CSS 4 和 TypeScript 的启动器,核心定位是开发者体验优先。
Next.js · 启动器

tailwind-nextjs-starter-blog
tailwind-nextjs-starter-blog 是一个面向个人技术博客的 Next.js 与 Tailwind CSS 启动模板,其 v2 版本基于 App Router 与 React Server Comp…
Next.js · 博客

next-forge
Production-grade Turborepo template for Next.js apps.
Next.js · 启动器
