Next.jsReact启动器

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

作者 Khushal-ag

一个基于 Next.js App Router 的极简启动模板,集成 TypeScript、Tailwind CSS、ESLint、Prettier 与 Husky,附带站点配置与 SEO 元数据文件。

看看你的网站会是什么样

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

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

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

全部页面与视图 2

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

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

值得关注的模板亮点

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

01

基于 Next.js App Router 组织页面,源码分为 app、components、lib、styles 等目录

02

集成 TypeScript 严格模式、ESLint flat config、Prettier 与 Husky + lint-staged 提交前检查

03

使用 Tailwind CSS 的 CSS-first 配置,在 globals.css 中以 @theme 定义主题

04

提供 src/config/site.ts 集中管理 SEO、元数据、社交链接与 robots 配置

05

附带 dev、build、lint、type-check、fmt、validate 等 npm 脚本,validate 可用于 CI

06

默认使用 bun 并保留 bun.lock,同时说明切换其他包管理器的方法

模板详细介绍

这是一个面向新项目初始化的 Next.js 启动模板,仓库描述为「A Minimal Next.js Starter Template with TypeScript, Tailwind CSS, and pre-configured with ESLint, Prettier, and Husky」。它使用 App Router 组织页面,源码集中在 src/app、src/components、src/lib 与 src/styles 目录下。

模板内置了代码质量与格式化工具链:ESLint 采用 flat config 并整合 Next、TypeScript、Prettier 与 React Compiler 相关规则;Prettier 负责导入排序与 Tailwind 类名排序;Husky 配合 lint-staged 在提交前对暂存文件运行 ESLint 与 Prettier。样式方面使用 Tailwind CSS 的 CSS-first 配置方式,在 globals.css 中通过 @theme 定义主题。

项目提供了集中的站点配置文件 src/config/site.ts,用于填写名称、描述、URL、关键词、作者、社交链接、Twitter 卡片与 OG 图片等字段,Metadata、Open Graph、Twitter、sitemap 与 robots 均读取该配置。可通过 .env 中的 NEXT_PUBLIC_SITE_URL 覆盖基础 URL,使用 next/image 加载远程图片时需设置 NEXT_PUBLIC_IMAGE_HOSTS(逗号分隔、仅 https)。

使用限制方面:README 要求 Node.js ≥ 20.9.0;模板默认使用 bun 并保留 bun.lock,切换到 npm、yarn 或 pnpm 需先删除该锁文件。仓库采用 MIT 许可,免费范围限于该版本代码,演示图片、字体、图标等第三方素材以及域名、托管等外部服务需另行核对许可与费用。

Next.jsReact启动器

适合你的项目吗?

适用场景

  • 需要快速初始化一个带完整代码规范工具链的 Next.js 项目
  • 希望把 SEO 元数据、Open Graph、sitemap 与 robots 集中在一个配置文件里维护
  • 团队使用 ESLint、Prettier 与提交前钩子统一代码风格
  • 想以 Tailwind CSS 的 CSS-first 方式定义主题变量并搭建页面骨架

适合人群

  • 熟悉 Next.js App Router 与 TypeScript 的前端开发者
  • 需要为多个新项目复用同一套工程配置的团队
  • 希望以 MIT 许可代码为基础进行修改和二次分发的使用者

上手与定制指南

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

  1. 1

    环境要求 Node.js ≥ 20.9.0

  2. 2

    可用 bunx create-next-app -e "https://github.com/Khushal-ag/nextjs-template" <project-name> 创建项目,再执行 bun i 安装依赖

  3. 3

    Husky 在安装时通过 prepare 脚本设置 pre-commit 钩子

  4. 4

    如需切换 npm、yarn 或 pnpm,先删除 bun.lock 再安装依赖

  5. 5

    在 .env 中设置 NEXT_PUBLIC_SITE_URL,使用远程图片时设置 NEXT_PUBLIC_IMAGE_HOSTS(逗号分隔、仅 https)

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

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

使用时需要遵守

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

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 使用该模板需要 Node.js 版本不低于 20.9.0,低于此版本的环境无法运行。
  • 模板默认使用 bun 并保留 bun.lock;若要改用 npm、yarn 或 pnpm,必须先删除 bun.lock 再安装依赖。
  • 使用 next/image 加载远程图片时,必须设置 NEXT_PUBLIC_IMAGE_HOSTS 环境变量,值为逗号分隔的主机名且仅支持 https。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

Node.js ≥ 20.9.0

README 原文

