Next.js2 min read
A static Next.js site on Cloudflare Workers, with no Worker code
How this site is built: Next.js static export, served by Workers Static Assets, with no runtime, database, or adapter.
By IntoCoder
This site has no server. Every page you can visit is an HTML file that was generated once, at build time, and uploaded to Cloudflare. Here is how that works and where the limits are.
Two ways to run Next.js on Workers
Cloudflare Workers can host a Next.js app in two different shapes:
- With a runtime. An adapter packages the Next.js server into a Worker, so pages can render on request. You need this for server actions, cookies, or anything that depends on who is asking.
- Without one. Next.js writes plain files to a folder, and Workers serves that folder as static assets. No Worker script runs at all.
A portfolio and blog only change when someone edits a file in the repository. Nothing depends on the request, so the second shape is enough.
The configuration
Static export is one line in next.config.ts:
const nextConfig: NextConfig = {
output: "export",
images: { unoptimized: true },
};
next build now writes the whole site to out/. The Wrangler config points at that folder and nothing else:
{
"name": "intocoder",
"compatibility_date": "2026-10-01",
"assets": {
"directory": "./out",
"html_handling": "auto-trailing-slash",
"not_found_handling": "404-page"
}
}
There is no main entry, so there is no Worker script. html_handling lets /about resolve to about.html, and not_found_handling serves the exported 404.html with a real 404 status.
What you give up
Static export is strict about what it allows. These are not available:
- Server actions and request-time rendering
- Cookies and headers from the incoming request
- Redirects, rewrites, and headers defined in
next.config.ts - The built-in image optimizer
Some things still work because they run at build time: dynamic routes with generateStaticParams, sitemap.ts, robots.ts, and route handlers that export dynamic = "force-static". The RSS feed on this site is one of those route handlers; it becomes a plain rss.xml file.
Response headers move out of Next.js and into a public/_headers file, which Workers reads directly.
When to switch
The moment a page needs to know something about the request, static export stops being the right tool. At that point, add an adapter and a Worker runtime. Until then, a folder of files is cheaper, faster, and has less to break.