> ## Documentation Index
> Fetch the complete documentation index at: https://botflow.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy

> Publish your app to the web in seconds with one-click Cloudflare Pages deployment.

Botflow deploys to [Cloudflare Pages](https://pages.cloudflare.com/) — a global edge network with data centres in 300+ cities. Your app is served from the closest location to each visitor, with no server management required.

## Publishing for the first time

1. Click the **Publish** button in the top-right corner of the workspace toolbar.
2. The publish panel slides open.
3. Click **Deploy** (or the equivalent button for your project type).

Botflow will:

* Run your project's build command (`pnpm run build`) inside the sandbox
* Upload the compiled output to Cloudflare Pages
* Return a unique URL like `https://your-project-name.pages.dev`

The first deploy usually takes 15–45 seconds depending on build time. Subsequent deploys are faster because unchanged assets are cached.

## Re-deploying

After the first deploy, the **Publish** panel shows your current deployment URL. Click **Deploy** again at any time to push the latest changes from your sandbox to Cloudflare. You don't need to commit to GitHub first — the build runs directly from the project's current files in the sandbox.

<Tip>
  Re-deploying does not take your app offline. Cloudflare swaps to the new version atomically once the upload completes.
</Tip>

## Deployment URL

Every published project gets a stable URL at `*.pages.dev`. This URL is permanent for the project — re-deploying updates the content but keeps the same address.

The URL is shown in the Publish panel and can be copied directly. Share it with anyone — they don't need a Botflow account to view your app.

## Custom domains (Pro and Max)

Pro and Max plan users can serve a published project from their own domain instead of the `*.pages.dev` URL. The **Domain** section of the Publish panel offers two approaches — **Managed** and **CNAME** — on a small toggle.

### Managed domains (recommended)

With a managed domain, Botflow runs the DNS for you — no records to copy, no registrar fiddling per project.

<Steps>
  <Step title="Add your domain once">
    Go to the [Domains page](https://botflow.io/domains) and add your apex domain (e.g. `myapp.com`). Botflow gives you nameservers to set at your registrar. Once the domain points at Botflow, its status flips from **pending** to **active**.
  </Step>

  <Step title="Assign it to a project">
    In the Publish panel's **Managed** tab, pick the domain, choose a subdomain (e.g. `www`, `app`, or `@` for the apex), and click **Assign domain**. Botflow creates the DNS records and provisions SSL automatically.
  </Step>

  <Step title="Optionally serve both">
    Leave **Also serve at …** checked to point both the apex (`myapp.com`) and `www.myapp.com` at the same site.
  </Step>
</Steps>

Because Botflow controls the zone, assigning a subdomain to a project is instant — you only do the nameserver step once, no matter how many projects you publish.

### CNAME (bring your own DNS)

Prefer to keep your DNS where it is? Use the **CNAME** tab to point a hostname at your project without moving nameservers.

1. Open the **Publish** panel and switch the Domain section to **CNAME**.
2. Enter your hostname (e.g. `www.myapp.com`) and click **Add custom domain**.
3. At your registrar or DNS provider, add a CNAME record pointing that hostname at your project's `*.pages.dev` address (shown in the panel):

| Type  | Name                      | Value                          |
| ----- | ------------------------- | ------------------------------ |
| CNAME | `www` (or your subdomain) | `your-pages-project.pages.dev` |

4. Botflow polls for the record and provisions an SSL certificate automatically once it's detected.

DNS propagation typically takes a few minutes but can take up to 24 hours in some configurations.

### Domain status

The Publish panel shows the current status of an attached domain:

* **Pending** — Botflow is waiting on DNS (the nameserver delegation for managed domains, or the CNAME record for the CNAME flow)
* **Active** — the domain is live and SSL is provisioned
* **Error** — DNS isn't configured correctly; re-check your records

### Removing a domain

Click the trash icon next to the domain in the Publish panel to detach it. Your app continues to be available at the `*.pages.dev` URL.

## Build requirements

Botflow runs your project's build command and uploads the output directory. Make sure:

* Your `package.json` has a `build` script (e.g. `"build": "vite build"`)
* The build output goes to a standard directory (`dist/`, `out/`, `.next/` — Botflow auto-detects these)
* All required environment variables are set in the [ENV panel](/docs/features/env-vars)

<Warning>
  Build errors will be shown in the Publish panel. If your app builds locally (in the terminal) but fails during deploy, check that all required environment variables are set.
</Warning>

## Troubleshooting deployments

Having issues deploying? See [Troubleshooting → Deployment issues](/docs/features/troubleshooting#deployment-issues) for common problems and solutions.
