Vercel Deployment Skill
This skill provides guidelines for deploying Next.js applications to Vercel and managing environments.
Core Directives
- •Environment Variables: Maintain a
.env.examplefile with all required keys (without secrets). Never commit.envor.env.localto source control. Configure all required environment variables (e.g.,DATABASE_URL,NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,CLERK_SECRET_KEY) in the Vercel dashboard. - •Build Process: Ensure
npm run buildexecutes without TypeScript errors or ESLint warnings. Treat warnings as errors during the CI/CD pipeline. - •Edge compatibility: Be aware of Vercel Edge Runtime limitations. Only use Edge Runtime for specific API routes or middleware where Node.js APIs (like
fs) are not required. - •Caching & Revalidation: Utilize Next.js caching correctly to minimize database load. Use
revalidatePathorrevalidateTagin Server Actions to invalidate Vercel's Data Cache after mutations. - •Preview Deployments: Ensure the application works in preview environments. Handle preview environment database connections gracefully (e.g., using branching in Neon).