---
title: Deploy to Cloudflare Workers
description: Build, smoke-test, and publish a Thally site as an OpenNext Cloudflare Worker.
url: https://pr-80-a9c4e9fe1b6c.thally.app/guides/deploy-cloudflare
---

# Deploy to Cloudflare Workers

Build, smoke-test, and publish a Thally site as an OpenNext Cloudflare Worker.

The Thally project includes portable configuration and scripts for a
server-capable Cloudflare Workers deployment. Install the optional OpenNext
and Wrangler tooling when you choose this hosting provider.

## Before you begin

Install the project's dependencies, then enable its Cloudflare profile:

```bash
npm run setup:cloudflare
```

This adds pinned OpenNext and Wrangler dependencies to your project and lockfile.
Authenticate Wrangler with the Cloudflare account that owns the target Worker.
Thally Cloud managed hosting supplies its own deployment tools and does not
require this setup command.

Set `THALLY_SITE_URL` and any optional secrets in the Worker environment. Do
not commit production secrets to `wrangler.jsonc`.

## Build the Worker

```bash
npm run build:cloudflare
```

The command creates the Worker entry point and static assets under
`.open-next/`.

## Smoke-test the artifact

```bash
npm run smoke:cloudflare
```

This exercises the adapted artifact under the Cloudflare runtime before you
publish it.

## Deploy

Use the project script:

```bash
npm run deploy:cloudflare
```

The script builds the OpenNext artifact and publishes it through the included
Cloudflare Workers configuration.

## Verify the Worker

Open the deployed URL and test a normal page, a search, and each enabled server
feature. Confirm `/llms.txt` and `/api/docs-index` use the expected origin.
Run the homepage, nested-page, and `/llms.txt` HTTP smoke commands from
[Verify the live site](/guides/deploying#verify-the-live-site) before relying
on the Worker deploy result.

If the custom domain differs from the initial Worker URL, update
`THALLY_SITE_URL` and redeploy so canonical and agent-facing links use the
custom domain.

## Next steps

- [Environment variables](/guides/environment-variables)
- [Troubleshoot a deployment](/guides/troubleshooting)
- [Protect private documentation](/guides/private-docs)