Next.js in practice: pure static export
Use output:export to ship Next.js as pure static files, capturing React ecosystem traffic without server-side dependencies.
Quick answer
Does Next.js require Vercel?
No. output:export can host on any static platform, including Cloudflare Pages.
Machine-readable page data: /data/nextjs-practical.json
In-depth analysis
Next.js is the dominant React meta-framework. output:export produces pure static output, but the core engine here is still Astro — Next pages exist here only for comparison and traffic capture. Three steps: (1) set output:export in next.config; (2) set images.unoptimized=true to disable server-side image optimization; (3) next build then next export to produce out/. Bottom line up front: when you need the React ecosystem but want pure static hosting, output:export is the lowest-friction path. Common pitfalls are using dynamic-route server data fetching or middleware under export mode, and forgetting images.unoptimized which breaks the export.
// next.config.mjs — pure static export (no server functions)
const nextConfig = { output: 'export', images: { unoptimized: true } };
export default nextConfig;
// Build: next build && next exportNext.js Overview · Key takeaways
- Tech choice and boundaries confirmed
- Core config in place
- Locally verified
- Postmortem notes recorded
FAQ & pitfalls
How do I choose between Astro and Next?
For content sites and bulk long-tail pages, prefer Astro (zero-JS first paint). For heavy interactive apps, look at Next.
Explore the hub
See all 5 guides in Next.jsSame category as this article, sorted across the codebase.
Next.js architecture: layered patterns for high-concurrency edge apps
The edge-delivery view of Next.js's layering and data flow.
Next.js best practices: engineering conventions for production
Field-tested Next.js practices from production, avoiding the common anti-patterns.
Next.js deployment guide: zero-ops edge publishing with Cloudflare Pages
Git-driven Next.js deployment in practice: commit to build, atomic publish to every edge node.
Next.js performance tuning: push first paint and edge response to the limit
Around Next.js's real bottlenecks, an actionable LCP / INP / CLS checklist.
Share & save
What readers are asking
Questions that keep coming back in reader feedback, already answered.
- 01
How do I fix a failing Next.js output: export build?
Server-side data fetching in dynamic routes, and middleware, both break the export; next/image also needs unoptimized or the export aborts.
See the full guide → - 02
Why is my Astro component's interactivity not working?
Components ship as zero-JS HTML by default, so an interactive one needs a client:* directive (client:load, client:visible, …). Without it the script is never bundled into the page.
See the full guide → - 03
Why is my custom Tailwind v4 brand colour not applied?
Colours must be declared in @theme (for example --color-brand). A missing @tailwindcss/vite plugin, or a leftover v3 config, makes bg-brand silently render nothing.
See the full guide →