This is app/hello.rb, a real
sinatra/sinatra 4.x
application running on Cloudflare Workers. Phase 13 moved off the
old janbiedermann/sinatra fork; we now track upstream
Sinatra with Opal-specific patches in-repo. The file would run
unchanged on any Rack server; the Cloudflare adapter lives entirely
in lib/cloudflare_workers.rb and does not leak through.
views/*.erb → precompiled by
bin/compile-erb → HomuraTemplates
registry → erb :name helperenv['cloudflare.DB'], env['cloudflare.KV'],
env['cloudflare.BUCKET'], env['cloudflare.AI'],
env['cloudflare.QUEUE_*'], and env['cloudflare.DO_*'];
cache reads/writes use the Cloudflare::Cache wrapper over
caches.default / caches.open.await; most routes no
longer hand-roll .__await__. Edge cases that still need
explicit async can use # await: true as before.The app now includes /posts backed by a
D1 posts table, /login for
the session / OAuth-style login flow, and /chat
for the streaming assistant UI. Together they exercise bindings, templates,
and async paths beyond the original hello-world surface.
Deploy reliability improved: wrangler deploy succeeded three
times in a row on the tightening bundle. The worker JS shrank roughly 34%
in compressed size versus the pre-Phase-15 peak (including dropping much of
opal-parser and trimming corelib/IRB paths from the shipped gem).