1.7 KiB
1.7 KiB
Deployment Patterns
Platform Comparison
| Platform | Best for | Gotchas |
|---|---|---|
| Vercel | Next.js, serverless | Cold starts; limited to 10s (Hobby) or 60s (Pro) for functions |
| Netlify | Static + serverless | Functions timeout at 10s (free) / 26s (paid) |
| Cloudflare Pages | Static + Workers | Workers have no Node APIs; use node-compat flag |
| VPS (Docker) | Full control, long-running | You manage SSL, updates, scaling |
| Railway/Render | Docker apps | Sleep after inactivity on free tier |
Common Deploy Issues
- Build fails locally works — Check Node version matches; use
.nvmrcorenginesin package.json - Environment variables missing — Platform dashboards don't auto-sync; redeploy after adding vars
- Static export breaks API routes —
next exportis static only; use Vercel/custom server for API routes - Trailing slashes — Configure consistently;
/aboutvs/about/causes duplicate content/redirects
DNS Setup
- Add A record — Point
@to platform IP (or use CNAME for subdomains) - Add CNAME for www — Point
wwwto apex or platform domain - Wait for propagation — Up to 48h but usually minutes; check with
digor online tools - SSL auto-provisions — Most platforms handle Let's Encrypt; may take a few minutes after DNS resolves
Deployment Checklist
- Environment variables set in platform dashboard
- Build command correct (
npm run build, notnpm start) - Output directory correct (
out,.next,dist) - Domain DNS configured and propagated
- HTTPS working (check certificate valid)
- 404 page configured
- Redirects for old URLs if migrating