ViteReact启动器

shadcn-vite-starter — Vite 启动器模板

作者 7ovr

一个基于 Vite 与 React 的启动器,预置 TanStack Router、Query、Form、Table,shadcn/ui on Base UI、Tailwind CSS v4 与严格 TypeScript,并附带测试、Lint 与面向编码代理的约定文件。

看看你的网站会是什么样

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

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

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

全部页面与视图 2

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

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

值得关注的模板亮点

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

01

预置应用外壳:可折叠侧边栏、搜索、Ctrl+K 命令菜单、明暗主题与手机端抽屉

02

TanStack Router 文件路由,按路由代码分割,loader 可预取数据

03

TanStack Query 缓存与 URL 分页参数,首页示例表格从 PokéAPI 加载

04

TanStack Form 与 Zod 校验,错误聚焦并打开预填的 GitHub issue 表单

05

TanStack Table 支持排序、筛选与分页,列宽固定并在手机端收起

06

包含 CLAUDE.md、AGENTS.md 与四个 vendored 技能,面向编码代理优化

模板详细介绍

该模板是一个可直接运行的 Vite + React 单页应用启动器,而非空白页。它内置应用外壳:可折叠侧边栏(含搜索)、Ctrl+K 命令菜单、明暗主题,以及手机端抽屉。数据获取通过统一 Axios 客户端与 TanStack Query 完成,路由 loader 可在页面渲染前预取数据,分页参数保存在 URL 中。首页示例表格从免费 PokéAPI 加载数据,测试使用本地假 API,不访问网络。表单示例使用 TanStack Form 与 Zod 校验,提交后聚焦首个错误字段,并打开预填的 GitHub issue 表单。表格基于 TanStack Table,支持排序、筛选与分页。项目使用严格模式 TypeScript,并通过 Oxlint、oxfmt、Vitest 与生产构建在 CI 中检查。仓库包含 CLAUDE.md 与 AGENTS.md,以及四个 vendored 技能,用于让编码代理遵循约定。

使用限制:需要 Node 24 或更新版本、pnpm 12 或更新版本。shadcn CLI 暂时固定在 4.21.3,其传递依赖 braces 存在未修补的安全公告,模板保留该 CLI 及其样式表,但该漏洞并未被移除;应使用 pnpm exec shadcn 运行已安装版本,而非拉取 shadcn@latest。示例数据来自 PokéAPI,移除示例需按 README 步骤删除对应文件与引用。

ViteReact启动器

适合你的项目吗?

适用场景

  • 需要快速启动一个带有应用外壳与数据表格的 Vite + React 单页应用
  • 希望使用 TanStack Router、Query、Form、Table 与 shadcn/ui 的完整集成示例
  • 需要为编码代理提供明确约定与技能文件的项目起点
  • 想要在 CI 中运行 Lint、格式检查、类型检查、测试与生产构建的模板

适合人群

  • 熟悉 React、TypeScript 与 Vite 的前端开发者
  • 需要以 shadcn/ui 与 Tailwind CSS 构建管理界面或数据展示页面的项目
  • 希望借助编码代理辅助开发并遵循统一约定的团队
  • 需要 MIT 许可下可自由修改与商用的启动代码

上手与定制指南

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

  1. 1

    需要 Node 24 或更新版本,以及 pnpm 12 或更新版本

  2. 2

    克隆仓库后执行 pnpm install,再运行 pnpm dev 启动开发服务器

  3. 3

    复制 .env.example 为 .env 并按需填写环境变量,.env 已被 Git 忽略

  4. 4

    shadcn CLI 固定在 4.21.3,请使用 pnpm exec shadcn 而非 shadcn@latest

  5. 5

    移除 PokéAPI 示例需删除 src/features/pokemon/ 并清理相关引用,具体步骤见 README

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

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

使用时需要遵守

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

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 使用该模板需要 Node 24 或更新版本,以及 pnpm 12 或更新版本,低于此版本的环境无法按文档运行。
  • shadcn CLI 被暂时固定在 4.21.3 版本,并禁用了其 Renovate 更新,不能自动升级到更新版本。
  • 必须使用 pnpm exec shadcn 运行已安装的 CLI 版本,不应拉取 shadcn@latest,否则会绕过版本固定。
  • 安装 7Ovr Pro 区块需要 7Ovr 账户并在 .env 中设置 REGISTRY_TOKEN,属于需要账户与令牌的付费/受限功能。
  • 首页示例表格依赖外部免费服务 PokéAPI,使用该示例需要访问该外部 API。
  • 若将 VITE_API_URL 设为 /api,开发服务器会把请求转发到 http://localhost:8080,需要本地后端在该端口运行。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

