Skip to content

feat(web): rewrite viewer with Hono + JSX, add Cloudflare Workers deploy#13

Merged
mikana0918 merged 1 commit into
mainfrom
feat/web-hono-cloudflare
May 28, 2026
Merged

feat(web): rewrite viewer with Hono + JSX, add Cloudflare Workers deploy#13
mikana0918 merged 1 commit into
mainfrom
feat/web-hono-cloudflare

Conversation

@mikana0918

Copy link
Copy Markdown
Contributor

Summary

  • Replace Next.js viewer with Hono + JSX SSR codebase
  • Add Cloudflare Workers deploy path (R2 native binding, gzip 188KB)
  • Keep Railway/Node path via @aws-sdk/client-s3 fallback in a shared storage layer

Why

Next.js viewer was overspec for a read-only S3 lister. Moving to Hono drops the bundle small enough for Workers free tier, enables R2 native binding (no credentials inside Worker), and keeps a single src/app.tsx driving both Node and Workers entries.

Architecture

  • src/app.tsx — shared Hono app
  • src/index.tsx — Cloudflare Workers entry
  • src/node.ts — Node entry (Railway / local) via @hono/node-server
  • src/lib/storage.ts — picks R2 binding if env.BUCKET exists, else dynamic-imports aws-sdk
  • src/middleware/basic-auth.ts — opt-in basic auth (unchanged behavior)
  • wrangler.toml[assets] for Tailwind CSS, [[r2_buckets]] binding, nodejs_compat
  • railway.json — preserved for Node deploys

Verification

  • npm run typecheck — passes
  • npm run build:css — Tailwind v4 generates 9KB CSS
  • wrangler deploy --dry-run — Total Upload 1.16 MiB / gzip 188 KiB (well under 1 MiB free-tier limit)

Test plan

  • npm run dev locally with .env.local populated → / lists sessions, /session/<key> renders
  • npm run dev:cf with wrangler r2 bucket create cchist + dummy objects → R2 binding path works
  • Basic auth toggles: unset = public, set = 401 until correct creds
  • Railway deploy still green using existing STORAGE_* env vars

🤖 Generated with Claude Code

Replace the Next.js app with a Hono + JSX SSR codebase that runs on both
Cloudflare Workers (R2 native binding) and Node/Railway (S3-compatible
via @aws-sdk/client-s3 fallback). Single src/app.tsx is shared by both
entries; storage layer picks the backend at runtime based on env.BUCKET.

Workers bundle is gzip 188KB — well under the 1MB free-tier limit.
Tailwind v4 CSS is built into public/ and served by wrangler [assets]
on Workers and @hono/node-server/serve-static on Node.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mikana0918 mikana0918 merged commit 3c2c22b into main May 28, 2026
1 check passed
@mikana0918 mikana0918 deleted the feat/web-hono-cloudflare branch May 28, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant