Pre-Deployment Checklist
1. Environment Variables
# .env.production
NEXT_PUBLIC_API_URL=https://api.sanjaythakur.com.np
DATABASE_URL=postgresql://...
2. Build Optimization
- Enable Static Export when possible
- Use ISR (Incremental Static Regeneration)
- Optimize images before deployment
3. Security Headers
Configure security headers in next.config.ts:
headers: async () => [
{
source: '/(.*)',
headers: [
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'X-Frame-Options', value: 'DENY' },
],
},
]
Performance Optimization
Core Web Vitals
- LCP (Largest Contentful Paint) < 2.5s
- FID (First Input Delay) < 100ms
- CLS (Cumulative Layout Shift) < 0.1
Caching Strategy
- Static assets: 1 year cache
- API responses: Based on content freshness
- HTML pages: 1 day cache
Monitoring & Analytics
Tools to Use
- Vercel Analytics
- Google Search Console
- Lighthouse CI
- New Relic APM
Deployment Process
- Push to main branch
- GitHub Actions run tests
- Vercel builds and deploys
- Run smoke tests
- Monitor performance metrics
Troubleshooting Common Issues
Build Failures
- Check Node version
- Clear .next folder
- Review build logs
Performance Issues
- Check image optimization
- Review bundle size
- Profile with Lighthouse
Resources
- Vercel Docs: https://vercel.com/docs
- Next.js Performance: https://nextjs.org/learn/seo/performance
