Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Adding cloudflare pages as an option for publishing (#3974)

xenium36988381af85
diff --git a/docs/guides/exporting.md b/docs/guides/exporting.md
index a1238c1141..8a83edfea3 100644
--- a/docs/guides/exporting.md
+++ b/docs/guides/exporting.md
@@ -154,7 +154,7 @@ Options:
cannot be opened directly from the filesystem (`file://`). Your server must
also serve the assets in the `assets` directory, next to the HTML file. For
a simpler publishing experience, publish to [GitHub
- Pages](publishing/github_pages.md) or use the [online
+ Pages](publishing/github_pages.md), [Cloudflare Pages](publishing/cloudflare_pages.md) or use the [online
playground](publishing/playground.md).
### Testing the export
diff --git a/docs/guides/publishing/cloudflare_pages.md b/docs/guides/publishing/cloudflare_pages.md
new file mode 100644
index 0000000000..29afd19cc6
--- /dev/null
+++ b/docs/guides/publishing/cloudflare_pages.md
@@ -0,0 +1,68 @@
+# Publish to Cloudflare Pages
+
+You can publish executable notebooks to [Cloudflare Pages](https://pages.cloudflare.com/)
+for free, after exporting your notebook to a WebAssembly notebook.
+
+## Export to WASM-powered HTML
+
+Export your notebook to a self-contained HTML file that runs using [WebAssembly](../wasm.md):
+
+/// tab | Export as a readonly app
+
+```bash
+marimo export html-wasm notebook.py -o output_dir --mode run
+```
+
+///
+
+/// tab | Export as an editable notebook
+
+```bash
+marimo export html-wasm notebook.py -o output_dir --mode edit
+```
+
+///
+
+See our [exporting guide](../exporting.md#export-to-wasm-powered-html) for
+the full documentation.
+
+## Publish to Cloudflare Pages using GitHub
+
+Create a new GitHub repository by visiting [repo.new](https://repo.new/) . After creating a new repository, go to your newly created project directory to prepare and push your local application to GitHub by running the following commands in your terminal:
+
+```
+cd output_dir
+git init
+git remote add origin https://github.com/<your-gh-username>/<repository-name>
+git add .
+git commit -m "Initial commit"
+git branch -M main
+git push -u origin main
+
+```
+
+To deploy your site to Pages:
+
+1. Log in to the Cloudflare [Dashboard](https://dash.cloudflare.com) and select your account.
+2. In Account Home, select Workers & Pages > Create application > Pages > Connect to Git.
+3. Select the new GitHub repository that you created and, in the Set up builds and deployments section, provide the following information:
+
+```
+Project name output-dir
+Production branch main
+Framework preset None
+Build command (optional) exit 0
+Build output directory /
+```
+
+4. Save and Deploy
+
+## Publish Manually
+
+To deploy your site to Pages:
+
+1. Create zip of the folder "output_dir"
+2. Log in to the Cloudflare [Dashboard](https://dash.cloudflare.com) and select your account.
+3. In Account Home, select Workers & Pages > Create application > Pages > Upload asset.
+4. Enter a project name then click Upload and select output_dir.zip .
+5. Save and Deploy
\ No newline at end of file
diff --git a/docs/guides/publishing/index.md b/docs/guides/publishing/index.md
index 5f8ba57afe..279eb896fa 100644
--- a/docs/guides/publishing/index.md
+++ b/docs/guides/publishing/index.md
@@ -15,6 +15,7 @@ This guide provides an overview of the various ways to publish marimo notebooks.
| [Embedding](embedding.md) | An overview of embedding notebooks in other sites |
| [From GitHub](from_github.md) | How to share links to executable notebooks hosted on GitHUb |
| [GitHub Pages](github_pages.md) | Publishing interactive notebooks on GitHub Pages |
+| [Cloudflare Pages](cloudflare_pages.md) | Publishing interactive notebooks on Cloudflare Pages |
| [Online playground](playground.md) | Sharing notebook links using our online playground |
| [Community Cloud](community_cloud/index.md) | Save notebooks to our free Community Cloud |
| [Self-host WebAssembly notebooks](self_host_wasm.md) | Self-hosting interactive WebAssembly (HTML export) notebooks |
diff --git a/mkdocs.yml b/mkdocs.yml
index d8718532b7..d8c8f0ac89 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -112,6 +112,7 @@ nav:
- Embedding: guides/publishing/embedding.md
- From GitHub: guides/publishing/from_github.md
- GitHub Pages: guides/publishing/github_pages.md
+ - Cloudflare Pages: guides/publishing/cloudflare_pages.md
- Online playground: guides/publishing/playground.md
- Community Cloud: guides/publishing/community_cloud/index.md
- Self-host WASM: guides/publishing/self_host_wasm.md