Next.js
How to deploy a Next.js site as a static page for free
Next.js is powerful, but not every project needs server-side rendering. If your site is mostly static pages, you can export it as plain HTML and deploy it anywhere — including HTML To Link, which gives you a free public URL in under a minute.
Enable static export in Next.js
Add output: 'export' to your next.config.mjs. This tells Next.js to generate a fully static site in the out/ directory when you run next build.
No API routes, no server components with dynamic data, no middleware — just pure HTML, CSS, and JavaScript that runs in any browser.
- // next.config.mjs
- export default { output: 'export' }
- Then run: npx next build
- Static files appear in the out/ directory
Deploy the out/ directory
Zip the out/ folder and upload it to HTML To Link. Set the entry file to index.html. You get a live URL immediately.
Alternatively, use the MCP server with the --next flag: npx htmltolink-mcp deploy --next. It handles the build and upload automatically.
- Manual: zip out/ → upload → pick index.html → publish
- CLI: npx htmltolink-mcp deploy --next (auto build + upload)
- Agent: tell Cursor 'deploy this Next.js project'
When static export is a good fit
Landing pages, documentation sites, portfolios, blog previews, marketing pages, and AI-generated front-ends are all great candidates.
If you need SSR, API routes, or database queries at request time, stick with Vercel or a Node server. For everything else, static export + HTML To Link is the fastest free path.
FAQ
Do I need to change my Next.js code?
Only if you use server-only features (API routes, getServerSideProps, middleware). Pages using getStaticProps or pure client components work as-is.
What about images and fonts?
They are included in the out/ directory automatically. Just make sure you use relative paths or the next/image loader configured for static export.
Can I update the site later?
Yes. Rebuild and re-upload to the same link. The URL stays stable across updates.