For Nextjs projects, Cloudflare Pages currently support only static deployment, with dynamic behavior handled via Pages Functions.
Other Server-side features like
getStaticProps will not work as they do when running the development server, but Pages Functions can help you enable SSR features like API Routes to enable dynamic behavior using serverless functions. See below for more information on keeping form functionality when deploying to Cloudflare Pages.
Stackbit automatically deploys your site using the default deployment and hosting methods. You can still deploy your code to your own Cloudflare Pages account. Learn more about Stackbit's deployment options.
Before getting started, you'll want to transfer the code to your GitHub account.
To begin, go to the Cloudflare Pages site and sign in with your Cloudflare account. If you do not have an account yet, you can sign up as you get started deploying your new Pages site.
After logging into your Cloudflare account, in Account Home > go to Pages > Create a project. You will be prompted to sign in with your preferred git provider, which allows Cloudflare Pages to deploy your projects, and update your PRs with preview deployments. Sign in with your GitHub account.
Select the GitHub repo that you transferred to your account.
Once you have selected a repository, select Install & Authorize then Begin setup. You can then customize your deployment in the Set up builds and deployments page.
Your project name will be used to generate your project's hostname. By default, this matches your GitHub repo name.
The production branch indicates the branch that Cloudflare Pages should use to deploy the production version of your site. For most projects, this is the
master branch. All other branches that are not your production branch will be used for preview deployments.
In Build settings, choose Next.js (Static HTML Export) as the framework preset.
Now you're ready to deploy! Click on Save and Deploy, then wait for the project to deploy and your Stackbit site will be live! 🎉
If you are using Stackbit's forms, there's a bit more work to get them functioning in your Cloudflare Pages deployment.
functions/api/submission-created.js. You can also check out this migration doc for (moving from a site from Netlify to Cloudflare Pages)[https://developers.cloudflare.com/pages/migrations/migrating-from-netlify/].
- Follow this guide to obtain and configure the appropriate environment variables.
- (Optional) Update references in code and content from
See this Cloudflare guide for help on working with forms on your Cloudflare Pages project.