docs/guides/publishing/cloudflare.md
You can publish executable notebooks to Cloudflare Workers for free, after exporting your notebook to a WebAssembly notebook.
Export your notebook to a self-contained HTML file that runs using WebAssembly with the flag --include-cloudflare:
/// tab | Export as a readonly app
marimo export html-wasm notebook.py -o output_dir --mode run --include-cloudflare
///
/// tab | Export as an editable notebook
marimo export html-wasm notebook.py -o output_dir --mode edit --include-cloudflare
///
See our exporting guide for the full documentation.
When you use the --include-cloudflare flag, marimo creates two additional files in the parent directory of your output directory:
index.js: A simple Cloudflare Worker script that serves your static assetswrangler.jsonc: Configuration for Cloudflare's Wrangler CLITo run locally, run:
npx wrangler dev
To deploy to Cloudflare, run:
npx wrangler deploy
/// admonition | Need authentication or custom endpoints? type: tip
You can modify the index.js to include authentication or custom endpoints. This allows you to:
///
As an alternative to Cloudflare Workers, you can publish to Cloudflare Pages. To get started, create a new GitHub repository by visiting 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:
Project name output-dir
Production branch main
Framework preset None
Build command (optional) exit 0
Build output directory /
To deploy your site to Pages: