Static site
Last updated Aug 25, 2026 Note
Use this guide when you specifically want to deploy a Next.js static export to Cloudflare Pages. For Next.js on Workers, Cloudflare recommends vinext, which also supports static exports.
Next.js ↗︎ is an open-source React framework for creating websites and applications. In this guide, you will create a static Next.js application and deploy it using Cloudflare Pages.
This guide will instruct you how to deploy a static site Next.js project with static exports ↗︎.
Before you continue
All of the framework guides assume you already have a fundamental understanding of Git ↗︎. If you are new to Git, refer to this summarized Git handbook ↗︎ on how to set up Git on your local machine.
If you clone with SSH, you must generate SSH keys ↗︎ on each computer you use to push or pull from GitHub.
Refer to the GitHub documentation ↗︎ and Git documentation ↗︎ for more information.
Select your Next.js project
If you already have a Next.js project that you wish to deploy, ensure that it is configured for static exports ↗︎, change to its directory, and proceed to the next step. Otherwise, use create-next-app to create a new Next.js project.
npx create-next-app --example with-static-export my-app
After creating your project, a new my-app directory will be generated using the official with-static-export ↗︎ example as a template. Change to this directory to continue.
cd my-app
Create a GitHub repository
Create a new GitHub repository by visiting repo.new ↗︎. After creating a new repository, prepare and push your local application to GitHub by running the following commands in your terminal:
git remote add origin https://github.com/<GH_USERNAME>/<REPOSITORY_NAME>.git
git branch -M main
git push -u origin main
Deploy your application to Cloudflare Pages
To deploy your site to Pages:
- In the Cloudflare dashboard, go to the Workers & Pages page. Go to Workers & Pages ↗
- Select Create application.
- Select the Pages tab.
- Select Import an existing Git repository.
- Select the new GitHub repository that you created and then select Begin setup.
- In the Build settings section, select Next.js (Static HTML Export) as your Framework preset. Your selection will provide the following information:
Configuration option | Value
| Production branch | main |
| --- | --- |
| Build command | npx next build |
| Build directory | out |
After configuring your site, you can begin your first deploy. Cloudflare Pages will install next, your project dependencies, and build your site before deploying it.
Preview your site
After deploying your site, you will receive a unique subdomain for your project on *.pages.dev.
Every time you commit new code to your Next.js site, Cloudflare Pages will automatically rebuild your project and deploy it. You will also get access to preview deployments on new pull requests, so you can preview how changes look to your site before deploying them to production.
For the complete guide to deploying your first site to Cloudflare Pages, refer to the Get started guide.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-static-nextjs-site/#page","headline":"Static site","description":"Deploy a static site built using Next.js to Cloudflare Pages","url":"https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-static-nextjs-site/","inLanguage":"en","image":"https://developers.cloudflare.com/pages/framework-guides/nextjs/deploy-a-static-nextjs-site/og.png?v=8996c1edd88d8a4f","dateModified":"2026-08-25","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: This tutorial explains how to migrate an existing Firebase application to Cloudflare Pages. title: Migrating from Firebase image: https://developers.cloudflare.com/pages/migrations/migrating-from-firebase/og.png?v=35cc02f5f58e010b
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/pages/llms.txt
Use this file to discover all available pages before exploring further.
Docs