Bring your own app

Deploy your own Next.js or Astro app on Webflow Cloud.

Webflow Cloud deploys your app using the Edge runtime, enabling fast, globally distributed hosting. Before deploying to Webflow Cloud, your app may require some configuration to ensure compatibility with the Edge environment.

These instructions guide you through deploying an existing Next.js or Astro app to Webflow Cloud.

Get Started with Webflow Cloud

To familiarize yourself with Webflow Cloud, try the walkthrough in Get started with Webflow Cloud first.

Time Estimate: 30 minutes

Prerequisites

  • A Webflow account
  • A GitHub account
  • One of the following applications in a GitHub repository:
    • An Astro app (version 5 or higher)
    • A Next.js app (version 15 or higher)
  • Node.js 22.0.0 or higher and npm installed
    • Note: Currently, Webflow Cloud supports only the npm package manager

Fast path: one-click deploy

To deploy an application from a GitHub repository quickly, click this button and follow the steps to deploy it to Webflow Cloud:

Deploy to Webflow

The process prompts you to select a GitHub repository, install the GitHub app that gives Webflow access to the repository, and specify how to deploy it to Webflow Cloud.

To generate a one-click deploy button, see Deploy with one click.

Deploying an application from GitHub

Follow these steps to deploy an application from a GitHub repository:

  1. Log in to Webflow and go to your dashboard.

  2. From your Workspace, click New Project > App and authorize Webflow to access your GitHub account.

  3. Expand Import a GitHub repository, specify the GitHub organization and repository, and click the Import button next to the repository, as in this picture:

    Selecting the GitHub repository
  4. Give the app a name for Webflow Cloud and select the branch to deploy as in this picture:

    Selecting the branch to deploy
  5. Optional: Under Advanced settings, select the path to the root of the application and add any environment variables that the app needs.

  6. Click Deploy.

Webflow publishes the application and shows information about it.

  • To see information about applications that are part of a site, go to the site settings and click Webflow Cloud. The applications that are part of this site are listed. Then you can click an application to see information about its environments and deployments.

    Looking at the applications within a site
  • To see information about applications that are not within a site, go to the Workspace settings, where applications are listed next to sites. You can filter the list by clicking All projects > Apps.

    Looking at the applications within a workspace

    To get to its environments and deployments, open the application’s settings and then click Webflow Cloud.

Configuring applications for Webflow Cloud

These sections describe how to ensure that your application runs properly on Webflow Cloud.

Configure your app

Webflow Cloud deploys your app on the Edge runtime, enabling fast, globally distributed hosting. The Edge runtime environment differs from traditional Node.js servers, requiring specific configurations for compatibility.

The following steps outline common migration patterns to help you adapt your application for Webflow Cloud. Depending on your application’s specific requirements, you may need to make additional adjustments beyond these configurations.

Webflow Cloud is compatible with Next.js 15 and higher

Webflow Cloud is compatible with Next.js 15 and higher. If you’re using a version of Next.js lower than 15, please upgrade to the latest version.

1

Configure your base path

In Webflow Cloud, your application is served from the mount path you configured in your environment settings. For example, if your mount path is /app, your application will be accessible at yourdomain.webflow.io/app. To ensure proper routing and asset loading, you must configure the basePath and assetPrefix properties in your next.config.ts file to match this mount path exactly.

next.config.ts
1module.exports = {
2 // Configure the base path and asset prefix to reflect the mount path of your environment
3 // For example, if your app is mounted at /app, set basePath and assetPrefix to '/app'
4 basePath: '/app',
5 assetPrefix: '/app',
6
7 // Additional Next.js configuration options can be added here
8 // For example:
9 // output: 'standalone',
10 // reactStrictMode: true,
11}
2

Install and configure OpenNext

OpenNext is an adapter designed specifically for deploying Next.js applications to cloud environments like Webflow Cloud. By using OpenNext, you can deploy your Next.js app without managing complex infrastructure configurations yourself.

  1. Install OpenNext
    In your terminal, navigate to your app and run the following command to install OpenNext:

    $npm install @opennextjs/cloudflare@1.6.5
  2. Configure OpenNext
    Create a new configuration file named open-next.config.ts in your app’s root directory. This file configures OpenNext to work with Webflow Cloud’s deployment environment.

    open-next.config.ts
    1import type { NextConfig } from "next";
    2
    3import { defineCloudflareConfig } from "@opennextjs/cloudflare";
    4
    5export default defineCloudflareConfig({
    6});
