Next.jsReact启动器

nextjs-v16-template — Next.js 启动器模板

作者 weaponsforge

基于 Next.js App Router 的极简启动模板,附带自定义 ESLint 规则与 Docker 配置,支持静态导出与 Docker standalone 两种构建方式。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

2 个预览视图
桌面端首页1 / 2
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 2

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-12查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

使用 Next.js App Router,应用代码集中在 /src 目录

02

内置自定义 ESLint 规则,并提供 lint 与 lint:fix 脚本

03

通过 IS_BUILD_STATIC 与 IS_BUILD_DOCKER 环境变量切换静态导出或 Docker standalone 构建

04

提供开发、生产、静态导出三套 Docker Compose 配置

05

支持作为 GitHub Template 快速创建新仓库

06

包含 types:check 脚本,先执行 next typegen 再检查 TypeScript 类型错误

模板详细介绍

这是一个面向 Next.js App Router 的极简启动模板,应用代码位于 /src 目录,仓库可作为 GitHub Template 直接创建新项目。模板内置自定义 ESLint 规则,并提供 Docker 开发与构建配置。

构建方面,模板通过环境变量区分两种输出:设置 IS_BUILD_STATIC=1 时执行静态导出,产物输出到 /nextapp/out;设置 IS_BUILD_DOCKER=1 时按 Docker standalone 模式构建,产物输出到 /nextapp/.next/standalone 与 /nextapp/.next/static。README 提醒两个变量不能同时为 1,且使用大量 React Server Components 或 Next.js 服务端特性的应用无法通过静态导出构建。

开发环境支持 Node 直接运行与 Docker 两种方式。在 Windows 上通过 Docker 运行时,需要设置 IS_WEBPACK=1 与 WATCHPACK_POLLING=true 才能获得热重载,因为该场景下 Turbopack 热重载不可靠。模板还提供 lint、类型检查等 npm 脚本,以及针对生产与静态导出的 Docker Compose 文件。

Next.js启动器

适合你的项目吗?

适用场景

  • 作为新 Next.js App Router 项目的起始骨架,在 /src 中编写页面与组件
  • 需要将前端应用导出为纯静态 HTML/CSS/JS 并部署到静态托管
  • 需要以 Docker standalone 模式打包并部署 Next.js 应用
  • 在 Windows 上通过 Docker 进行本地开发并需要热重载

适合人群

  • 希望从最小结构开始搭建 Next.js App Router 项目的开发者
  • 需要在同一模板中切换静态导出与 Docker 部署两种构建方式的团队
  • 使用 Docker 作为本地开发或交付环境的开发者
  • 需要自定义 ESLint 规则与 TypeScript 类型检查的前端项目

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    Node 版本建议 >= 24.11.0,Docker 为可选依赖

  2. 2

    克隆仓库后进入 nextapp 目录执行 npm install

  3. 3

    从 .env.example 创建 .env.local,并确保 IS_BUILD_STATIC 与 IS_BUILD_DOCKER 中只有一个为 1

  4. 4

    本地开发执行 npm run dev,默认访问 http://localhost:3000

  5. 5

    在 Windows 上通过 Docker 开发时,设置 IS_WEBPACK=1 与 WATCHPACK_POLLING=true 以启用热重载

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 构建时 IS_BUILD_STATIC 与 IS_BUILD_DOCKER 只能有一个设为 1,否则会产生构建冲突。
  • 使用大量 React Server Components 或 Next.js 服务端特性的应用无法通过静态导出构建,需先调整 next.config.ts 等设置。
  • 在 Windows 上通过 Docker 运行应用时,必须将 IS_WEBPACK 设为 1 才能启用热重载。
  • 在 Docker + Windows 环境下需将 WATCHPACK_POLLING 设为 true 才能热重载,因为该场景下 Turbopack 热重载不可靠。
  • 使用 Docker 前必须确保 3000 端口未被占用。
  • npm start 以生产模式运行应用,必须先执行 npm run build。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

> ⚠️ Ensure only one of `IS_BUILD_STATIC` or `IS_BUILD_DOCKER` has a value of `1` to avoid build conflicts.

README 原文

⚠️ Next.js apps that use heavy React Server Components (RSC) and Next.js server features will fail to build as a static output.

README 原文

⭐ **IMPORTANT**: When running the app via **Docker** on Windows OS (`docker compose up`), this must be set to `1` to enable hot reload.

README 原文

Set to `true` to enable Webpack-based hot reloading when running the app in Docker on Windows. Required because Turbopack hot reload is currently unreliable in this setup (Docker + Windows).

README 原文