The template uses [bun](https://bun.sh/) and keeps `bun.lock`. To use npm, yarn, or pnpm: remove `bun.lock`, then run `npm i`, `yarn`, or `pnpm i`.

README 原文

If you use remote images with `next/image`, set **`NEXT_PUBLIC_IMAGE_HOSTS`** (comma-separated hostnames, `https` only)

README 原文
https://github.com/Khushal-ag/nextjs-template/blob/main/LICENSEhttps://github.com/Khushal-ag/nextjs-template/blob/main/README.md

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

项目核对记录与介绍依据

模板资料

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

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

这个项目需要核对什么

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

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

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

查看具体选型方法 →

介绍的制作与核对状态

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

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

查看当时使用的来源资料

SHA-256: d805161b955caa44d8315957b4a4f839dc5e63c5adafefae210b925f4375bf48

2026-10-05T06:41:00.445Z

来源文件 / 仓库
<div align=center>

![views] ![stars] ![forks] ![issues] ![license] ![repo-size]

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="./public/nextjs-light.svg">
  <source media="(prefers-color-scheme: light)" srcset="./public/nextjs-dark.svg">
  <img alt="Next.js" src="./public/nextjs-light.svg">
</picture>

# Next.js Starter Template

A minimal Next.js starter with **Next.js 16**, **Tailwind CSS v4**, **TypeScript**, **ESLint 10** (flat config), **Prettier**, and **Husky**.

</div>

## Features

- **Next.js 16** – App Router, Turbopack, React Compiler (prod)
- **Tailwind CSS v4** – CSS-first config (`@theme` in `globals.css`)
- **TypeScript** – Strict mode
- **ESLint 10** – Flat config with Next, TypeScript, Prettier, React Compiler
- **Prettier** – Import sort + Tailwind class sorting
- **Husky + lint-staged** – Pre-commit: ESLint + Prettier on staged files

## Prerequisites

Node.js ≥ 20.9.0

## Getting Started

```bash
bunx create-next-app -e "https://github.com/Khushal-ag/nextjs-template" <project-name>
```

**Install dependencies**

```bash
bun i
# or: pnpm i | yarn | npm i
```

**Initialize git _(optional)_**

```bash
git init
git add .
git commit -m "init"
```

Husky runs on install (`prepare`) and sets up the pre-commit hook.

## Available Scripts

| Script       | Description                                  |
| ------------ | -------------------------------------------- |
| `dev`        | Start dev server (Turbopack)                 |
| `build`      | Production build                             |
| `start`      | Serve production build                       |
| `preview`    | Build and serve (production mode)            |
| `lint`       | ESLint + TypeScript type-check               |
| `lint:fix`   | ESLint with auto-fix                         |
| `type-check` | TypeScript type-check only                   |
| `fmt:check`  | Check Prettier formatting                    |
| `fmt`        | Format with Prettier                         |
| `validate`   | `lint` + `fmt:check` + `build` (for CI)      |
| `ui`         | Shadcn UI CLI                                |
| `clean`      | Remove `.next` cache                         |
| `cleani`     | Remove `.next` and `node_modules`, reinstall |

## Project Structure

- `src/app/` – App Router (layout, page, robots, sitemap)
- `src/components/` – React components
- `src/config/site.ts` – Site config (SEO, links, metadata)
- `src/lib/` – Utilities, fonts
- `src/styles/globals.css` – Global styles + Tailwind `@theme`

## Customization

Edit **`src/config/site.ts`** for your project:

- `name`, `description`, `url`, `keywords`
- `authors`, `creator`, `links` (repo, github, social)
- `twitter`, `ogImage`, `robots`

Set **`NEXT_PUBLIC_SITE_URL`** in `.env` to override the base URL (e.g. per environment). See `.env.example`.
If you use remote images with `next/image`, set **`NEXT_PUBLIC_IMAGE_HOSTS`** (comma-separated hostnames, `https` only), for example: `images.example.com,cdn.example.org`.

Metadata, Open Graph, Twitter, sitemap, and robots all use this config.

## After Installation

- [ ] Update `package.json` with your project details
- [ ] Update `README.md` and `LICENSE`
- [ ] Edit `src/config/site.ts`
- [ ] Replace or edit `src/app/page.tsx` and `src/app/layout.tsx`
- [ ] Remove or repurpose `src/app/client-components.tsx` if not needed

## Switching Package Manager

The template uses [bun](https://bun.sh/) and keeps `bun.lock`. To use npm, yarn, or pnpm: remove `bun.lock`, then run `npm i`, `yarn`, or `pnpm i`. Other lockfiles are in `.gitignore`.
`validate` is package-manager agnostic, so `npm run validate`, `pnpm validate`, `yarn validate`, and `bun run validate` all work.

## License

MIT – see [LICENSE](LICENSE).

## Contributors

<div align=center>

[![][contributors]][contributors-graph]

_It may take up to 24h for the [contrib.rocks][contrib-rocks] plugin to update._

</div>

[views]: https://komarev.com/ghpvc/?username=nextjs-template&label=view%20counter&color=red&style=flat
[repo-size]: https://img.shields.io/github/repo-size/Khushal-ag/nextjs-template
[issues]: https://img.shields.io/github/issues-raw/Khushal-ag/nextjs-template
[license]: https://img.shields.io/github/license/Khushal-ag/nextjs-template
[forks]: https://img.shields.io/github/forks/Khushal-ag/nextjs-template?style=flat
[stars]: https://img.shields.io/github/stars/Khushal-ag/nextjs-template
[contributors]: https://contrib.rocks/image?repo=Khushal-ag/nextjs-template&max=500
[contributors-graph]: https://github.com/Khushal-ag/nextjs-template/graphs/contributors
[contrib-rocks]: https://contrib.rocks/preview?repo=Khushal-ag%2Fnextjs-template
反馈内容错误

看看同类模板

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