Uzumibi is a Ruby web framework and project generator for WebAssembly-based edge and serverless runtimes. Ruby application code is compiled to mruby bytecode at build time and executed by mruby/edge inside a platform-specific host.
The uzumibi CLI currently provides templates for:
- Cloudflare Workers
- Fastly Compute
- Spin
- Google Cloud Run
- Browser Service Workers
- Browser Web Workers
Install the CLI and the WebAssembly target:
cargo install uzumibi-cli
rustup target add wasm32-unknown-unknownCreate and run a project:
uzumibi new --template cloudflare my-app
cd my-app
pnpm install
pnpm run devEdit lib/app.rb to define routes:
class App < Uzumibi::Router
get "/" do |req, res|
res.return(
200,
{ "content-type" => "text/plain" },
"Hello from #{RUBY_ENGINE} #{RUBY_VERSION}\n"
)
end
get "/hello/:name" do |req, res|
res.return(
200,
{ "content-type" => "text/plain" },
"Hello, #{req.params[:name]}!\n"
)
end
end
$APP = App.newFor Cloudflare Workers, pnpm run dev rebuilds the Wasm module and starts Wrangler. See the Cloudflare Workers guide for request-size configuration, external services, static assets, and Queue consumers.
uzumibi-cli— generates platform-specific application projectsuzumibi-gem— definesUzumibi::Router,Request, andResponseuzumibi-art-router— route matching and path-parameter extractionuzumibi-cloudflare-ext— Cloudflare host APIs exposed to Rubyuzumibi-google— Google Cloud integrations used by the Cloud Run templateuzumibi-on-*-spikedirectories — development and integration examples for individual runtimes
Uzumibi (うずみび) is pronounced roughly as “oo-zoo-mee-bee.” The Japanese word refers to live embers kept under ash so that the fire does not go out.
