Sistine 文档

部署指南

将 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 main

2. 在 Vercel 导入

  1. 访问 vercel.com
  2. 导入你的 GitHub 仓库
  3. 设置所有环境变量(参见环境变量)
  4. 部署

3. 数据库迁移

首次部署后:

pnpm db:migrate

4. 配置 Webhook

用供应商后台登记 webhook(或一条命令):

pnpm webhooks:register --list      # 看已登记了哪些
pnpm webhooks:register --url https://your-domain.com

手填的话:

供应商URL需要的签名头
Dodohttps://your-domain.com/api/payments/dodo/webhookwebhook-signature(Standard Webhooks)
Waffohttps://your-domain.com/api/payments/waffo/webhookx-waffo-signature(RSA-SHA256)

登记完务必核对密钥是否与部署的一致 —— 不一致的唯一表现是 「供应商那边说我们的端点一直 401」:

pnpm verify:signature https://your-domain.com    # Dodo

5. 设置定时任务

用于年付订阅积分发放,配置每小时调用:

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:setup

7. 验证环境

确保生产环境 .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)

On this page