部署
SteadyRenew 原生适配 Netlify,结合了静态 + 预渲染的 Vite 前端、Netlify Edge Functions 以及无服务器 / 定时 Functions。若仅使用本地优先模式,也可直接将构建产物托管在任意静态站点服务上。构建产物
npm run build 会执行 vite build && tsx scripts/prerender.ts,向 dist/ 输出:
/app单页应用入口(未命中静态路由时通过/* -> /app/index.html回退)。- 预渲染静态营销落地页、定价页、法律条款与博客文章(
/、/zh、/about、/pricing、/zh/pricing、/privacy、/terms、/blog/*、/zh/blog/*、/sitemap.xml、/robots.txt)。 - Agent 与 MCP 交付物(
/agent/setup.md、/agent/ai-tools.json、/agent/openapi.yaml、/downloads/steadyrenew-mcp.mjs、/downloads/subscription-manager-mcp.tgz)。
Netlify 路由与配置(netlify.toml)
netlify.toml 定义了:
- 构建参数:构建命令
npm run build,发布目录dist,Node22。 - Edge Functions(
netlify/edge-functions/):smart-entry.ts(/):为回访应用用户与多语言访客做智能分流,同时保证搜索引擎爬虫抓取静态落地页。docs-proxy.ts(/docs、/docs/*、/.well-known/vercel/*):将 Mintlify 文档站挂载到/docs同域路径下,对/docs/_next/static/*启用长期immutable缓存,对 HTML 页面保持no-store。
- 开放 API 与 MCP 路由转发:
/api/mcp→/.netlify/functions/api-mcp/api/v1/subscriptions与/api/v1/subscriptions/*→/.netlify/functions/api-v1-subscriptions/api/v1/notification-settings→/.netlify/functions/api-v1-notification-settings/api/v1/analytics/*→/.netlify/functions/api-v1-analytics/api/v1/audit→/.netlify/functions/api-v1-audit
- SPA 回退:
/*→/app/index.html(200),仅在未命中dist/静态文件时生效。 - 安全与 CORS 响应头:全站启用 CSP、
X-Frame-Options: DENY、X-Content-Type-Options: nosniff,并为/llms.txt、/agent/*、/downloads/*配置明确的 Content-Type 与跨域头。
/BingSiteAuth.xml 与 msvalidate.01 meta 标签验证;IndexNow 提供 /16274743d7549a346d2cf33abbd2d73d.txt,可在生产发布后运行 npm run indexnow 提交 sitemap URL(网络异常不会阻断发布)。
Serverless 与定时 Functions
netlify/functions/ 包含以下服务端函数:
在本地联调完整 Functions 运行时请使用:
部署前检查清单
- 运行
npm run check(依次通过typecheck、lint、test、test:functions和build)。 - 在开启云同步、Passkey、API Key、AI 录入、支付或定时提醒前,按序执行
supabase/migrations/下的全部 SQL 迁移。 - 按需配置环境变量(生产环境设置
STRIPE_MODE=live,预发/测试环境设置STRIPE_MODE=test与PRODUCTION_SUPABASE_URL)。 - 将 Stripe Webhook 指向
https://your-domain.example/.netlify/functions/stripe-webhook,并订阅支付集成中列出的事件。 - 若修改了
docs-site/文档,执行cd docs-site && mint broken-links确认中英文文档无断链。