> **IMPORTANT** > Ensure that port `3000` is free before proceeding.

README 原文

Runs the NextJS app in production mode. Requires running `"npm run build"` first.

README 原文
https://github.com/weaponsforge/nextjs-v16-template/blob/dev/LICENSEhttps://github.com/weaponsforge/nextjs-v16-template/blob/dev/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-12。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 80 / 100
技术栈
Next.js · React
网站类型
启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-10-12
截图检查日期
2026-10-12

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

审核声明: [email protected] · 2026-10-13

查看当时使用的来源资料

SHA-256: 6f901e871e17f64c13afcc30ccdd4a33756c89934b1cab495263e564f86ee4d6

2026-10-12T13:17:44.758Z

来源文件 / 仓库
## nextjs-v16-template

Barebones NextJS v16 React app template using the **App Router** with custom ESLint rules and Docker configurations.

> Next application code lives inside the `/src` directory.

> [!TIP]
> You may use this project as a **GitHub Template** for quick setup.<br>
> Click **Use this template** (upper right), then select **Create a new repository**

## 📋 Requirements

1. NodeJS (recommended: >= 24.11.0)
   ```
   node: 24.11.0
   npm: 11.6.1
   ```

2. Docker (optional)

## 📦 Core Libraries / Frameworks

<details>
<summary>This app uses the following libraries and frameworks</summary>

| Library | Version | Description |
| --- | --- | --- |
| Next | 16.3.0 | A React framework |
| React | 19.2.8 | Library for creating reusable/composable and interactive components |
| Tailwind CSS | 4.3.3 | Generic, composable utility classes for CSS styling |
| ESLint | 9+ | Enforces coding formats, rules and preferences |

</details>

## 🛠️ Installation

#### 1. Clone this repository or your fork/template.

```sh
git clone https://github.com/weaponsforge/next-v16-template.git
```

#### 2. Install dependencies.

```sh
cd nextapp
npm install
```

#### 3. Create a `.env.local` file from the `.env.example` file inside the `/nextapp` directory.

> ⚠️ Ensure only one of `IS_BUILD_STATIC` or `IS_BUILD_DOCKER` has a value of `1` to avoid build conflicts.

