Optimizing your app for Webflow Cloud
Webflow Cloud supports the Next.js, Astro, and Vite frameworks, though running any of them on the Workers runtime may require specific configuration or adjustments. This page offers guidance on framework-specific setup, limitations, and best practices to help you get the most out of your deployment.
Environment configuration
For general deployment and environment configuration, see the configuration guide. This page focuses on requirements and recommendations unique to each supported framework.
Next.js
Webflow Cloud deploys Next.js apps using the OpenNext Cloudflare adapter, an open-source tool that brings Next.js to the edge. It handles translating Next.js’s server-side features to the edge runtime, including routing, API routes, static assets, and server functions, enabling modern Next.js apps to run with minimal changes.
To run your Next.js app on Webflow Cloud, you may need to adapt some features and provide custom configuration. See the sections below for details.
Images
Webflow Cloud automatically optimizes images for better performance and reduced bandwidth usage. Here’s how different image types are handled:
Next.js Image component with local images
When you use the <Image /> component with local images Webflow Cloud automatically:
- Resizes images for optimal performance
- Serves images through Webflow’s CDN for faster loading
- Reduces bandwidth usage
Example:
Webflow Cloud automatically handles routing through your base path when using the Next.js Image component, so you don’t need to manually add assetPrefix to your image paths.
Next.js Image component with external images
When you use the <Image /> component with external images, including those from your main Webflow site, Webflow Cloud doesn’t automatically resize the image. However, you can still benefit from other Image component features like lazy loading.
Plain img tags
When using regular <img> tags, no automatic optimization occurs. For assets in your /public folder, include assetPrefix in the src path to ensure proper CDN caching:
Limitations
Some Next.js features have limitations when running on Webflow Cloud:
- Middleware: Node.js runtime middleware isn’t supported. Only Edge runtime middleware works on the Workers runtime
- ISR & On-demand revalidation: Incremental Static Regeneration and on-demand revalidation are experimental
- Composable caching: The
use cachedirective isn’t yet supported
See the OpenNext Cloudflare adapter documentation for current feature support.
Additional resources
- Cloudflare Adapter for Next.js
- Next.js Edge Runtime Documentation
- Cloudflare Workers Next.js Guide
- OpenNext x Cloudflare Images
Astro
Astro 6 and Astro 7 are supported
Webflow Cloud reads the Astro version from your package.json and installs the matching adapter. You don’t pin the adapter yourself, and you don’t declare the version anywhere.
If you declare a framework in webflow.json, use "astro" — not a version-specific name.
On an older major? Upgrade to Astro 6 or 7 before deploying — see Astro’s upgrade guides.
Upgrading an existing app to Astro 7
Deploying on Webflow Cloud doesn’t require any Webflow-specific changes when you upgrade — bump astro in your package.json and Webflow Cloud picks up the matching adapter on your next deployment.
Astro 7 does have its own breaking changes, so work through the Astro 7 upgrade guide first. Your Node.js version doesn’t need to change: Astro 6 already required 22.12, and Astro 7 keeps the same minimum.
Starting a new app
webflow cloud init scaffolds an Astro project for you, so you don’t pick a version — the CLI installs a supported one and keeps the template in step with Webflow Cloud.
To control the version yourself, create the project with Astro’s own tooling and deploy it as a bring-your-own-app. Webflow Cloud builds either kind of project the same way: it reads the version from your package.json and picks the adapter to match.
Ready-to-deploy examples
Webflow Cloud deploys Astro apps using the @astrojs/cloudflare adapter. The adapter supports server-side rendering, API routes, and advanced features like server islands and sessions—translating Astro’s server functionality to the Workers runtime for seamless edge deployment.
Most features work out of the box, but some Node.js APIs and integrations may need additional configuration. For details and advanced usage, see the Astro Cloudflare integration guide. However, we’ve outlined the most common adjustments below.
Loading React components
Be sure to add the client:load directive to your components to load your components.
Static pages
By default, all Astro routes are server-rendered on the edge. For static routes (such as a custom 404 page or privacy policy), enable pre-rendering to generate and serve them as static assets for faster loading.
Environment variables
Astro provides several ways to access environment variables, depending on where your code runs:
- Use
import.meta.envfor built-in variables likeBASE_URLandASSETS_PREFIX, and for any custom variables prefixed withPUBLIC_. Using thePUBLICprefix will make the variable available on both the server and the client. - Use
Astro.locals.runtime.envin Astro server-side components to access custom environment variables. - Use
locals.runtime.envin API routes to access custom environment variables.
To use locals.runtime.env variables during local development, create a dev.vars file in your app root. Use the same format as a standard .env file to define your environment variables.
API routes
Enable Edge runtime for API routes
To ensure Astro API routes work on the Edge runtime, add the following line to the top of your route:
Disable Astro’s CSRF protection (if needed)
You may encounter issues with POST requests containing form data. Disable Astro’s built-in CSRF protection and implement your own CSRF handling.
In your astro.config.mjs file, add the following:
Assets
Astro serves all static assets (such as images, stylesheets, and icons) from the public directory. Be sure to place all static files (images, CSS, fonts, etc.) in the public directory at your app root.
Tailwind CSS
To use Tailwind CSS in your Astro app, use the @tailwindcss/vite plugin to ensure compatibility. Once you’ve created your Astro app from the CLI, follow the instructions in the Tailwind CSS integration for Astro guide to set up Tailwind CSS.
@astrojs/tailwind is not supported on Webflow Cloud
@astrojs/tailwind is deprecated and not supported on Webflow Cloud.
Third-party templates and guides may still reference it, but it’s not recommended to use it. Instead, upgrade to the latest version of Tailwind CSS and use the @tailwindcss/vite plugin to ensure compatibility.
Vite
Webflow Cloud deploys any Vite app — React, Vue, Svelte, vanilla JavaScript, or anything else Vite builds. If your package.json has a vite dependency and no more specific framework, Webflow Cloud builds it as a Vite app.
Vite 6.1 or later is required
If your app is on an older version, Webflow Cloud upgrades Vite during the build. To avoid surprises, upgrade in your own repo first.
Ready-to-deploy examples
Each of these also has an -app-bindings variant with SQLite, KV, and object storage already wired up — for example hello-world-react-app-bindings.
Base path
Webflow Cloud sets Vite’s base option to your environment’s mount path at build time. Don’t set base yourself — it’s overwritten.
Read it through Vite’s standard import.meta.env.BASE_URL, which reflects whatever base was set to:
Vite rewrites asset URLs in your HTML, CSS, and imported modules automatically. You only need BASE_URL for paths you build yourself, such as fetch calls and links constructed as strings.
Adding API routes
A Vite app is a single-page app by default, and Webflow Cloud serves it as static assets. If you want server-side routes, add a src/worker.ts that handles them and falls back to your static assets:
If you don’t provide one, Webflow Cloud generates the asset-serving worker above without the API branch, so a plain SPA needs no worker file at all.
The ASSETS binding is provided by the platform and serves your built client output. Your storage bindings arrive on the same Env object.
This is a low-level interface
src/worker.ts exposes the underlying runtime handler directly. It’s supported and it works today, but it’s the most primitive way to add server-side code on Webflow Cloud, and it’s the layer most likely to gain a higher-level alternative later.
Keep your route handlers thin and your logic in ordinary modules they call. That way the handler stays a small adapter you can swap out, rather than something your application logic is built into.
Environment variables
Vite only exposes variables prefixed with VITE_ to client-side code, and it inlines them into your bundle at build time.
Never prefix a secret with VITE_
Anything named VITE_* is embedded in the JavaScript you ship to browsers, and marking it secret in Webflow Cloud doesn’t change that. Read secrets in src/worker.ts from the Env object instead, where they stay server-side.
Static assets
Put static files in public/ at your app root. Vite copies them to the build output as-is and Webflow Cloud serves them through the CDN. Reference them with BASE_URL:
Local development
vite dev works with no additional setup. For a run against the Workers runtime with your storage bindings connected, install the Cloudflare plugin and Wrangler:
Then add the plugin to your config and run vite dev as usual. Wrangler emulates the runtime and bindings on your machine, so no Cloudflare account is needed.
Webflow Cloud adds this plugin during its own build whether or not you install it, so adding it locally only changes your development experience.