A static export of Next.js is just HTML, CSS and JavaScript. No server runs, no database waits, and hosting is free on Netlify. If your pages do not read cookies per request or mutate data, do this. It is the cheapest performance win there is.
Turn on static export
In next.config.ts, set output to export and turn off the image optimizer, which needs a live server:
const nextConfig: NextConfig = {
output: "export",
trailingSlash: true,
images: { unoptimized: true },
};Any component that uses cookies, server actions or middleware will now make the build fail, loudly and at compile time. That is the feature, not a bug: you learn what is dynamic before deploy, not after.
Tell Netlify where the site lives
Netlify's Next.js plugin detects output: export by itself and copies the out folder. Your netlify.toml can be two lines:
[build]
command = "npm run build"
publish = "out"- npm run build runs next build, which writes the whole site into out/ as HTML files.
- Netlify publishes out/ on its global CDN. Every page is a file. Nothing to start, nothing to crash.
- Add public/_headers for long cache lifetimes on images, fonts and bundles.
Know what you give up
- No middleware or rewrites, because no request handler exists anymore.
- No server actions or route handlers that read the request.
- Images ship as-is, so resize them once at build time and ship WebP.
Static is not a downgrade. It is choosing that your pages exist before a visitor shows up.
For anything people read, static is gacor: it is fast everywhere, costs nothing, and a deploy cannot break a running page. Want the full recipe for getting search engines to notice the new site? We wrote it right here.
