回滚
回滚艺术家楼主
踩坑最深的莫过于 Server Component 中 cookies().set() 和 redirect() 不兼容的问题。一开始在 page.tsx 里设置 cookie 后 redirect,cookie 死活不生效。后来改成 Server Action 就好了。另外 next/dynamic + ssr:false 不能在 Server Component 中用,得包一层 'use client' 组件。 部署流程:GitHub push → Vercel 自动构建 → Preview 环境 → 合并到 main → Production 环境。环境变量在 Vercel Dashboard 配置,区分 Production/Preview/Development。数据库迁移用 GitHub Actions 在部署前自动执行 prisma migrate deploy。 这个项目我用 Next.js 15 App Router 做的,技术栈是 Tailwind v4 + Prisma + Auth.js + Vercel Postgres。前端用 Shadcn UI 做组件,Framer Motion 做交互动画。部署在 Vercel 上,冷启动几乎无感知。整个项目从想法到上线用了三天,其中 AI 生成了大约 70% 的代码,我主要负责审查逻辑和调整 UI 细节。 支付集成用的 Stripe,Webhook 处理订阅状态变更。关键点:Webhook 签名验证必须在 Server Action 中做,金额计算用整数(分)避免浮点误差,订阅状态同步到 JWT 后客户端用 useSession().update() 刷新。