基于 Vite 的 React + TypeScript 项目启动器
typescript-react_best_practices-vite_template — Vite 启动器模板
作者 CodelyTV
CodelyTV 出品的 Vite + React + TypeScript 启动器模板,预置单元测试、端到端测试、代码检查与 CI 工作流。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
预置 Jest 与 React Testing Library 单元测试
预置 Cypress 与 Testing Library 端到端测试
ESLint 与 Prettier 采用 Codely 共享配置
包含 GitHub Actions 工作流,推送时运行测试与检查
提供 Makefile 与 .editorconfig,样式使用 Sass
模板详细介绍
该模板用于创建基于 Vite 的 React 应用,使用 TypeScript 编写,并按 CodelyTV 的实践预先配置好工程化工具。仓库提供 GitHub「Use this template」按钮和 degit 两种方式创建项目,README 中列出了创建后需要更新的元信息,包括 package.json 中的 name、author、license,LICENSE 中的作者,index.html 的标题,public 目录下的 favicon 以及 README 本身。
测试方面分为两层:单元测试使用 Jest 与 React Testing Library,通过 npm run test 运行;端到端测试使用 Cypress 与 Testing Library,需先启动开发服务器,再通过 npm run cy:open 或 npm run cy:run 执行。代码检查由 ESLint 与 Prettier 承担,采用 Codely 的共享配置,提供 lint 与 lint:fix 脚本。仓库还包含 GitHub Actions 工作流,在推送时运行测试与检查,并提供 Makefile 统一项目命令。样式使用 Sass,同时包含 .editorconfig 用于共享 IDE 配置。
README 的 FAQ 说明了选择 Vite 而非 Next.js、Remix 或 Create React App 的原因:React 官方推荐使用框架,但官方文档也给出了不使用框架时采用 Vite 或 Parcel 的方式,该模板面向不需要完整框架能力的场景,例如学习 React 自身的特性与边界。模板采用 MIT 许可,免费范围限于该版本代码,演示图片、字体、图标等第三方素材以及域名、托管、数据库等外部服务需另行核对许可或费用。
适合你的项目吗?
适用场景
- 创建不使用 Next.js 等框架的纯 React 单页应用
- 在项目初期就引入单元测试、端到端测试与代码检查
- 为团队项目统一 ESLint、Prettier 与 CI 配置
- 作为学习 React 自身特性与边界的练习项目基础
适合人群
- 希望以 Vite 而非完整框架启动 React 项目的开发者
- 需要开箱即用的测试与检查配置的 TypeScript 团队
- 想参考 CodelyTV 工程实践组织项目结构的学习者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
可通过 GitHub「Use this template」按钮创建仓库,或使用 npx degit CodelyTV/vite-react_best_practices-template#main my-app 创建本地项目
- 2
创建后需更新 package.json 的 name、author、license,LICENSE 的作者,index.html 的标题,public 目录的 favicon 以及 README
- 3
依次执行 cd my-app、npm install、npm start,开发服务器运行在 localhost:3000
- 4
单元测试使用 npm run test;端到端测试需先启动开发服务器,再运行 npm run cy:open 或 npm run cy:run
- 5
代码检查使用 npm run lint,自动修复使用 npm run lint:fix
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- MIT 许可要求保留原始版权与许可声明;使用模板创建项目时,README 建议将 LICENSE 中的作者改为你自己的信息,但不得删除或篡改原版权声明,需在副本或实质部分中保留 Codely 的版权与许可文本。
- 使用模板创建项目后需自行更新 package.json 中的 name、author、license 等元信息,并清理 README,模板本身不代为处理这些项目专属配置。
- README 中提及的 React 视频课程属于 Codely Pro 付费内容,需另行购买,不属于本 MIT 模板的免费范围;模板代码本身可免费使用。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Change the author in [`LICENSE`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/LICENSE)
README 原文
Update the [`package.json`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/package.json):
README 原文
https://github.com/CodelyTV/typescript-react_best_practices-vite_template/blob/main/LICENSEhttps://github.com/CodelyTV/typescript-react_best_practices-vite_template/blob/main/README.mdThis is something we do in [our React video course](https://pro.codely.com/library/react-de-0-aplicando-buenas-practicas-192069/460310/about/).
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-02。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 81 / 100
- 技术栈
- Vite · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2023-08-03
- 截图检查日期
- 2026-10-02
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Vite。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: d3389f639f66d22fcf202f20c3b561e21b2e58ebf0588aa885509505e070c8e5
2026-10-02T11:39:41.879Z
来源文件 / 仓库<p align="center">
<a href="https://codely.com">
<img src="https://user-images.githubusercontent.com/10558907/170513882-a09eee57-7765-4ca4-b2dd-3c2e061fdad0.png" width="300px" height="92px" alt="Codely logo"/>
</a>
</p>
<h1 align="center">
<⚡⚛️> Vite React Best Practices Template (by Codely)
</h1>
<p align="center">
<a href="https://github.com/CodelyTV/vite-react_best_practices-template/actions/workflows/tests.yml"><img src="https://github.com/CodelyTV/vite-react_best_practices-template/actions/workflows/tests.yml/badge.svg" alt="Build status"/></a>
<a href="https://github.com/CodelyTV"><img src="https://img.shields.io/badge/CodelyTV-OS-green.svg?style=flat-square" alt="Codely Open Source"/></a>
<a href="https://pro.codely.com"><img src="https://img.shields.io/badge/CodelyTV-PRO-black.svg?style=flat-square" alt="Codely Pro Courses"/></a>
</p>
<p align="center">
Template for creating React apps with TypeScript following best practices: Unit and end-to-end tests, Continuous Integration, and linting.
<br />
<br />
<a href="https://github.com/CodelyTV/vite-react_best_practices-template/stargazers">Stars are welcome 😊</a>
</p>
## ⚡ Using this Vite template
1. Create your project based on this template:
- a) If you want to create a GitHub repository, we would recommend to use the GitHub "Use this template" button and clone your newly created repository
- b) If you prefer to just create a local project, you can use [degit](https://github.com/Rich-Harris/degit):
```bash
npx degit CodelyTV/vite-react_best_practices-template#main my-app
```
2. Update your project meta-information:
- [ ] Update the [`package.json`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/package.json):
- [ ] Specify proper values for the `name`, `author` and `license` properties
- [ ] Remove the `private` property if you plan to publish the app as a npm package
- [ ] Change the author in [`LICENSE`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/LICENSE)
- [ ] Change the title in [`index.html`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/index.html)
- [ ] Replace the favicon in the [`public`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/public) directory
- [ ] Clean up this [`README.md`](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/README.md)
3. Run your app:
1. `cd my-app`: Move to your project root directory
2. `npm install`: Install all the project dependencies
3. `npm start`: Start the development server on [localhost:3000](http://localhost:3000)
## ✅ Testing
### Unit tests
`npm run test`: Run unit tests with Jest and React Testing Library
### End-to-end tests
1. `npm start`: Start the development server on [localhost:3000](http://localhost:3000)
2. Run end-to-end tests with Cypress choosing one of the following options:
- `npm run cy:open`: Open Cypress in dev mode
- `npm run cy:run`: Execute Cypress in CLI
## 🔦 Linting
- `npm run lint`: Run linter
- `npm run lint:fix`: Fix lint issues
## 🌈 Tech Stack
- [TypeScript](https://www.typescriptlang.org)
- [ESLint](https://eslint.org) and [Prettier](https://prettier.io) already configured with the [🤏 Codely's configuration](https://github.com/CodelyTV/eslint-config-codely)
- [Jest](https://jestjs.io) with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) for the unit tests
- [Cypress](https://www.cypress.io) with [Testing Library](https://testing-library.com/docs/cypress-testing-library) for the end-to-end tests
- [GitHub Action Workflows](https://github.com/features/actions) set up to run tests and linting on push
- [Makefile](https://github.com/CodelyTV/vite-react_best_practices-template/blob/main/Makefile) for standardize how to run projects
- [Sass](https://sass-lang.com) to supercharge CSS with nested classes and more fun
- [.editorconfig](https://editorconfig.org) for sharing the IDE config
## 🤔 FAQ
### 🤷♂️ Why Vite and not Next.js, Remix, or Create React App
React updated the official recommendation about how to start a new project. Previously, they recommended Create React App (CRA) and we did [this very same template based on CRA](https://github.com/CodelyTV/cra-template-codely), and right now they recommend to directly use a framework like Next.js, Remix, or Gatsby.
However, they also include an specific section in the official documentation on how to use React without a framework, and the recommended way is to use Vite or Parcel.
Even if not using a framework such as Next.js is something to double check, we are interested into having this template for use cases where you are not interested into the benefits of a complete framework. For instance, theses cases could be as simple as learning the React.js features and limitations in order to have a clear vision where React ends and a framework starts. This is something we do in [our React video course](https://pro.codely.com/library/react-de-0-aplicando-buenas-practicas-192069/460310/about/).
### 👻 Why not adding `.vscode` or `.idea` to the `.gitignore` template
These are folders created due to personal environment preferences. We should ignore these personal development environment preferences to be ignored using your global `.gitignore` file and leave the project `.gitignore` file as clean as possible, that is, only containing the project specific rules.
You can create a `.gitignore_global` file with rules that will apply to all your repositories with:
```bash
touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
```
## 👌 Codely Code Quality Standards
Publishing this package we are committing ourselves to the following code quality standards:
- 🤝 Respect **Semantic Versioning**: No breaking changes in patch or minor versions
- 🤏 No surprises in transitive dependencies: Use the **bare minimum dependencies** needed to meet the purpose
- 🎯 **One specific purpose** to meet without having to carry a bunch of unnecessary other utilities
- ✅ **Tests** as documentation and usage examples
- 📖 **Well documented ReadMe** showing how to install and use
- ⚖️ **License favoring Open Source** and collaboration
## 🔀 Related information
This application was generated using the [<⚡⚛️> Vite React Best Practices Template](https://github.com/CodelyTV/vite-react_best_practices-template). Feel free to check it out and star the repo! 🌟😊🙌
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

react-starter-kit
Modern React starter kit with Bun, TypeScript, Tailwind CSS, tRPC, Stripe, and Cloudflare Workers. Production-…
Vite · SaaS

cove
The Cove Stack: 🏝️ minimal TanStack Start template with Vite+, Better Auth, Drizzle ORM, shadcn/ui
Vite · SaaS

vite-react-boilerplate
A production ready, scalable starter template for Vite + React
Vite · 启动器

react-vite-admin
This Starter utilizes React, Recoil, React Query, React Hooks, Typescript, Axios And Vite. 全新技术栈的后台管理系统
Vite · 后台

cloudflare-starter-kit
Template (boilerplate) repository for scaffolding Cloudflare Workers projects
Vite · 启动器

vitejs-template-react-rescript
Integrating ReScript and rescript-react into the official Vite React template
Vite · 启动器
