部署指南
将 Sistine Starter 应用部署到生产环境。
前提条件
部署前确保你有:
- PostgreSQL 数据库(Supabase、Neon 或 Vercel Postgres)
- 火山引擎 API Key
- Dodo Payments 或 Waffo(Pancake)账号与 API 密钥
- Resend API Key
- (可选)Google OAuth 凭据
- (可选)S3 兼容存储
部署到 Vercel
1. 推送到 GitHub
git push origin main2. 在 Vercel 导入
- 访问 vercel.com
- 导入你的 GitHub 仓库
- 设置所有环境变量(参见环境变量)
- 部署
3. 数据库迁移
首次部署后:
pnpm db:migrate4. 配置 Webhook
用供应商后台登记 webhook(或一条命令):
pnpm webhooks:register --list # 看已登记了哪些
pnpm webhooks:register --url https://your-domain.com手填的话:
| 供应商 | URL | 需要的签名头 |
|---|---|---|
| Dodo | https://your-domain.com/api/payments/dodo/webhook | webhook-signature(Standard Webhooks) |
| Waffo | https://your-domain.com/api/payments/waffo/webhook | x-waffo-signature(RSA-SHA256) |
登记完务必核对密钥是否与部署的一致 —— 不一致的唯一表现是 「供应商那边说我们的端点一直 401」:
pnpm verify:signature https://your-domain.com # Dodo5. 设置定时任务
用于年付订阅积分发放,配置每小时调用:
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
https://your-domain.com/api/cron/subscription-grants在 Vercel 上添加到 vercel.json:
{
"crons": [{
"path": "/api/cron/subscription-grants",
"schedule": "0 * * * *"
}]
}6. 创建管理员账户
ADMIN_EMAIL=admin@example.com pnpm admin:setup7. 验证环境
确保生产环境 .env 的以下值正确:
BETTER_AUTH_URL— 实际域名NEXT_PUBLIC_APP_URL— 实际域名RESEND_FROM_EMAIL— 已验证的域名发件人
部署后检查清单
- 数据库已迁移
- 已在所用供应商后台登记 Webhook URL(
pnpm webhooks:register --list) -
pnpm doctor:online通过(供应商侧产品 ID 真的存在) - 积分发放定时任务已设置
- 管理员账户已创建
- Resend 中已验证发件域名
- OAuth 重定向 URI 已更新为生产域名
- 分析工具 Key 已配置(PostHog、GA、Clarity)