Deployment

Once you've verified your application works on the development server, let's deploy it to Cloudflare Workers.

Preparing a Cloudflare Account

You need a Cloudflare account to deploy. If you don't have one yet, sign up at the Cloudflare dashboard. You can use Cloudflare Workers on the free plan.

Logging in to Wrangler

Log in to your Cloudflare account from the Wrangler CLI:

npx wrangler login

A browser window will open asking you to authenticate with Cloudflare. Once authentication is complete, a login success message will appear in the terminal.

Building WASM

Before deploying, you need to build the WASM module. If you've already run pnpm run dev at least once, the built .wasm file should already be in the src/ directory. If you haven't built yet, you can run just the build with the following commands:

cargo build --package hello-uzumibi --target wasm32-unknown-unknown --release
cp target/wasm32-unknown-unknown/release/hello_uzumibi.wasm src/

Running the Deployment

Deploy to Cloudflare Workers with the following command:

pnpm run deploy

This command internally runs wrangler deploy.

When the deployment starts, you'll see a message like this:

 ⛅️ wrangler 4.73.0
───────────────────
🌀 Building list of assets...
✨ Read 3 files from the assets directory /Users/udzura/zenn-wip/hello-uzumibi/public
🌀 Starting asset upload...

Pay attention to the size display in the logs. Artifacts generated by Uzumibi are approximately 650 KiB before compression and around 200 KiB with gzip compression:

Total Upload: 655.99 KiB / gzip: 204.28 KiB

On Cloudflare Workers' free plan, you can upload assets up to 3 MB, and the recommended configuration is to keep compressed size under 1 MB.

While larger applications may be difficult to serve on Cloudflare Workers, Uzumibi and mruby/edge applications are designed to provide minimal functionality to keep the size as small as possible. This makes them very advantageous for edge application development.

The URL displayed at the end will allow you to access your deployed application:

Uploaded hello-uzumibi (14.81 sec)
Deployed hello-uzumibi triggers (7.49 sec)
  https://hello-uzumibi.XXXXXX.workers.dev
Current Version ID: b7bcc75c-e557-4c39-b643-xxxxxxxx

Verifying the Deployment

Access https://hello-uzumibi.<your-subdomain>.workers.dev/ in your browser to see the HTML page you created earlier.

wrangler.jsonc Configuration

The deployed Worker's name and settings are managed in wrangler.jsonc:

{
    "name": "hello-uzumibi",        // Worker name (becomes the URL subdomain)
    "main": "src/index.js",         // Entry point
    "compatibility_date": "2025-12-30",
    "assets": {
        "directory": "./public",    // Static assets directory
        "binding": "ASSETS"
    }
}

If you want to change the Worker name, edit the "name" field and redeploy.

Custom Domain Configuration

By default, the application is deployed to a *.workers.dev domain, but you can also configure a custom domain. Set it up from the Cloudflare dashboard under "Workers & Pages", or add routes to wrangler.jsonc.

See the Cloudflare Workers documentation for details.

Chapter Summary

In this chapter, we walked through the basic development workflow for a Cloudflare Workers application using Uzumibi.

What We Learned

  1. Installing uzumibi-cli: We prepared prerequisite tools including the Rust toolchain, Node.js/pnpm, and Wrangler, then installed the CLI with cargo install uzumibi-cli.

  2. Creating a project: We generated a project with the uzumibi new --template cloudflare command and reviewed the directory structure and the role of each file.

  3. Implementing the application:

    • Created a static frontend page in public/index.html.
    • Implemented API endpoints in Ruby in lib/app.rb.
    • Learned the basic DSL of Uzumibi::Router (get, post, dynamic parameters, etc.).
  4. Development server: Started the local development server with pnpm run dev and verified operation using a browser and curl.

  5. Deployment: Deployed to Cloudflare Workers with pnpm run deploy and ran the application at a public URL.


In the following chapters, we'll cover the external service integration features (Fetch, Durable Object, Queue) available in Uzumibi on Cloudflare Workers.