You need Node 24 or newer and [pnpm](https://pnpm.io) 12 or newer.

README 原文

The shadcn CLI is temporarily held at **4.21.3**, with its Renovate updates disabled.

README 原文

Use `pnpm exec shadcn` to run the installed version rather than fetching `shadcn@latest`.

README 原文

For Pro blocks, set `REGISTRY_TOKEN` in `.env` to the token from your 7Ovr account, then install from the Pro registry:

README 原文

The Home table loads from the free [PokéAPI](https://pokeapi.co).

README 原文

With `VITE_API_URL=/api`, the dev server forwards every `/api` request to `http://localhost:8080`.

README 原文
https://github.com/7ovr/shadcn-vite-starter/blob/master/LICENSEhttps://github.com/7ovr/shadcn-vite-starter/blob/master/README.md

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

项目核对记录与介绍依据

模板资料

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

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

这个项目需要核对什么

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

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

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

查看具体选型方法 →

介绍的制作与核对状态

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

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

查看当时使用的来源资料

SHA-256: 2bededb5a8a94a129ffafb8ddba22b3b1420153f244a7d9182dce000463f591a

2026-10-07T19:04:50.292Z

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

<picture>
  <source media="(prefers-color-scheme: dark)" srcset=".github/assets/logo-dark.svg" />
  <img src=".github/assets/logo-light.svg" alt="7Ovr" width="56" height="56" />
</picture>

<h1>7Ovr Starter</h1>

<p><strong>A Vite and React starter with the whole stack already wired.</strong><br />
TanStack Router, Query, Form and Table, shadcn/ui on Base UI, strict TypeScript 7 and a test suite, optimized for coding agents.</p>

<p>
  <a href="https://github.com/7ovr/shadcn-vite-starter/actions/workflows/ci.yml"><img src="https://github.com/7ovr/shadcn-vite-starter/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License" /></a>
  <img src="https://img.shields.io/badge/node-%3E%3D24-339933?logo=nodedotjs&logoColor=white" alt="Node 24 or newer" />
  <img src="https://img.shields.io/badge/pnpm-%3E%3D12-F69220?logo=pnpm&logoColor=white" alt="pnpm 12 or newer" />
  <img src="https://img.shields.io/badge/React-19-61DAFB?logo=react&logoColor=black" alt="React 19" />
  <img src="https://img.shields.io/badge/TypeScript-7-3178C6?logo=typescript&logoColor=white" alt="TypeScript 7" />
  <img src="https://img.shields.io/badge/Vite-8-646CFF?logo=vite&logoColor=white" alt="Vite 8" />
</p>

<p>
  <a href="#quick-start"><strong>Quick Start</strong></a> ·
  <a href="#whats-inside"><strong>What's Inside</strong></a> ·
  <a href="#working-with-coding-agents"><strong>Coding Agents</strong></a> ·
  <a href="#add-blocks-from-7ovr"><strong>Add Blocks</strong></a>
</p>

</div>

<br />

<img src=".github/assets/home-dark.png" alt="The 7Ovr Starter home page: a sidebar with search, pages and resources, and a paginated Pokémon table" />

## Why this starter

Most starters stop at a blank page. This one ships a working app that describes itself, so every pattern you need has a live example to copy.

- **Optimized for coding agents.** `CLAUDE.md` holds every convention, `AGENTS.md` points to it, and four vendored skills keep Claude Code, Codex and Cursor on pattern.
- **An app shell, not a blank page.** A collapsible sidebar with search, a Ctrl+K command menu, light and dark themes, and a sheet on phones.
- **Data fetching done right.** Route loaders prefetch with TanStack Query, the page and page size live in the URL, and each record is cached on its own. The Home table loads from the free [PokéAPI](https://pokeapi.co).
- **Forms with real validation.** Report An Issue is a TanStack Form with a Zod schema. Errors appear after the first submit, focus moves to the first field to fix, and the issue opens prefilled on GitHub.
- **Tables that stay still.** TanStack Table with sorting, filtering and pagination. Columns keep a fixed width and drop cleanly on phones.
- **A design system that enforces itself.** [`@shadcn/lint`](https://github.com/shadcn-ui/lint) fails the build on raw colours, arbitrary values and restyled components.
- **Checked on every commit.** Oxlint, oxfmt, TypeScript 7, Vitest and a production build run in CI; Lefthook formats and lints staged files locally. Tests never touch the network.

## Quick start

You need Node 24 or newer and [pnpm](https://pnpm.io) 12 or newer.

```bash
git clone https://github.com/7ovr/shadcn-vite-starter
cd shadcn-vite-starter
pnpm install
pnpm dev
```

Open http://localhost:5173. Installing also sets up the Git hooks that format and lint your changes on commit.

## What's inside

| Layer    | Choice                                                          |
| -------- | --------------------------------------------------------------- |
| Build    | Vite 8                                                          |
| UI       | React 19, shadcn/ui (`base-nova` style) on Base UI              |
| Styling  | Tailwind CSS v4 with light and dark theme tokens                |
| Language | TypeScript 7 in strict mode                                     |
| Routing  | TanStack Router, file-based and code-split per route            |
| Data     | TanStack Query and Axios                                        |
| Forms    | TanStack Form with Zod validation                               |
| Tables   | TanStack Table                                                  |
| Tests    | Vitest and Testing Library                                      |
| Lint     | Oxlint with [`@shadcn/lint`](https://github.com/shadcn-ui/lint) |
| Format   | oxfmt, which also sorts imports and Tailwind classes            |
| Hooks    | Lefthook, which formats and lints staged files on commit        |

## Scripts

| Command             | What it does                                     |
| ------------------- | ------------------------------------------------ |
| `pnpm dev`          | Start the dev server, with the TanStack devtools |
| `pnpm build`        | Typecheck, then build the site to `dist/`        |
| `pnpm preview`      | Serve the production build locally               |
| `pnpm test`         | Run the tests once                               |
| `pnpm test:watch`   | Run the tests and rerun them on every change     |
| `pnpm lint`         | Lint the code                                    |
| `pnpm lint:fix`     | Lint and fix what can be fixed automatically     |
| `pnpm typecheck`    | Check the types                                  |
| `pnpm format`       | Format every file                                |
| `pnpm format:check` | Check the formatting without changing files      |

CI runs `lint`, `format:check`, `typecheck`, `test` and `build` on every push and pull request.

## Updating dependencies

Renovate can open updates every morning before 06:00 UTC, whenever the hosted service runs in that window. Stable minor and patch updates share one PR and merge once the required CI check passes. Major updates and 0.x packages need review. Releases must be at least 24 hours old, and Node and pnpm upgrades stay manual.

The shadcn CLI is temporarily held at **4.21.3**, with its Renovate updates disabled. Its transitive `braces` dependency has an [unpatched security advisory](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm). This hold retains the CLI and its stylesheet; it does not remove that vulnerability. Use `pnpm exec shadcn` to run the installed version rather than fetching `shadcn@latest`. Before lifting the hold, verify an upstream fix with `pnpm audit`, then update the exact pin and remove the corresponding Renovate rule.

To update without waiting for Renovate, run:

```bash
pnpm update
pnpm outdated
pnpm audit
pnpm lint
pnpm format:check
pnpm typecheck
pnpm test
pnpm build
```

`pnpm update` stays within the ranges in `package.json`. Review any remaining outdated packages separately, especially major versions and 0.x minor releases. Commit `package.json` and `pnpm-lock.yaml` together when both change; `pnpm update` may only change the lockfile. CI verifies the frozen lockfile on every PR.

## Project layout

```
src/
├── routes/                     One file per page
│   ├── __root.tsx              The app shell, not found page and error page
│   ├── index.tsx               Home, with the Pokémon table
│   ├── get-started.tsx         Get Started
│   ├── tech-stack.tsx          Tech Stack
│   └── agentic-coding.tsx      Agentic Coding
├── components/
│   ├── app-shell-1.tsx         The app shell: sidebar, search and navigation
│   ├── icons.tsx               Brand marks: 7Ovr, GitHub and the tech stack logos
│   ├── command-menu.tsx        The Ctrl+K command menu, loaded on first use
│   └── ui/                     shadcn/ui components and their variants
├── features/                   One folder per feature
│   ├── pokemon/                The Home table: API calls, queries, the fake PokéAPI for tests
│   ├── tech-stack/             The filterable Tech Stack table and its tool list
│   └── issue-form/             The Report An Issue dialog and form
├── integrations/               Axios, Query client, router, test setup
├── hooks/                      Shared React hooks: useTheme, useIsMobile and useLazyDialog
├── lib/                        Shared helpers, config, navigation, page meta and the theme
├── types/                      Type declarations for environment variables
├── route-tree.gen.ts           Generated from src/routes, do not edit
├── index.tsx                   Starts the app
└── index.css                   Tailwind and the theme tokens
```

## Architecture

The app is a single-page application: the server sends one HTML file and the browser handles every page from there.

**Start-up.** `src/index.tsx` renders the app with the shared Query client and router from `src/integrations/`.

**Layout.** Every page renders inside the app shell in `src/components/app-shell-1.tsx`: the sidebar with search, the pages and external resources, and the command menu on Ctrl+K. The sidebar footer and the command menu also open **Report An Issue**, a dialog that opens the matching GitHub issue form, prefilled; nothing is sent from the app. Each issue type in `src/features/issue-form/lib/issue.ts` has its form in `.github/ISSUE_TEMPLATE/`, and a test keeps the two in step. Page content sits in one centred column. The sidebar and the command menu both read their entries from `src/lib/navigation.ts`.

**Pages.** The router builds its pages from the files in `src/routes/`. Each page is its own bundle, loaded when you first visit or hover a link to it. To add a page, create a file in `src/routes/` and add it to `NAV_ITEMS` in `src/lib/navigation.ts` with a label and an icon. External links go in `RESOURCES` in the same file. Get Started demonstrates the status colour tokens, from `src/components/status-tokens.tsx`.

**Data.** Requests go through one Axios client and are cached by TanStack Query. A page's loader can start its requests before the page renders, so navigation stays instant.

**Features.** Keep each feature's API calls, queries, components and types together in `src/features/<name>/`.

### The example data

The Home route's loader starts fetching a page of Pokémon before the page renders, and TanStack Query caches every page. The page and page size live in the URL, so a shared link opens the same view. Tests run against a fake PokéAPI (`src/features/pokemon/api/fake-poke-api.ts`) and never touch the network.

To remove the example:

1. Delete `src/features/pokemon/`.
2. Remove the Pokémon section and its imports from `src/routes/index.tsx`.
3. Remove the `installFakePokeApi` import and `beforeEach` from `src/integrations/test-setup.ts`.
4. Remove the Pokémon heading check from `src/integrations/router.test.tsx`.
5. Set `VITE_API_URL`, or change the default in `src/lib/config.ts`.

## Add blocks from 7Ovr

The 7Ovr registry is already set up in `components.json`. Install any free block by name:

```bash
pnpm exec shadcn add @7ovr/hero-2
```

The source lands in `src/components/blocks/`. If the CLI asks to overwrite a file in `src/components/ui/`, answer no: this starter's copies carry their own variants. Then run `pnpm format` and import the block into a page:

```tsx
import HeroBlock from '@/components/blocks/hero-2'
```

Browse every block at [7ovr.com/blocks](https://7ovr.com/blocks).

For Pro blocks, set `REGISTRY_TOKEN` in `.env` to the token from your 7Ovr account, then install from the Pro registry:

```bash
pnpm exec shadcn add @7ovr-pro/<name>
```

## Working with coding agents

`CLAUDE.md` is the single source of truth for conventions: component patterns, the data-fetching rules, the design-system variants and the checks to run before finishing. `AGENTS.md` points every other agent to it.

Four skills are vendored into `.claude/skills/` for Claude Code and `.agents/skills/` for everything else: `vercel-react-best-practices`, `vercel-composition-patterns`, `shadcn` and `improve`. They are pinned in `skills-lock.json`.

## Environment variables

Copy `.env.example` to `.env` and fill in what you need. `.env` is ignored by Git.

| Variable         | Required | Used for                                                                     |
| ---------------- | -------- | ---------------------------------------------------------------------------- |
| `VITE_API_URL`   | No       | Where API requests go. Defaults to the PokéAPI; set `/api` for your backend. |
| `REGISTRY_TOKEN` | No       | Installing 7Ovr Pro blocks. Read by the shadcn CLI, not by the app.          |

Only variables starting with `VITE_` reach the app, as `import.meta.env.VITE_*`. They end up in the browser, so never put secrets in them.

With `VITE_API_URL=/api`, the dev server forwards every `/api` request to `http://localhost:8080`. Change the target in `vite.config.ts` if your backend runs elsewhere.

## Theme

Colours and fonts are CSS variables in `src/index.css`, with a light and a dark set, Oxanium for all text (13px body size) and Syne for the wordmark. Status colours `success`, `warning`, `info` and `destructive` each come with a `-foreground` pair. Change them there and every component and block follows. Press `d` to switch between light and dark, or use the button at the bottom of the sidebar.

## Deploy

`pnpm build` writes a static site to `dist/`. Because pages are handled in the browser, the host must answer every path with `index.html`, or refreshing any page but the home page returns a 404:

- **Vercel**: add a `vercel.json` with `{ "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }] }`.
- **Netlify**: add a `public/_redirects` file containing `/* /index.html 200`.
- **Anything else**: set up a fallback to `index.html`.

## Contributing

Issues and pull requests are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) for the setup, the conventions and the checks to run, and report security problems privately as described in [SECURITY.md](SECURITY.md).

## License

[MIT](LICENSE). Made by [7Ovr](https://7ovr.com).
反馈内容错误

看看同类模板

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