Deployment Checklist
Deployment Checklist
Section titled “Deployment Checklist”Introduction
Section titled “Introduction”Before deploying your Next.js application to production, verify these items. This checklist helps prevent common deployment issues.
Pre-Deployment Checklist
Section titled “Pre-Deployment Checklist”-
npm run buildcompletes without errors - No TypeScript errors (
npx tsc --noEmit) - No lint warnings (
npm run lint) - Bundle size is within acceptable limits
Environment Variables
Section titled “Environment Variables”- All required environment variables are set on the deployment platform
- Secrets are not committed to version control
-
NEXT_PUBLIC_prefix is used correctly for client variables - Production database URL is configured
Security
Section titled “Security”- HTTPS is enforced (automatic on Vercel)
- Security headers are configured
- Authentication secrets are strong and unique
- API routes are protected where needed
Performance
Section titled “Performance”- Images use
next/imagewith proper dimensions - Fonts use
next/font(no external font requests) - Analytics scripts use
next/scriptwithafterInteractive - Critical pages have been tested with Lighthouse
- Metadata is set on all pages
-
robots.txtis configured - Sitemap is generated
- Canonical URLs are set
Post-Deployment Checklist
Section titled “Post-Deployment Checklist”- App loads successfully at the production URL
- Login/authentication flow works end-to-end
- API routes return correct responses
- Database connections are working
- Environment variables are accessible
- Custom domain works with SSL
- Analytics are receiving data
- Error monitoring is active
Rollback Plan
Section titled “Rollback Plan”Before deploying, know how to roll back:
Vercel: Go to Deployments → click the three dots on a previous deployment → “Promote to Production”
Self-hosted: Keep the previous Docker image tagged and ready:
docker pull myapp:previous-tagdocker stop myappdocker run -d --name myapp-rollback myapp:previous-tagCommon Mistakes
Section titled “Common Mistakes”- Deploying on a Friday afternoon — If something breaks, you’ll be debugging over the weekend.
- Not testing the production build locally — Run
npm run build && npm startlocally before deploying. - Missing runtime environment variables — Build may succeed but the app crashes on first request.
Summary
Section titled “Summary”Use the deployment checklist before and after every deployment. Test the production build locally, verify all environment variables are set, and have a rollback plan ready. Monitor the app closely after deployment.