3

Set up local testing for Webflow Cloud

Webflow Cloud uses Wrangler - Cloudflare’s CLI tool - to bridge the gap between local development and cloud deployment. By integrating Wrangler into your workflow, you can identify and resolve compatibility issues early, significantly reducing debugging time after deployment.

  1. Install Wrangler
    To get started, install and configure Wrangler as a dev dependency in your app.

    $npm install wrangler --save-dev
  2. Set up your Wrangler configuration
    Create a wrangler.json file in your app root that defines how your application will run in development.

    wrangler.json
    1{
    2 "$schema": "node_modules/wrangler/config-schema.json",
    3 "name": "nextjs",
    4 "main": ".open-next/worker.js",
    5 "compatibility_date": "2025-03-01",
    6 "compatibility_flags": [
    7 "nodejs_compat"
    8 ],
    9 "assets": {
    10 "binding": "ASSETS",
    11 "directory": ".open-next/assets"
    12 },
    13 "observability": {
    14 "enabled": true
    15 }
    16 /** Rest of Code **/
    17}

    See the Cloudflare documentation for more details on how to configure Wrangler.

  3. Create a Cloudflare environment file
    Create a new file named cloudflare-env.d.ts in your app’s root directory. This file will allow you to use environment variables defined in your Webflow Cloud environment.

    cloudflare-env.d.ts
    1interface CloudflareEnv {
    2}
  4. Add the development preview command
    Add this script to your package.json file to enable local testing with Wrangler. This command builds your Next.js app and immediately serves it using the Edge runtime, giving you an exact preview of how your app will perform in production on Webflow Cloud:

    package.json
    1"scripts": {
    2 // Existing scripts...
    3 "preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview", //
    4}
4

Define your Webflow Cloud framework configuration

Create a webflow.json file at the root of your app to inform Webflow Cloud about your app’s framework.

webflow.json
1{
2 "cloud": {
3 "framework": "nextjs"
4 }
5}

Managing assets and APIs

1

Asset references

How you reference assets depends on which component you’re using:

Next.js Image component: Local images are automatically optimized and served through Webflow’s CDN.

src/app/components/Logo.tsx
1import Image from "next/image";
2
3export function Logo() {
4 return (
5 <Image
6 src="/images/logo.png" // No prefix needed - automatically optimized
7 alt="Logo"
8 width={180}
9 height={40}
10 priority
11 />
12 );
13}

Plain img tags: Must include assetPrefix to load correctly and enable CDN caching.

src/app/components/Icon.tsx
1import config from "../../../next.config";
2
3// Get the asset prefix from config
4const assetPrefix = config.assetPrefix || config.basePath || '';
5
6export function Icon() {
7 return (
8 <img
9 src={`${assetPrefix}/icons/star.svg`} // Prefix required for CDN caching
10 alt="Star icon"
11 />
12 );
13}
2

APIs

When using Next.js with a configured base path, there’s an important distinction between API route definitions and client-side requests:

  1. Server-side API route handlers are automatically mounted at your base path by Next.js. To ensure your API routes run on the Edge runtime, add the export const runtime = 'edge'; directive to your API route.
  2. Client-side fetch calls must manually include the base path to correctly reach your endpoints

Without these adjustments, your API routes will not build properly and your client-side fetch calls will fail by targeting the wrong URL. Implement these patterns in all your APIs and client-side data fetching functions:

1// /src/pages/api/data.ts
2import { NextRequest, NextResponse } from 'next/server';
3
4export async function GET(request: NextRequest) {
5 return NextResponse.json({ message: 'Hello, world!' });
6}

Edge Runtime: Use fetch API

The Edge runtime has limited API support. Stick to fetch for API calls and avoid third-party clients like axios which may not be compatible.

Configuring environment variables

1

Access environment variable settings

In Webflow Cloud, navigate to your app’s environment settings:

  • If the application is in your Workspace:

    1. Open the Dashboard, go to your Workspace settings, and click All projects > Apps.
    2. Click the application to open its settings and then click Webflow Cloud.
    3. In the table of apps, click the app.
    4. In the table of environments, click the environment.
    5. In the table, go to the Environment variables tab.
  • If the application is in a site:

    1. Open the site settings and click Webflow Cloud.
    2. In the table of apps, click the app.
    3. In the table of environments, click the environment.
    4. In the table, go to the Environment variables tab.