| Variable | Description |
| --- | --- |
| IS_BUILD_DOCKER | If value is `1`, builds the NextJS app for Docker in production using the standalone mode build into the `/nextapp/.next/standalone` and `/nextapp/.next/static` directories. |
| IS_BUILD_STATIC | If value is `1`, builds and exports the NextJS app into a static build in the `/nextapp/out` directory when running `"npm run build"`.<br><br>⚠️ Next.js apps that use heavy React Server Components (RSC) and Next.js server features will fail to build as a static output. Te enable true static export, [adjust necessary settings](https://nextjs.org/docs/app/guides/static-exports) in the `next.config.ts` file and the overall app before export. |
| IS_WEBPACK | Set to `1` to run the app in development mode using **Webpack**. <br><br>⭐ **IMPORTANT**: When running the app via **Docker** on Windows OS (`docker compose up`), this must be set to `1` to enable hot reload.|
| WATCHPACK_POLLING | Set to `true` to enable Webpack-based hot reloading when running the app in Docker on Windows. Required because Turbopack hot reload is currently unreliable in this setup (Docker + Windows). |

## 📖 Usage

Using Node

#### 1. Run the React app for local development.

```sh
cd nextapp
npm run dev
```

#### 2. Launch the local app website in a web browser at:

```
http://localhost:3000
```

#### 3. Edit the source code and wait for changes to display in the web browser.

View the [STRUCTURE.md](/docs/STRUCTURE.md) for guidance on how to structure project folders and files within this project.

#### 4. To build the React app

- For [static export](https://nextjs.org/docs/app/getting-started/deploying#static-export) (only frontend HTML/CSS/JS), set the environment variables `IS_BUILD_STATIC=1` and `IS_BUILD_DOCKER=0`.
- For [Docker standalone mode](https://nextjs.org/docs/app/getting-started/deploying#docker), set the environment variables `IS_BUILD_STATIC=0` and `IS_BUILD_DOCKER=1`.

- Run

   ```sh
   npm run build
   ```

   - This command exports the build artifacts to the `/nextapp/out` directory for **STATIC EXPORT** (`IS_BUILD_STATIC=1`).

   - This command exports the build artifacts to the `/nextapp/.next/standalone ` and `/nextapp/.next/.static` directories for **DOCKER STANDALONE MODE** (`IS_BUILD_DOCKER=1`).

## ⚡Alternate Usage

> [!TIP]
> Set `IS_WEBPACK=1` and `WATCHPACK_POLLING=true` to enable hot reloading in development mode when running in Docker on Windows, as Turbopack is currently unreliable in this setup.

<details>
<summary>Using Docker</summary>
<br>

Usage with Docker is an alternate option to using Node directly from the [Usage](#-usage) section.

> **IMPORTANT**
> Ensure that port `3000` is free before proceeding.

### Build the Development Docker Image

#### 1. Set up the environment variables for the `/nextapp` directory.

- Refer to the [Installation](#️-installation) section **# 3** for more information.

#### 2. Build the image for local development.

```sh
docker compose build --no-cache
```

> 💡 **INFO:** Do this step only once during initial installation. Re-run this step if there will be changes to the Dockerfile or after installing new Node libraries.

#### 3. Run the container for local development.

```sh
docker compose up
```

#### 4. Launch the local app website in a web browser at:

```
http://localhost:3000
```

#### 5. Edit the source code and wait for changes to display in the web browser.

### Other Docker Builds

1. **`docker-compose.prod.yml`** - packages the NextJS app into a standalone mode for Docker NextJS (app router) deployment.

   > Outputs build files in the `/nextapp/.next/standalone` and `/nextapp/.next/.static` directories.

2. **`docker-compose.static.yml`** - packages the frontend-only NextJS app into a static export.

   > Outputs build files in the `/nextapp/out` directory.

</details>
<br>

## 📜 Available Scripts

These scripts, compatible with running in Node and Docker, run various TypeScript scripts and tests.

<details>
<summary>👉 Click to expand the list of available scripts</summary>

### `npm start`

Runs the NextJS app in production mode. Requires running `"npm run build"` first.

### `npm run dev`

- Runs the NextJS app in development mode with hot-reload using Turbopack and NodeJS.
- Set `IS_WEBPACK=1` then run `"docker compose up"` to run the NextJS app in development mode with hot-reload using Docker from a Windows host.

### `npm run build`

Builds the NextJS app for production mode.

> ⚠️ **WARNING**: Ensure only one of `IS_BUILD_STATIC` or `IS_BUILD_DOCKER` has a value of `1` to avoid build conflicts.

- **Static export**<br>
   When `IS_BUILD_STATIC=1`: exports the frontend-only build artifacts to the `/nextapp/out` directory.<br>

   >⚠️ **NOTE**: Next.js apps that use Next.js server features will fail to build as a **static output**. Te enable true static export, [adjust necessary settings](https://nextjs.org/docs/app/guides/static-exports) in the `next.config.ts` file and the overall app before export.

- **Docker standalone mode**<br>
   When `IS_BUILD_DOCKER=1`: exports the NextJS app (uses app router) build artifacts to the `/nextapp/.next/standalone ` and `/nextapp/.next/.static` directories for Docker deployment.

   > ℹ️ **INFO**: See the `"npm run docker:build"` script to build the NextJS app for production mode using Docker (NextJS standalone mode build).

### `npm run lint`

Lints TypeScript source codes and files, checking for linting errors.

### `npm run lint:fix`

Fixes lint errors.

### `npm run types:check`

- Checks for TS type errors by generating run-time next-specific types via `"next typegen"` first.

</details>
<br>

## 📦 Docker Scripts

These scripts are called within the `Dockerfile` for building images.

<details>
<summary>👉 Click to expand the list of available scripts</summary>

### `npm run docker:webpack`

- Runs the NextJS app in development mode inside Docker using Webpack and NodeJS.
- Requires `IS_WEBPACK=1` in `.env.local`.
- Uses the `docker-compose.yml` Docker compose file.

> 💡 **NOTE**: To enable hot reloading, set `WATCHPACK_POLLING=true` in `.env.local`. This is required because Turbopack hot reload is not yet reliable for Next.js apps running in Docker on Windows.

### `npm run docker:build`

- Sets `IS_BUILD_DOCKER=1` and builds a Docker image containing a standalone NextJS build.
- Uses the `docker-compose.prod.yml` Docker compose file.

### `npm run docker:static`

- Sets `IS_BUILD_STATIC=1` and builds a Docker image containing a NextJS static export.
- Uses the `docker-compose.static.yml` Docker compose file.

> 💡 **INFO**: When running `docker compose up`
>
> You can also run `docker exec -it weaponsforge-next-v16-template-dev npm run docker:static` to build a static output.

## References

- Next (Turbopack) currently doesn't work in Docker <sup>[[1]](https://github.com/ymeskini/ai-app/issues/1)</sup>

</details>
<br>

@weaponsforge<br>
20260216<br>
20260403
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。