> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vibestrap.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 安装

> clone 仓库、装依赖、推 schema、起 dev。

Vibestrap 是一个标准的 Next.js 15 单仓库，使用 pnpm。如果你之前发过 Next.js 应用，
下面的内容不会有任何意外。

## 前置依赖

* **Node.js** ≥ 22 —— build 使用了需要新 V8 的 Edge runtime 特性。
* **pnpm** ≥ 10 —— `corepack enable` 然后 `corepack prepare pnpm@latest --activate`，
  或参考 [pnpm.io/installation](https://pnpm.io/installation)。
* **PostgreSQL** —— 本地 Postgres 用于开发（macOS 用 Postgres.app、`brew install postgresql`，
  或 Docker）。生产可以选 [Neon](https://neon.tech)、[Supabase](https://supabase.com)、
  [Railway](https://railway.app)、[Crunchy Bridge](https://www.crunchybridge.com) —— 都行。

## 1. clone + 安装

```bash theme={null}
git clone https://github.com/your-fork/vibestrap.git
cd Vibestrap
pnpm install
```

lockfile 已提交——不要用 `pnpm install --no-frozen-lockfile`，除非你刻意要升级。
CI 用 `--frozen-lockfile`。

## 2. 配置环境变量

```bash theme={null}
cp .env.example .env.local
```

打开 `.env.local`，至少填这两个：

```bash theme={null}
DATABASE_URL=postgres://localhost/vibestrap
BETTER_AUTH_SECRET=<32 字符以上的随机字符串，例如 `openssl rand -base64 32`>
```

其他 env 在 dev 里都可选——对应模块在缺 key 时要么 no-op、要么打一条友好的 warning。
完整列表见[环境变量参考](/zh/env-reference)。

## 3. 推 schema

```bash theme={null}
pnpm db:push
```

把你的 Drizzle schema（`src/db/*.schema.ts`）与数据库 diff 后直接应用。
用于开发。生产环境见[部署到 Vercel](/zh/deployment/vercel) → 「数据库迁移」一节。

## 4. 启动 dev

```bash theme={null}
pnpm dev
```

打开 `http://localhost:3000`。营销站正常渲染，AI 对话 demo 可用
（`/demos/chat` 走离线 mock provider），你可以通过 `/register` 创建一个 admin 账户。

## 5. 安装健康检查

```bash theme={null}
pnpm typecheck && pnpm lint && pnpm test
```

新 clone 上三条都应通过。任何一条失败请参考
[SUPPORT.md](https://github.com/xiaohu0x/vibestrap/blob/main/SUPPORT.md) 的常见坑列表。

## 接下来

* [Quickstart](/zh/quickstart) —— 10 分钟接入你的产品
* [配置](/zh/configuration) —— `src/config/site.ts` 控制什么
* [部署到 Vercel](/zh/deployment/vercel) —— 推到生产