2

Add and configure environment variables

Add each environment variable that your application requires:

  1. Click Add Variable
  2. Enter a name for the variable, such as DATABASE_URL or API_KEY
  3. Enter the value for the variable
  4. Toggle Secret Variable for sensitive values that should be encrypted, such as API keys and tokens
  5. Click Add variable

Repeat this process for all required variables.

Environment variables are only available at runtime

Environment variables in Webflow Cloud are injected at runtime only and are not accessible during the build process. Keep the following in mind to avoid build failures:

  • Do not include environment variable validation or required checks that run during build time
  • Use conditional logic to handle cases where environment variables might be undefined during builds
3

Access environment variables in your code

Your environment variables are accessible in your code using the following methods.

Next.js provides environment variables through the process.env object.

Next.js
1process.env.VARIABLE_NAME

Deploying applications

After configuring your app:

1

Test your app in the local preview environment

Before deploying, test your app locally in an environment that simulates Webflow Cloud. The preview script uses Wrangler to serve your app from the correct mount path.

$npm run preview

Your app will be available at http://localhost:PORT/YOUR_MOUNT_PATH, where PORT is the port number shown in your terminal and YOUR_MOUNT_PATH is the one you configured.

2

Authenticate with Webflow

In your terminal, run the following command to authenticate with Webflow:

$webflow auth login

This command opens a browser window to authenticate your Webflow account. After you grant access, the CLI saves a WEBFLOW_API_TOKEN to a .env file at the root of your app. The first time you run webflow cloud deploy, the CLI prompts you to choose the deploy target (site-attached or standalone) and the specific site or workspace — it does not pick one for you at login.

You can skip this step and let webflow cloud deploy trigger the OAuth flow on demand.

3

Deploy using the Webflow CLI

After authenticating, run the following command to deploy your app:

$webflow cloud deploy

On the first run, the CLI prompts you to identify the deploy target — choose Existing site to attach the app to a Webflow site (mounted at a path like /app), or New domain to deploy as a standalone app hosted on its own subdomain. To skip these prompts in CI/CD, pass --no-input together with --site-id (site-attached) or --workspace-id (standalone). See the webflow cloud deploy reference for all flags.

Additionally, when you commit your changes to your GitHub branch, Webflow Cloud will automatically detect the changes and deploy your app to your environment. Learn more about deployments in the documentation.

Your deployment may take up to 2 minutes to complete

View your deployment in the “Environment Details” dashboard. Review the status of your deployment by viewing the build logs.

4

View your app at your site's URL + mount path

Once your app has been successfully deployed, navigate to your site’s domain and mount path to see your newly deployed Webflow Cloud app!

Next steps

Now that you’ve successfully deployed your app on Webflow Cloud, here’s what you can do next.

Troubleshooting

For an app on its own domain, verify that the latest deployment succeeded.

For an app on a site, if you have never published your site before, publish it now. If you have already published your site, check your mount path, confirm the environment exists, and verify that the latest deployment succeeded.

The Webflow Cloud GitHub App may not have access to your repository. To check, go to the Webflow Cloud tab in your Webflow site settings and click “Install GitHub App.” Follow the prompts on GitHub to ensure Webflow has access to read from your repository. Once you grant access, try committing to the branch that Webflow Cloud should be monitoring for deployments in your app.

Check that you’re correctly using the base path in all asset and API references. Look for fixed paths that might be missing the base path prefix.

Verify that your callback URLs include the correct base path and that you’re not duplicating the base path in your code references.

Check your app’s build logs in the Webflow Cloud dashboard. Common issues include:

  • Incompatible Node.js version
  • Environment variables not configured correctly
  • Missing or incorrect framework configuration in the following files:
    • webflow.json
    • next.config.js or Astro.config.js
    • wrangler.json
    • cloudflare-env.d.ts or worker-configuration.d.ts
  • Custom build commands not supported (Webflow Cloud only uses Astro build or next build)

Webflow Cloud overrides custom cache headers from your application. Once content is cached, you can’t control caching behavior through standard HTTP headers like Cache-Control. See more on header behavior limitations here.

This means traditional cache invalidation methods won’t work - you’ll need to work within Webflow Cloud’s caching behavior rather than trying to override it.